CI 中的資料治理

閱讀約需 93 分鐘 分鐘,14 節 中共有 10 個範例。

版次 2026.11.31 範例於 2026年11 月 19 通過測試 108 個範例中有 108 個通過 變更內容

由 AI 翻譯。經人工以英文驗證。 我們如何製作書籍

譯自英文書,版次 2026.11.31。 閱讀原文

讀完本章後,你可以把第 2 章到第 7 章的治理檢查合併成一個工作,在每個 pull request 上執行,並且只評估該 pull request 所更動的內容。當欄位沒有分類時,這個工作會失敗;它會執行存取政策與強制執行層的測試,回報每項結構描述變更在下游影響到什麼,並強制執行兩項破壞性變更檢查器(breaking-change checker,即比對結構描述兩個版本、找出會破壞讀取者之變更的工具)不會檢查的規則。你會把擁有權保存在 Open Data Contract Standard(ODCS)的合約中,這些合約由中繼資料產生,每個領域各有一個資料夾與一位程式碼擁有者;你會把各領域的規則疊加在全域規則之上,並以無人處理的發現數量來衡量每項檢查的雜訊。

前面幾章為一個線上學習平台建立了治理檢查,該平台的各團隊每週都會更動其結構描述,卻沒有任何 pull request 執行這些檢查。第 2 章依據已審查的中繼資料測試資料目錄,第 4 章從每次管線執行中讀取血緣。第 5 章測試存取政策,第 6 章測試在查詢上強制執行該政策的那一層。第 7 章則依據分類產生資料表屬性。這些檢查只在有人執行其範例時才會執行,團隊更動平台時從不會執行。有三項變更即將到來。CRM 團隊想新增一個欄位,存放學習者的工作電子郵件;學習團隊想重新命名一個報表管線所讀取的欄位;資料科學團隊則想不經遮罩就看到學習者所在的城市。每一項都是審查者會核准的小幅差異,卻都會改變什麼會損壞,或誰能看到什麼。

本章加入本書用來攔截這些變更的共用模組 lib.ci,也就是平台的治理工作。在本章中,「工作」(job)指的是這個 CI 工作,而不是 OpenLineage 所稱的 job。每個模擬的 pull request 都離線執行,使用兩個稱為 checkout 的資料夾,一個是主分支,一個是該 pull request 的分支。每個資料夾都包含:governance/,即平台的治理檔案;pipelines/,即其管線的 SQL;migrations/,即分支用來變更結構描述的 alter table 陳述式,由 lib.ci.migrate 套用為 Iceberg 結構描述變更;以及由中繼資料產生的檔案。對每一側,lib.ci.build 會以平台實際運作的方式建立一個暫存平台:先建立來源資料表,再套用該側的遷移,接著部署(把中繼資料寫入資料目錄,並設定每個資料表產生的屬性),然後執行該側自己管線的夜間作業,並產生血緣。在這些管線中,review_corpus 仍是第 4 章那份未受治理的副本,因此這個工作會持續檢查它的血緣;平台則是以第 9 章的受治理建置進行訓練。lib.ci.run 會執行檢查並比較兩側。過程不涉及 git 或網路,所有日期都與本書的「今天」,即 2026 年 10 月 1 日比較,絕不使用系統時鐘。

將所有檢查作為單一作業執行

最近一次變動於第 2026.11.27 版

只在有人想起時才執行的檢查只是一份報告,而報告往往無人閱讀。在提取請求(pull request)上,檢查是一道關卡:每次變更都會執行,且在變更合併之前執行,並透過結束碼使提取請求失敗。Open Policy Agent(OPA)建議在 CI 中以這種方式執行政策,使用旗標 --fail 與 --fail-defined,依查詢結果將結束碼設為 1(OPA CI/CD 文件)。由多項檢查組成的作業還需要另外四件事:

  • **每項檢查都會執行,並回報其所有發現,**因此一項失敗不會掩蓋下一項。當檢查本身當機時,會變成一項發現,即「檢查無法執行」,這會使作業失敗,而其他檢查仍會繼續執行。
  • **每項發現都有穩定的 ID,**因此同一個問題在每次執行時都有相同的名稱,可以被討論、計數與豁免。lib.ci 將它寫成檢查與對象的組合,例如 coverage/crm.learners.work_email。
  • **作業判斷的是提取請求所改變的內容。**它也會執行主分支的檢查,並比較兩者。提取請求所引入的發現會使它失敗。主分支上既有的發現會在每次執行時回報、計數,並標明負責的團隊,但不會使任何維持現狀的提取請求失敗。我們判斷,一項檢查若對每個提取請求都因其中無人造成的發現而失敗,就會被關閉。Google 的程式碼分析平台 Tricorder 預設只在變更所觸及的行上顯示其多數分析的結果(Sadowski et al., 2015)。
  • **檢查清單存放在經過審查的檔案中,**即 governance/ci.toml,因此要關閉某項檢查,就必須提交一份需有人核准的差異。

平台的作業依下列順序執行這些檢查:

檢查 來源 失敗條件
coverage 第 2 章與第 3 章 資料表沒有中繼資料或擁有者,或欄位沒有分類,或分類低於其名稱所建議的等級
contract-rules 本章 合約違反全域規則或網域規則
contracts 本章 產生的檔案已過期
policy-tests 第 5 章 Rego 測試或「誰能看到什麼」的資料列失敗
enforcement-tests 第 6 章 迴歸案例或「誰能看到什麼」的查詢失敗
migrations 本章 Iceberg 拒絕某項遷移
pipelines 第 4 章 管線無法執行,或其血緣無法讀取
lineage-classifications 第 4 章 欄位宣告的保護程度低於血緣所建議的程度
owner-review 本章 分類被降低,或擁有者或網域在未經核准下變更
removals 本章 欄位在被標示為棄用之前就被移除
properties 第 7 章 資料表缺少為其產生的屬性

作業看到的第一個提取請求來自 CRM 團隊。雇主會為其員工購買團隊授權,因此團隊在一次遷移中將 work_email 加入 crm.learners,卻忘了補上該欄位的中繼資料:

governance-ci-report.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""The platform's governance job on one pull request, run as a CI step runs it: the CRM team adds a work email tocrm.learners. The prose's point rests on the coverage finding for the new column and on the exit code the step returns."""from lib import cifrom lib.platform import scratchmain = ci.checkout()                      # the main branch: governance files, pipelines and the files generated from thembranch = ci.checkout(main)                # the pull request's branch, starting from main(branch / "migrations" / "0001-add-work-email.sql").write_text("alter table crm.learners add column work_email varchar;\n")print("files the pull request changes:", ", ".join(ci.changed(main, branch)))# What a CI step runs, `python -m lib.ci MAIN BRANCH --summary FILE`: it prints the report and its totals, writes the# report as Markdown for the pull request, and exits with the code it returns.summary = scratch() / "summary.md"code = ci.main([str(main), str(branch), "--summary", str(summary)])     # 1 when a finding this pull request adds fails itprint("the step exits with:", code)print("the summary it writes for the pull request:")print(summary.read_text(encoding="utf-8"), end="")
輸出python governance-ci-report.py
files the pull request changes: migrations/0001-add-work-email.sql
coverage: failed, findings 3, new 1, on main 2, waived 0, 12 tables checked
contract-rules: passed, findings 0, new 0, on main 0, waived 0, 10 contracts checked
contracts: passed, findings 0, new 0, on main 0, waived 0, 11 files checked
policy-tests: passed, findings 0, new 0, on main 0, waived 0, 24 tests and rows checked
enforcement-tests: passed, findings 0, new 0, on main 0, waived 0, 44 cases checked
migrations: passed, findings 0, new 0, on main 0, waived 0, 1 migrations checked
pipelines: passed, findings 0, new 0, on main 0, waived 0, 4 pipelines checked
lineage-classifications: passed, findings 0, new 0, on main 0, waived 0, 23 columns checked
owner-review: passed, findings 0, new 0, on main 0, waived 0, 77 columns checked
removals: passed, findings 0, new 0, on main 0, waived 0, 87 columns checked
properties: passed, findings 4, new 0, on main 4, waived 0, 12 tables checked
coverage/ai.review_corpus: no metadata; on main, owner team-platform
coverage/crm.learners.work_email: not classified; its name suggests personal
coverage/marketing.audience: no metadata; on main, owner team-platform
properties/ai.review_corpus: 7 of 7 generated properties missing; on main, owner team-platform
properties/analytics.course_performance: 4 of 4 generated properties missing; on main, owner team-analytics
properties/analytics.learner_activity: 4 of 4 generated properties missing; on main, owner team-analytics
properties/marketing.audience: 7 of 7 generated properties missing; on main, owner team-platform
change crm.learners, field 16: added as work_email string; named by 0 pipelines, reaches 0 columns
job: failed
checks run: 11
checks failed: 1
findings: 7
findings the pull request introduces: 1
findings already on main: 6
findings waived: 0
findings approved: 0
exit code: 1
the step exits with: 1
the summary it writes for the pull request:
## Governance job: failed

| Check | Result | New | On main | Waived | Checked |
| --- | --- | ---: | ---: | ---: | --- |
| `coverage` | failed | 1 | 2 | 0 | 12 tables |
| `contract-rules` | passed | 0 | 0 | 0 | 10 contracts |
| `contracts` | passed | 0 | 0 | 0 | 11 files |
| `policy-tests` | passed | 0 | 0 | 0 | 24 tests and rows |
| `enforcement-tests` | passed | 0 | 0 | 0 | 44 cases |
| `migrations` | passed | 0 | 0 | 0 | 1 migrations |
| `pipelines` | passed | 0 | 0 | 0 | 4 pipelines |
| `lineage-classifications` | passed | 0 | 0 | 0 | 23 columns |
| `owner-review` | passed | 0 | 0 | 0 | 77 columns |
| `removals` | passed | 0 | 0 | 0 | 87 columns |
| `properties` | passed | 0 | 4 | 0 | 12 tables |

### To fix in this pull request

- `coverage/crm.learners.work_email`: not classified; its name suggests personal

### Already on main, and whose it is

- `coverage/ai.review_corpus`: no metadata (team-platform)
- `coverage/marketing.audience`: no metadata (team-platform)
- `properties/ai.review_corpus`: 7 of 7 generated properties missing (team-platform)
- `properties/analytics.course_performance`: 4 of 4 generated properties missing (team-analytics)
- `properties/analytics.learner_activity`: 4 of 4 generated properties missing (team-analytics)
- `properties/marketing.audience`: 7 of 7 generated properties missing (team-platform)

### Schema changes

- `crm.learners`, field 16: added as work_email string; named by 0 pipelines, reaches 0 columns

這個提取請求引入了 1 項發現,也正是這一項使作業失敗:crm.learners.work_email 是 not classified; its name suggests personal。這項建議來自第 3 章的名稱規則,該規則會比對 e_?mail,因此發現中說明了應補上什麼。在作業的各項檢查中,有 1 項失敗,且該步驟以代碼 1 結束。主分支上的涵蓋率發現是 marketing.audience 與 ai.review_corpus,這兩張資料表自第 2 章發現它們以來,一直無人描述。兩張表都沒有擁有者,因此作業會指名平台團隊,ci.toml 讓平台團隊對無人擁有的資料表負責。第 4 章的血緣顯示兩者都含有個人資料,而且每份報告都會重複列出它們,直到有人為其補上描述。

其他檢查皆通過,其中包括第 5 章的政策測試(在分支的檔案所產生的資料上執行),以及第 6 章的強制執行測試(在分支的資料表上執行)。屬性檢查在主分支上回報了一些發現,例如 4 of 4 generated properties missing; on main, owner team-analytics:如第 7 章所發現,管線寫入的資料表在每次夜間執行時都會失去其產生的屬性,主分支與該分支皆然。結構變更 added as work_email string; named by 0 pipelines, reaches 0 columns 目前尚未觸及任何東西。

實用原則: 在每個提取請求上,將所有檢查作為單一作業執行,每項檢查以穩定的 ID 回報其所有發現,當機的檢查則視為一項失敗的發現。對於提取請求所引入、且既未被豁免也未獲核准的任何發現,以結束碼使作業失敗。主分支上已有的每項發現都要回報,予以計數並標明其擁有者,但不會使維持現狀的提取請求失敗。檢查清單應存放在經過審查的檔案中。

把關在拉取請求,而非提交

最近一次變動於第 2026.11.27 版

平台的工作在 CI 中執行。另一個可以執行檢查的地方是 pre-commit hook,它在作者的機器上、提交產生之前執行。pre-commit 是一個管理 git hook 的框架,通常只對一次提交所變更的檔案執行 hook,其文件將 hook 定位為在程式碼審查之前攔截簡單問題的方式(pre-commit)。這適合只需要單一檔案的檢查:例如 metadata.toml 是否能正確解析,以及每個分類是否為四個值之一。

它不適合涵蓋率檢查。CRM 團隊的拉取請求變更了 migrations/0001-add-work-email.sql,卻沒有變更任何中繼資料檔案,因此只篩選中繼資料檔案的 hook 會無檔可查。缺口存在於遷移所變更的目錄,與拉取請求從未動到的檔案之間,只有建置整個目錄的作業才看得見。hook 可以用 pre-commit 的 always_run 設定為一律執行,即使沒有檔案符合也會執行。但它只會在有人安裝的地方執行,而且任何人都能跳過它,方法是使用 pre-commit 的 SKIP 變數或 git 的 --no-verify,審查者兩者都看不到。

因此,把關的是拉取請求上的作業,並將它設為必要。GitHub 的分支保護可以要求所有必要的狀態檢查都通過,協作者才能將變更合併到受保護的分支(GitHub, protected branches),而非必要的狀態只是建議。發現結果出現在哪裡同樣重要。Google 的 Tricorder 作者發現,當開發者必須開啟儀表板或另外執行命令列工具時,分析工具的使用率就會下降(Sadowski et al., 2015)。那只是一間公司的經驗,而且針對的是程式碼分析而非資料,但這正是 lib.ci.main 不只回傳結束碼的原因。CI 步驟以 python -m lib.ci MAIN BRANCH 執行它,它會為每個發現印出一行,附上其 ID 與應補上的內容。它也會把報告寫成 Markdown,放在拉取請求中,也就是審查者閱讀差異內容的地方。張貼摘要,以及從拉取請求的審查中讀取核准,屬於 CI 服務的部分,不在本書範圍內。

**實用原則:**在作者機器上以 hook 進行快速的單一檔案檢查,並讓拉取請求上的 CI 作業成為把關者,由主分支的分支保護強制要求。把每個發現都放在拉取請求本身,附上其 ID 與處理方式,絕不只放在儀表板上。也要依排程對正式環境的目錄執行這些檢查,以涵蓋在任何拉取請求之外變動的資料表。

回報結構描述變更的影響範圍

最近一次變動於第 2026.11.27 版

CRM 團隊新增的欄位並未影響任何下游,但更名會,而且三種讀取者,也就是 Iceberg、SQL 與治理中繼資料,對更名的判斷各不相同。Iceberg 讀取者以欄位 ID 尋找欄位,規格中寫道「投影必須使用欄位 ID 進行」(Iceberg table spec, 1.12.0),因此更名後的欄位仍可讀取更名之前寫入的每一個檔案。SQL 則以名稱尋找欄位,所以同樣的更名會使每一個指名該欄位的查詢與管線失效。平台的治理中繼資料如第 2 章所決定,是以欄位 ID 為鍵,因此更名只需更新 ID 旁邊的名稱。規格中有效的基本型別提升包括:int 到 long、float 到 double,以及 decimal 的精度(只能加寬);在格式 v3 中另有 date 到 timestamp 或 timestamp_ns,以及型別為 unknown 的欄位可改為任何型別。其他任何變更都意味著要新增一個欄位。

變更會破壞哪些 SQL 屬於血緣問題,第 4 章已透過走訪欄位圖回答過。審查也必須沿著 INDIRECT 邊走訪,這是第 4 章對輸入的稱呼:這類輸入決定輸出包含哪些資料列,而非其值為何。OpenLineage 的欄位血緣 facet 為影響整個資料集的欄位血緣保留了一份 dataset 清單,其來源包括篩選、排序、分組、聯結、視窗函式等(ColumnLineageDatasetFacet, 1.54.0)。僅用於聯結或分組的欄位會影響它所餵入的每一列,只回報複製值的報告會漏掉這一點。lib.ci.changes 逐一依欄位 ID 比較雙方的結構描述。對於分支上每一個被更名、改型別或移除的欄位,它會走訪 main 分支的血緣圖:列出 SQL 指名該欄位的管線、值來自該欄位的欄位、它可能改變的每一個欄位,以及擁有這些欄位的團隊。

接著是學習團隊將 learning.courses.category 更名為 subject,變更同時出現在遷移與中繼資料檔案中。同一個 pull request 也修正了兩條指名該欄位的管線:

schema-change-impact.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""What the learning team's rename of learning.courses.category reaches, through Iceberg readers, SQL and lineage. Theprose's point rests on the courses an Iceberg reader still finds, the columns reached, and the job's verdict once the fix merges with the rename."""import pyarrow.compute as pcfrom lib import ci, retentionmain = ci.checkout()branch = ci.checkout(main)(branch / "migrations" / "0001-rename-category.sql").write_text(    "alter table learning.courses rename column category to subject;\n")ci.edit(branch, "governance/metadata.toml", '3 = { name = "category", classification = "public"',        '3 = { name = "subject", classification = "public"')       # the same field ID, renamedbefore, after = ci.build(main), ci.build(branch)# matched by field ID, so the rename is one change, not a column dropped and another addedchange = next(c for c in ci.changes(before, after) if c.table == "learning.courses")print("change:", change.kind, "from", change.before, "to", change.after)print("field ID, before and after:", change.field_id)# read by the new name: Iceberg maps it to the same field ID as beforesubjects = after.catalog.load_table("learning.courses").scan(selected_fields=("subject",)).to_arrow()print("courses whose subject an Iceberg reader finds:", pc.count(subjects["subject"]).as_py())print("pipelines whose SQL names it:", ", ".join(change.jobs))for job, why in sorted(after.failed.items()):    print(f"pipeline {job}, on the branch:", why)print("columns whose values come from it:", len(change.values))for column in change.values:    print("  value of:", column)print("columns it can change, DIRECT and INDIRECT:", len(change.reached))# a column's table is the first two parts of its name, schema.table.columnprint("tables those columns are in:", ", ".join(sorted({".".join(c.split(".")[:2]) for c in change.reached})))print("owners the report goes to:", ", ".join(change.owners))print("tables on main:", len(retention.tables(before.catalog)))print("tables on the branch:", len(retention.tables(after.catalog)))coverage = ci.run(before, after, checks=["coverage"]).checks[0]print("coverage findings on the branch:", ", ".join(finding.id for finding in coverage.findings))# The same pull request, with both pipelines changed to read the new name. Each side runs its own pipelines/.ci.edit(branch, "pipelines/course_performance.sql", "    c.category,", "    c.subject as category,")ci.edit(branch, "pipelines/course_performance.sql", "c.title, c.category", "c.title, c.subject")sql = (branch / "pipelines" / "marketing_audience.sql").read_text(encoding="utf-8")(branch / "pipelines" / "marketing_audience.sql").write_text(sql.replace("c.category", "c.subject").replace(    "f.category", "f.subject"), encoding="utf-8")fixed = ci.build(branch)ci.generate(fixed)                        # and the contracts generated again, as the author's hook wouldprint("files the fixed pull request changes:", ", ".join(ci.changed(main, branch)))for line in ci.lines(ci.run(before, fixed, checks=["pipelines", "coverage", "contracts", "lineage-classifications"])):    print("with the fix,", line)
輸出python schema-change-impact.py
change: renamed from category string to subject string
field ID, before and after: 3
courses whose subject an Iceberg reader finds: 200
pipelines whose SQL names it: course_performance, marketing_audience
pipeline course_performance, on the branch: Unknown column: category
pipeline marketing_audience, on the branch: Unknown column: category
columns whose values come from it: 2
  value of: analytics.course_performance.category
  value of: marketing.audience.favourite_category
columns it can change, DIRECT and INDIRECT: 12
tables those columns are in: analytics.course_performance, marketing.audience
owners the report goes to: no owner, team-analytics
tables on main: 12
tables on the branch: 10
coverage findings on the branch: coverage/ai.review_corpus
files the fixed pull request changes: governance/contracts/learning/courses.odcs.yaml, governance/metadata.toml, migrations/0001-rename-category.sql, pipelines/course_performance.sql, pipelines/marketing_audience.sql
with the fix, pipelines: passed, findings 0, new 0, on main 0, waived 0, 4 pipelines checked
with the fix, coverage: passed, findings 2, new 0, on main 2, waived 0, 12 tables checked
with the fix, contracts: passed, findings 0, new 0, on main 0, waived 0, 11 files checked
with the fix, lineage-classifications: passed, findings 0, new 0, on main 0, waived 0, 23 columns checked
with the fix, coverage/ai.review_corpus: no metadata; on main, owner team-platform
with the fix, coverage/marketing.audience: no metadata; on main, owner team-platform
with the fix, change learning.courses, field 3: renamed from category string to subject string; named by 2 pipelines, reaches 12 columns
with the fix, job: passed

對 Iceberg 而言,沒有任何東西壞掉。更名保留了該欄位的欄位 ID,所以分支上的 Iceberg 讀取者仍能找到 200 門課程的 subject。對 SQL 而言,指名該欄位的管線有 course_performance, marketing_audience 條,每一條都在分支上寫入任何內容之前就停止,因為第 4 章把無法讀取的血緣視為錯誤。就值而言,更名影響 2 個欄位,也就是類別的兩份副本。若計入所有邊,則影響 12 個欄位,即 analytics.course_performance, marketing.audience 的每一個欄位,因為類別會用於課程報告的分組,並為每位學習者的最愛排名。報告會送給 no owner, team-analytics:分析團隊,而 marketing.audience 尚無擁有者,所以無人接收。

失敗的建置會掩蓋它所破壞的東西。分支的目錄中有 10 個資料表,main 上則有 12 個,因為壞掉的管線什麼都沒寫入。涵蓋率只回報 coverage/ai.review_corpus:不存在的資料表無法被發現未加描述,因此 marketing.audience 的發現結果也消失了。雙方各自執行自己的 pipelines/,所以修正會隨更名一起提交:當兩條管線都讀取 subject 時,該工作回報 passed。在正式環境中,合併也可以守住審查時所見的內容。REST 目錄的提交可以帶有 AssertCurrentSchemaId,它要求資料表目前的結構描述 ID 與該要求所指名的 ID 相符(REST catalog spec, 1.12.0),因此依某一個結構描述審查過的遷移,會失敗而不會套用到另一個結構描述上。

實用原則: 以欄位 ID 比較結構描述,絕不以名稱或結構描述 ID 比較,並從三方面回報每一項更名、型別變更與移除:Iceberg 讀取者是否受影響、哪些管線的 SQL 指名該欄位,以及它透過血緣(包含 INDIRECT 邊)影響到什麼。將報告送給它所影響的每一個資料表的擁有者。會破壞管線的更名,要與該管線的修正在同一個 pull request 中合併,絕不能早於修正。

降低分類等級前先詢問擁有者

最近一次變動於第 2026.11.27 版

破壞性變更檢查工具保護的是結構描述(schema)的讀取者。dbt 的模型合約(model contracts)會把移除欄位或變更欄位資料型別標示為破壞性變更,因為這些變更可能影響下游使用者(dbt model contracts)。datacontract-cli 的 breaking 指令會比較兩份 ODCS 合約,並讓破壞使用者所依賴保證的變更失敗(datacontract-cli 1.2.7)。兩者都不把保護視為保證。在 datacontract-cli 1.2.7 中,沒有任何規則涵蓋屬性的分類或團隊人員的角色,因此這兩者的變更會落入一條將其標示為未測試的規則(rules.py)。偵測器以 INFO 層級回報這類變更(detector.py),這個層級不會使檢查失敗。指令只有在出現 ERROR 項目時才以代碼 1 結束(breaking 指令原始碼、breaking 模型原始碼)。examples/requirements.txt 並未鎖定該版本,因此沒有任何範例會執行它。2026 年 10 月 22 日,datacontract-cli 1.2.7 對本章為 crm.learners 產生的合約執行檢查,將更名的 email 判為失敗,結束代碼為 1。它把更名視為移除,即使該屬性仍保留其 id,原因是它依名稱比對屬性(normalize.py)。至於 email 從 personal 重新分類為 public,以及擁有者的變更,它都放行,結束代碼為 0。ODCS 本身指出分類「可以是任何內容」(ODCS v3.2.0 schema)。

然而每項政策都會讀取分類,因此降低分類是中介資料檔案所能帶來的最重大變更之一。我們加入第一條自訂規則:降低欄位的分類、變更資料表的擁有者,或將資料表移到另一個領域,都需要主分支上該資料表擁有團隊的核准。移動資料表視同變更擁有權,因為領域自身的規則適用於其資料表(後續一節)。擁有者取自主分支,否則拉取請求可以把資料表交給新的擁有者,再由新擁有者核准降級。第 2 章已為模型的草稿訂下相同規則:只有審查者可以降低分類,並須在欄位的描述中寫明理由。

資料科學團隊的拉取請求排在最後。它把 crm.learners.city 從 personal 降為 internal,好讓資料科學家能依城市將學習者分組。存取政策會對資料科學家將個人欄位假名化,而這次降級使 city 脫離該規則。這次執行先在變更前後詢問政策,接著執行檢查結構描述與政策的各項檢查,以及擁有者規則:

classification-downgrade.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""A pull request from the data-science team lowers crm.learners.city from personal to internal. The prose's point restson analyst-1's mask on each side, and on the owner rule failing alone."""from lib import ci, policymain = ci.checkout()branch = ci.checkout(main)ci.edit(branch, "governance/metadata.toml", '6 = { name = "city", classification = "personal"',        '6 = { name = "city", classification = "internal"')before, after = ci.build(main), ci.build(branch)reading_city = policy.request("analyst-1", "crm.learners", ["learner_id", "city"])for side, name in ((before, "main"), (after, "the branch")):    rego = policy.interpreter(side.governance / "policies", data=ci.policy_data(side))    # a column with no mask in the decision is shown as it is stored    print(f"analyst-1 reading city, on {name}:", policy.decide(reading_city, rego)["column_masks"].get("city", "unmasked"))checks = ["policy-tests", "enforcement-tests", "removals", "owner-review"]report = ci.run(before, after, checks=checks)print("schema changes:", len(report.changes))for line in ci.lines(report):    print(line)# The approvals come from the pull request's reviews: one entry per approving review, named by the reviewer's team.# The owner rule passes when it raises no unapproved finding.owner_review = lambda approvals: "passed" if ci.run(before, after, approvals, checks=["owner-review"]).passed else "failed"print("owner-review, once team-crm approves:", owner_review(["team-crm"]))print("owner-review, once team-analytics approves:", owner_review(["team-analytics"]))ci.edit(after.root, "governance/ci.toml", "teams = {}", "teams = { team-crm = 2 }")     # team-crm asks for two# one approval from team-crm and one from another team: team-crm still needs a second of its ownprint("owner-review, two required, one from team-crm:", owner_review(["team-crm", "team-platform"]))print("owner-review, two required, two from team-crm:", owner_review(["team-crm", "team-crm"]))
輸出python classification-downgrade.py
analyst-1 reading city, on main: pseudonymize
analyst-1 reading city, on the branch: unmasked
schema changes: 0
policy-tests: passed, findings 0, new 0, on main 0, waived 0, 24 tests and rows checked
enforcement-tests: passed, findings 0, new 0, on main 0, waived 0, 44 cases checked
removals: passed, findings 0, new 0, on main 0, waived 0, 87 columns checked
owner-review: failed, findings 1, new 1, on main 0, waived 0, 77 columns checked
owner-review/crm.learners.city: lowered from personal to internal; needs team-crm's approval
job: failed
owner-review, once team-crm approves: passed
owner-review, once team-analytics approves: failed
owner-review, two required, one from team-crm: failed
owner-review, two required, two from team-crm: passed

中介資料檔案中的一個字,就能對整個角色解除某欄位的遮罩,而除了擁有者規則之外,沒有任何檢查會察覺。analyst-1 讀取 city 時,在主分支上得到 pseudonymize,在分支上則得到 unmasked。作業回報 0 個結構描述變更,因此破壞性變更檢查工具沒有可比較的內容。政策測試通過,passed, findings 0, new 0, on main 0, waived 0, 24 tests and rows checked,強制執行測試也通過,因為它們都不讀取 city;移除檢查同樣通過,因為沒有欄位被移除。只有擁有者規則失敗,失敗處在 lowered from personal to internal; needs team-crm's approval。

決定擁有者規則結果的是擁有者的核准。每個核准的審查會以一筆項目的形式送達 lib.ci.run,並以審查者所屬團隊命名。取得 team-crm 的核准後,擁有者規則回報 passed;若是取得並不擁有該資料表的 team-analytics 的核准,則回報 failed。

實用原則: 將降低分類、變更擁有者與移到另一個領域,視為需要主分支上該資料表擁有者核准的變更,並在核准之前讓作業失敗;切勿依賴破壞性變更檢查工具來處理這些變更。要求在同一個拉取請求中,於欄位的描述寫明理由。提高分類不需要這類核准,因為它只會隱藏更多內容。

此部分尚未翻譯,因此以英文呈現。

Deprecate a column before removing it

最近一次變動於第 2026.11.31 版

The owner rule guards a change that breaking-change checkers ignore. Removing a column is the change they all catch, but by then the removal is already under review, too late to help the readers it breaks. ODCS 3.2.0 adds a way to warn readers first. Any element of a contract, a schema object or a property, nested ones included, may set the optional deprecated boolean to signal that it is no longer recommended for use. The standard also asks that the description point to a replacement and give migration guidance (ODCS v3.2.0 schema). Our second rule makes the deprecation warning a required step: a column may leave a table only once the main branch has marked it deprecated. That takes two pull requests, one that deprecates the column and one that removes it, and the column's readers have the time between them to move off it.

The platform's metadata file had no such field, so this chapter adds one: deprecated = true in a column's entry. lib.metadata.load reads it as Column.deprecated, false when it's absent, and lib.ci.contract writes it into the column's contract as ODCS's deprecated.

The platform's best candidate is billing.payments.card_number. Its own description says it "Should not be stored at all", and chapter 3 found that it holds full card numbers. team-billing removes it twice, each time by dropping the column in a migration and deleting its metadata entry: once straight away, and once after a pull request that deprecates it has merged:

deprecate-then-remove.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""team-billing removes the legacy card_number column from billing.payments: once straight away, and once after a pullrequest that deprecates it has merged. The prose's point rests on the two removal lines."""import yamlfrom lib import cientry = ('8 = { name = "card_number", classification = "sensitive", '         'description = "The full card number, from a legacy export. Should not be stored at all." }\n')# the note goes after the description's sentence ending "at all.", and deprecated = true goes inside the entry's bracesdeprecated_entry = entry.replace("all.", "all. Deprecated: reconcile payments by payment_id.").replace(" }", ", deprecated = true }")def remove_card_number(base, line):    """A pull request on top of `base` that drops the column and deletes its metadata entry."""    branch = ci.checkout(base)    (branch / "migrations" / "0001-drop-card-number.sql").write_text("alter table billing.payments drop column card_number;\n")    ci.edit(branch, "governance/metadata.toml", line, "")    return branchmain = ci.checkout()deprecated = ci.checkout(main)            # the first pull request: mark the column deprecated, and say what replaces itci.edit(deprecated, "governance/metadata.toml", entry, deprecated_entry)for base, line, name in ((main, entry, "straight away"), (deprecated, deprecated_entry, "after the deprecation merged")):    report = ci.run(ci.build(base), ci.build(remove_card_number(base, line)), checks=["removals"])    print(f"removal, {name}:", "passed" if report.checks[0].passed else "failed")    for finding in report.checks[0].findings:        print(f"  {finding.id}:", finding.message)# property 7 is the eighth column, field 8: card_number, the column the deprecation markscard_number = ci.contract(ci.build(deprecated), "billing.payments")["schema"][0]["properties"][7]print("the deprecated column in its ODCS contract:")print(yaml.safe_dump(card_number, sort_keys=False, width=200), end="")
輸出python deprecate-then-remove.py
removal, straight away: failed
  removals/billing.payments.card_number: removed without being deprecated on the main branch first
removal, after the deprecation merged: passed
the deprecated column in its ODCS contract:
id: field-8
name: card_number
logicalType: string
physicalType: string
required: false
description: 'The full card number, from a legacy export. Should not be stored at all. Deprecated: reconcile payments by payment_id.'
classification: sensitive
deprecated: true

Straight away, the removal fails, removed without being deprecated on the main branch first. After the deprecation has merged, the same removal reports passed. In between, the contract carried the warning to everyone who reads contracts, not only to the repository: deprecated: true, with a description that says how to reconcile payments without the column. The rule checks the order of the two changes, not the time between them. How long readers get is a decision for the owning team and the column's readers, and the impact report says who those readers are.

Working rule: Remove a column in two pull requests: first mark it deprecated, with its replacement in the description, and merge that; then drop it from the table and its entry from the metadata. Fail any removal of a column the main branch hadn't deprecated. Agree with the column's readers how long the deprecation lasts, since the job checks only that it came first.

此部分尚未翻譯,因此以英文呈現。

Route each domain's reviews by path

最近一次變動於第 2026.11.31 版

The owner rule asks a table's team to approve its downgrades, and the repository can route that request. GitHub requests code owners' review automatically when a pull request modifies code they own, and a branch protection rule can require that review (GitHub's documentation, About code owners). The platform keeps all its metadata in one file, governance/metadata.toml, which suits 5 teams in one repository. A file has one set of owners, though, so the request can reach the right team only if each team's metadata lives under a path of its own.

ODCS draws the same lines. A contract names one domain, the logical data domain it belongs to (ODCS v3.2.0 fundamentals). ODCS has no owner field: ownership is a free-form role on a member of the contract's team (ODCS v3.2.0 team). lib.ci.contract writes each described table as an ODCS contract. It records the domain, the owning team as a member with the role owner, and each column as a property whose id holds its Iceberg field ID. ODCS defines a property's id as "A unique identifier for the element used to create stable, refactor-safe references". lib.ci.generate writes each contract into a folder for its domain, and a CODEOWNERS file in .github/, the first place GitHub looks for one. Both are generated from the metadata, never typed. Ask whom GitHub would request for the data-science team's downgrade of city:

domain-contracts.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""Ownership as ODCS contracts, a folder per domain, and who GitHub asks to review the downgrade of crm.learners.citywhen the metadata is one shared file, and when each domain has a folder of contracts generated from it. The prose'spoint rests on the first review line and on the contracts check failing before the files are generated again."""import yamlfrom lib import cimain = ci.checkout()                      # the main branch holds the contracts and CODEOWNERS generated from its metadatabranch = ci.checkout(main)ci.edit(branch, "governance/metadata.toml", '6 = { name = "city", classification = "personal"',        '6 = { name = "city", classification = "internal"')shared = ["/governance/ @example-org/team-platform"]          # one file for every domain, owned by the platform teamfor path, owners in ci.reviewers(shared, ["governance/metadata.toml"]).items():    print(f"one shared file, review of {path}:", " ".join(owners))crm = yaml.safe_load((main / "governance/contracts/crm/learners.odcs.yaml").read_text(encoding="utf-8"))print(yaml.safe_dump({"domain": crm["domain"], "team": crm["team"]}, sort_keys=False), end="")lines = (main / ".github/CODEOWNERS").read_text(encoding="utf-8").splitlines()for line in lines[1:]:                                       # the first line says the file is generated    print("CODEOWNERS", line)before, after = ci.build(main), ci.build(branch)          # the pull request changes the metadata onlyprint("teams that own tables:", len({table.owner for table in before.described.values()}))# drops the job's verdict, the last line, which this example doesn't printfor line in ci.lines(ci.run(before, after, checks=["contracts"]))[:-1]:    print("before generating again,", line)print("files generated again:", len(ci.generate(after)))print("after generating again, contracts:", "passed" if ci.run(before, after, checks=["contracts"]).passed else "failed")# the last matching CODEOWNERS line wins, as GitHub applies itfor path, owners in ci.reviewers(lines, ci.changed(main, branch)).items():    print(f"a folder per domain, review of {path}:", " ".join(owners))
輸出python domain-contracts.py
one shared file, review of governance/metadata.toml: @example-org/team-platform
domain: crm
team:
  name: team-crm
  members:
  - username: team-crm
    role: owner
CODEOWNERS /.github/CODEOWNERS @example-org/team-platform
CODEOWNERS /governance/ @example-org/team-platform
CODEOWNERS /migrations/ @example-org/team-platform
CODEOWNERS /pipelines/ @example-org/team-platform
CODEOWNERS /pipelines/course_performance.sql @example-org/team-analytics
CODEOWNERS /pipelines/learner_activity.sql @example-org/team-analytics
CODEOWNERS /governance/contracts/analytics/ @example-org/team-analytics
CODEOWNERS /governance/contracts/billing/ @example-org/team-billing
CODEOWNERS /governance/contracts/crm/ @example-org/team-crm
CODEOWNERS /governance/ci/domains/crm.rego @example-org/team-crm
CODEOWNERS /governance/contracts/learning/ @example-org/team-learning
CODEOWNERS /governance/contracts/support/ @example-org/team-support
teams that own tables: 5
before generating again, contracts: failed, findings 1, new 1, on main 0, waived 0, 11 files checked
before generating again, contracts/governance/contracts/crm/learners.odcs.yaml: differs from what the metadata generates: generate it again
files generated again: 11
after generating again, contracts: passed
a folder per domain, review of governance/contracts/crm/learners.odcs.yaml: @example-org/team-crm
a folder per domain, review of governance/metadata.toml: @example-org/team-platform

With one shared file, the downgrade changes governance/metadata.toml, and GitHub asks @example-org/team-platform to review it. That is the team that owns the file, not team-crm, whose column it is. The generated CODEOWNERS gives the platform team the file itself, because About code owners says a repository is fully protected against unauthorized changes only when the CODEOWNERS file itself has an owner (GitHub's documentation). The platform team also gets the governance files, the migrations and the pipelines. Each pipeline then goes to the team that owns its table, and each folder of contracts goes to its domain's team. The pull request changed only the metadata, so the contracts check, which generates every file again and compares, fails: differs from what the metadata generates: generate it again. Generated again, the pull request also changes the crm contract, and its review goes to @example-org/team-crm, because GitHub gives the last matching pattern precedence. A hook that generates the files saves the author a failed run. The check makes the routing certain.

When code-owner review is required, an approval from any one of a file's owners meets it (About code owners). Branch protection asks for one number of approvals for the whole branch, met by reviewers with write permissions (GitHub, protected branches), so any such reviewer counts toward it, and it can't ask for two of team-crm's members. The job can, from the approvals it's given. The owner rule counts them per team, against a number per team in ci.toml. With team-crm asking for two, the downgrade of city with one team-crm approval reports failed, and with two it reports passed. Iceberg 1.12.0's REST catalog spec offers another place for classifications, labels per table and field ID (REST catalog spec). Coverage and the contract rules could read a catalog server's labels, but changes to them would need the server's own review, since the spec doesn't require that labels be persisted or versioned.

Working rule: Keep each domain's metadata under a path of its own, as one ODCS contract per table with one domain and one owning team, generated from the metadata and checked by the job, with a CODEOWNERS line for that team. Give the platform team the CODEOWNERS file, the job's settings, its global rules, the waivers and the migrations. Require code-owner review, and count approvals per team in the job when one isn't enough.

此部分尚未翻譯,因此以英文呈現。

Layer domain rules on the global rules

最近一次變動於第 2026.11.31 版

Teams that own their domains' contracts still share one platform, and some rules have to hold in every domain. Dehghani's description of data mesh calls this federated computational governance, "a set of global rules - rules applied to all data products and their interfaces - to ensure a healthy and interoperable ecosystem". Those global rules sit beside the decisions each domain makes for itself, and the platform executes both (Dehghani, 2020). That's a framing, not a measurement, and it maps onto code. The platform team keeps one package of global rules, which the domains agree on, and in Dehghani's version the domain and platform product owners together decide them. Each domain has a package of its own, owned by its team, and one job runs them all.

The OPA project's tool for rules over files is Conftest, which tests structured configuration data with Rego (Conftest). lib.ci runs the same kind of rules in-process with regopy, as chapter 5 runs the access policy. governance/ci/global.rego holds the global rules: one owner, whatever the case of its role; one domain, which a missing, empty or blank value fails, since an empty string is a defined value in Rego and not alone would pass it; a classification from the four, since ODCS accepts any string; and a description for every column. governance/ci/domains/crm.rego holds team-crm's rule: nothing in crm is public, because everything in it describes a learner or an instructor. The contract-rules check runs the global package on every contract, and each domain's package on the contracts of that domain on the branch. A rule returns each violation as data, with the rule's name, a subject and a message. A violation's subject and the rule's name make the finding's ID. These files sit outside governance/policies/, the access policy's folder, so changing them never changes the policy revision that chapter 8 records with every decision.

The CRM team's change comes back, this time with metadata. work_email is classified public, on the argument that a work address is business information, and its description is empty. The second try adds a description and moves crm.learners to the analytics domain, which has no rules of its own:

global-and-domain-rules.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""The platform's global rules and the crm domain's own rule, run on the CRM team's two tries at work_email: classifiedpublic with no description, then described with crm.learners moved to the analytics domain, which has no rules of its own.The prose's point rests on the two contract-rules findings of the first try and on the owner-review finding after the move."""from lib import cimain = ci.checkout()branch = ci.checkout(main)(branch / "migrations" / "0001-add-work-email.sql").write_text("alter table crm.learners add column work_email varchar;\n")ci.edit(branch, "governance/metadata.toml", '15 = { name = "notes"',        '16 = { name = "work_email", classification = "public", description = "" }\n15 = { name = "notes"')for path in sorted((branch / "governance" / "ci").rglob("*.rego")):    print("rules:", path.relative_to(branch).as_posix())before = ci.build(main)report = ci.run(before, branch, checks=["coverage", "contract-rules"])for line in ci.lines(report):    print(line)# The second try: a description, and the table moved to a domain whose rules allow public columns.ci.edit(branch, "governance/metadata.toml", 'description = "" }', 'description = "The learner\'s work address." }')# the table's domain changes from crm to analytics, which has no rules of its ownci.edit(branch, "governance/metadata.toml", 'owner = "team-crm"\ndomain = "crm"\ndescription = "Every learner',        'owner = "team-crm"\ndomain = "analytics"\ndescription = "Every learner')report = ci.run(before, branch, checks=["coverage", "contract-rules", "owner-review"])for line in ci.lines(report):    print("moved to analytics,", line)
輸出python global-and-domain-rules.py
rules: governance/ci/domains/crm.rego
rules: governance/ci/global.rego
coverage: failed, findings 3, new 1, on main 2, waived 0, 12 tables checked
contract-rules: failed, findings 2, new 2, on main 0, waived 0, 10 contracts checked
coverage/ai.review_corpus: no metadata; on main, owner team-platform
coverage/crm.learners.work_email: classified public; its name suggests personal; needs team-crm's approval
coverage/marketing.audience: no metadata; on main, owner team-platform
contract-rules/crm.learners.work_email/described: no description (global rule described)
contract-rules/crm.learners.work_email/no-public: crm classifies no column public (domains.crm rule no-public)
change crm.learners, field 16: added as work_email string; named by 0 pipelines, reaches 0 columns
job: failed
moved to analytics, coverage: failed, findings 3, new 1, on main 2, waived 0, 12 tables checked
moved to analytics, contract-rules: passed, findings 0, new 0, on main 0, waived 0, 10 contracts checked
moved to analytics, owner-review: failed, findings 1, new 1, on main 0, waived 0, 77 columns checked
moved to analytics, coverage/ai.review_corpus: no metadata; on main, owner team-platform
moved to analytics, coverage/crm.learners.work_email: classified public; its name suggests personal; needs team-crm's approval
moved to analytics, coverage/marketing.audience: no metadata; on main, owner team-platform
moved to analytics, owner-review/crm.learners/domain: domain changed from crm to analytics; needs team-crm's approval
moved to analytics, change crm.learners, field 16: added as work_email string; named by 0 pipelines, reaches 0 columns
moved to analytics, job: failed

Coverage flags the classification now: classified public; its name suggests personal; needs team-crm's approval. A name is evidence, and a pull request has no values to read, so a classification below the name's suggestion is a finding only the owner on main can answer.

The contract rules ask more. The global package flags no description (global rule described), and the crm package flags crm classifies no column public (domains.crm rule no-public). team-crm decided the second rule without asking any other team, and the platform runs it for them on every pull request, including pull requests from team-crm.

On the second try, the analytics domain's rules apply, and the contract rules pass: passed, findings 0, new 0, on main 0, waived 0, 10 contracts checked. The move itself fails, on domain changed from crm to analytics; needs team-crm's approval, and so does the classification.

Working rule: Write the rules every domain must follow as one global package, kept by the platform team, and let each domain add a package of its own, owned by its team, that runs on that domain's contracts only. Return violations as data with a stable subject, never as a bare pass or fail. Let domain rules add to the global rules, never replace them, and treat a table's move to another domain as an ownership change, so no team escapes its domain's rules by changing one word.

統計每項檢查中被豁免的發現

最近一次變動於第 2026.11.27 版

目前為止的各項檢查都各有理由讓拉取請求失敗。閘門在人們不再相信它時,同樣會失效。Google 的 Tricorder 作者將有效誤報定義為使用者選擇不採取行動的任何回報,並把程式碼審查階段的這個比率維持在 10% 以下。他們實際採取行動的對象範圍更窄,也就是不實用率:某個分析器的「Not useful」點擊數,占其「Not useful」、「Please fix」與「Apply fix」點擊數的比例。達到 10% 以上時,分析器會進入觀察期;超過 25% 時,可能會立即停用(Sadowski et al., 2015)。這是單一公司的程式碼分析,門檻也是他們自行訂定,而我們所知並沒有資料治理方面的公開對應數據。這項衡量可以當作類比來沿用:針對每項檢查,統計無人處理的發現,不論是已豁免的,還是留在 main 上的。

在平台上,決定不處理新的發現,就是一項豁免。governance/waivers.toml 中的每項豁免會指明一個發現的 ID、對其負責的團隊、一項理由,以及豁免適用的最後一天。lib.ci 接受的豁免,期限最多為作業執行當日起 90 天。這個上限是記錄在 governance/ci.toml 中的經驗法則,使每項豁免都會回來重新做出決定。同一個檔案也列出不論日期為何,任何豁免都無法壓下的檢查:涵蓋率檢查(因為沒有負責人的資料表或沒有分類的欄位,應在拉取請求中修正),以及強制執行的測試。已經在 main 上的發現不需要豁免。過期的豁免不會壓下任何東西,報告會將它列出。平台團隊擁有豁免檔案,因此每項豁免也是一項經過審查的變更。

這項 CRM 變更需要兩項豁免。第一項涵蓋未分類的欄位。第二項涵蓋該欄位在分類為 personal 之後,尚未撰寫的說明。團隊起初要求第二項豁免持續到夏天,之後改為持續到 10 月 31 日:

waived-findings.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""Waivers on the CRM team's pull request: one for the unclassified work_email column, which coverage never allows;then, with the column classified but not yet described, one that asks for too long, and one that fits, on the book'stoday and a month later. The prose's point rests on the two refusals and on the expired waiver the report lists."""from datetime import datefrom lib import cifrom lib.platform import TODAYdef waive(branch, finding, expires, reason):    with open(branch / "governance" / "waivers.toml", "a", encoding="utf-8") as waivers:        # the date is written unquoted, so TOML reads it as a date, which the job compares with the day it runs        waivers.write(f'\n[[waivers]]\nfinding = "{finding}"\nowner = "team-crm"\nreason = "{reason}"\nexpires = {expires}\n')main = ci.checkout()before = ci.build(main)unclassified = ci.checkout(main)(unclassified / "migrations" / "0001-add-work-email.sql").write_text("alter table crm.learners add column work_email varchar;\n")waive(unclassified, "coverage/crm.learners.work_email", "2026-10-31", "Classified once the sign-up form is live.")for line in ci.lines(ci.run(before, unclassified, checks=["coverage"])):    print("unclassified,", line)undescribed = ci.checkout(main)          # the second try: classified, with its description still to come(undescribed / "migrations" / "0001-add-work-email.sql").write_text("alter table crm.learners add column work_email varchar;\n")ci.edit(undescribed, "governance/metadata.toml", '15 = { name = "notes"',        '16 = { name = "work_email", classification = "personal", description = "" }\n15 = { name = "notes"')waive(undescribed, "contract-rules/crm.learners.work_email/described", "2027-06-30", "Described once the form's copy is final.")after = ci.build(undescribed)for line in ci.lines(ci.run(before, after, checks=["coverage", "contract-rules"])):    print("undescribed, asked until 2027-06-30,", line)# the same waiver, shortened to the end of October, within the longest a waiver may runci.edit(undescribed, "governance/waivers.toml", "2027-06-30", "2026-10-31")for day in (TODAY, date(2026, 11, 1)):    # the book's today, then a month later, after the waiver has expired    report = ci.run(before, after, today=day, checks=["coverage", "contract-rules"])    print(f"undescribed, asked until 2026-10-31, on {day}, contract-rules:", "passed" if report.checks[1].passed else "failed")    print(f"undescribed, asked until 2026-10-31, on {day}, findings waived:", sum(len(c.waived) for c in report.checks))    print(f"undescribed, asked until 2026-10-31, on {day}, waivers that silence nothing:",          "; ".join(why for _, why in report.unused) or "none")
輸出python waived-findings.py
unclassified, coverage: failed, findings 3, new 1, on main 2, waived 0, 12 tables checked
unclassified, coverage/ai.review_corpus: no metadata; on main, owner team-platform
unclassified, coverage/crm.learners.work_email: not classified; its name suggests personal
unclassified, coverage/marketing.audience: no metadata; on main, owner team-platform
unclassified, change crm.learners, field 16: added as work_email string; named by 0 pipelines, reaches 0 columns
unclassified, waiver coverage/crm.learners.work_email: silences nothing, coverage findings are never waived
unclassified, job: failed
undescribed, asked until 2027-06-30, coverage: passed, findings 2, new 0, on main 2, waived 0, 12 tables checked
undescribed, asked until 2027-06-30, contract-rules: failed, findings 1, new 1, on main 0, waived 0, 10 contracts checked
undescribed, asked until 2027-06-30, coverage/ai.review_corpus: no metadata; on main, owner team-platform
undescribed, asked until 2027-06-30, coverage/marketing.audience: no metadata; on main, owner team-platform
undescribed, asked until 2027-06-30, contract-rules/crm.learners.work_email/described: no description (global rule described)
undescribed, asked until 2027-06-30, change crm.learners, field 16: added as work_email string; named by 0 pipelines, reaches 0 columns
undescribed, asked until 2027-06-30, waiver contract-rules/crm.learners.work_email/described: silences nothing, runs to 2027-06-30, past the longest allowed, 2026-12-30
undescribed, asked until 2027-06-30, job: failed
undescribed, asked until 2026-10-31, on 2026-10-01, contract-rules: passed
undescribed, asked until 2026-10-31, on 2026-10-01, findings waived: 1
undescribed, asked until 2026-10-31, on 2026-10-01, waivers that silence nothing: none
undescribed, asked until 2026-10-31, on 2026-11-01, contract-rules: failed
undescribed, asked until 2026-10-31, on 2026-11-01, findings waived: 0
undescribed, asked until 2026-10-31, on 2026-11-01, waivers that silence nothing: expired on 2026-10-31

未分類欄位的豁免遭到拒絕,儘管它只要求一個月:silences nothing, coverage findings are never waived。沒有任何豁免能讓該拉取請求通過。說明的豁免在期限延到夏天時遭到拒絕,silences nothing, runs to 2027-06-30, past the longest allowed, 2026-12-30。縮短到 10 月 31 日後,它就能壓下該發現。10 月 1 日,契約規則回報 passed。11 月 1 日,它們回報 failed。10 月 1 日,無法壓下任何東西的豁免清單是 none;11 月 1 日則是 expired on 2026-10-31:日期已過,問題並未消失。

實用原則: 讓一項豁免只指明拉取請求引入的一個發現,並附上負責團隊、理由,以及最多只在幾個月之後的結束日期;同時列出任何豁免都不得壓下的檢查,例如缺少分類或負責人。針對每項檢查,回報有多少發現無人處理,不論是已豁免的還是留在 main 上的,並審查其中大部分都屬於這種情況的檢查:不是檢查有問題,就是平台有問題,而這個數字無法說明是哪一個。

正式環境中會出什麼問題

最近一次變動於第 2026.11.27 版

依我們的判斷,治理作業被關閉的次數多於它出錯的次數:團隊會把執行緩慢或雜訊過多的檢查移除,一次改動 governance/ci.toml 中的一行,而關卡仍然持續通過,但它所把關的範圍卻越來越小。以下兩個分階段的檢查說明這種情況如何發生,其中以計數取代耗時;第三個例子則說明作業實際出錯的情形。

此部分尚未翻譯,因此以英文呈現。

A check that reads every row

最近一次變動於第 2026.11.27 版

The support team adds two columns to support.tickets: callback_number, classified internal, and reply_email, classified public. A team that wants values judged, not only names, then adds chapter 3's classification of the table to the job, by sample and by every row:

slow-check-every-row.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""The support team's pull request adds two columns to support.tickets, which coverage judges by their names and chapter3's value checks judge by reading a sample, or every row. The prose's point rests on the callback number's empty columnand on the values each check reads; counts of values stand in for time, which depends on the machine."""import pyarrow as pafrom lib import ci, piimain = ci.checkout()branch = ci.checkout(main)(branch / "migrations" / "0001-callback-and-reply.sql").write_text(    "alter table support.tickets add column callback_number varchar;\n"    "alter table support.tickets add column reply_email varchar;\n")ci.edit(branch, "governance/metadata.toml", '8 = { name = "status"',        '9 = { name = "callback_number", classification = "internal", description = "A number to call the learner back on." }\n'        '10 = { name = "reply_email", classification = "public", description = "Where the reply goes." }\n8 = { name = "status"')before, after = ci.build(main), ci.build(branch)report = ci.run(before, after, checks=["coverage", "classify-sampled", "classify-every-row"])for name in ("body", "callback_number", "reply_email"):    values = after.catalog.load_table("support.tickets").scan(selected_fields=(name,)).to_arrow()[name]    print(f"support.tickets.{name}, values on the branch:", f"{len(values) - values.null_count:,}")    for check in report.checks:        found = [f.message for f in check.findings if f.id == f"{check.name}/support.tickets.{name}"]        print(f"support.tickets.{name}, {check.name}:", found[0] if found else "no finding")for check in report.checks[1:]:    print(f"{check.name}, values read:", f"{check.checked:,}")text_columns, sampled, every_row = 0, 0, 0for name in sorted(before.described):    data = before.catalog.load_table(name).scan().to_arrow()    # the non-null values of each text column, the ones a value check classifies    filled = [len(column) - column.null_count for column in data.columns if pa.types.is_string(column.type)]    text_columns += len(filled)    # the sampled check reads at most pii.ROWS values of each column    sampled += sum(min(pii.ROWS, count) for count in filled)    every_row += sum(filled)print("text columns in the described tables:", text_columns)print("values the sampled check would read in them:", f"{sampled:,}")print("values the every-row check would read in them:", f"{every_row:,}")
輸出python slow-check-every-row.py
support.tickets.body, values on the branch: 2,000
support.tickets.body, coverage: no finding
support.tickets.body, classify-sampled: values support sensitive, reviewed as personal
support.tickets.body, classify-every-row: values support sensitive, reviewed as personal
support.tickets.callback_number, values on the branch: 0
support.tickets.callback_number, coverage: no finding
support.tickets.callback_number, classify-sampled: no finding
support.tickets.callback_number, classify-every-row: no finding
support.tickets.reply_email, values on the branch: 0
support.tickets.reply_email, coverage: classified public; its name suggests personal; needs team-support's approval
support.tickets.reply_email, classify-sampled: its name suggests personal, reviewed as public
support.tickets.reply_email, classify-every-row: its name suggests personal, reviewed as public
classify-sampled, values read: 1,000
classify-every-row, values read: 10,000
text columns in the described tables: 32
values the sampled check would read in them: 5,800
values the every-row check would read in them: 429,453

Coverage fails reply_email by its name, classified public; its name suggests personal; needs team-support's approval, and passes callback_number, no finding, because no name rule matches it. The branch holds 0 values in the new column, so reading values doesn't help yet either. The migration adds the column empty, and every row gives no finding. Chapter 3's scheduled sample catches the phone numbers once the column fills.

The sampled check reads 1,000 values and the every-row check reads 10,000. Both find support.tickets.body sensitive under a personal classification, which chapter 3 already sent to team-support. Across every text column in the described tables, a sample would read 5,800 values, and every row would read 429,453. The second number grows with the data, on every pull request, whatever the pull request changed. A job that keeps people waiting, we judge, gets skipped, and then removed.

Working rule: Size pull-request checks by the change, not by the data: metadata, schemas, policies and the names of the columns a pull request adds. Run checks that read values on a schedule, with a fixed sample, as chapter 3 does, and send their findings to the owning team. Document where the job's checks stop, such as at a column added empty.

標記每個 ID 的檢查

最近一次變動於第 2026.11.27 版

一個謹慎的團隊新增了一項檢查,把所有名稱看起來像 ID 的欄位都視為個人資料。但平台對於用來進行連接的 ID 已有不同的決定:第 2 章將 learner_id 分類為 internal,並保護用來解析它的資料表。這項檢查的發現是新的,因此各負責團隊都豁免了這些發現:

noisy-check-waivers.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""A noisy check added to the job: every column named like an ID is personal. The platform decided otherwise for IDsused for joining, so each owning team waives its findings, and the waiver count climbs. The prose's point rests on thenot-acted-on line of each check."""from collections import Counterfrom lib import cimain = ci.checkout()branch = ci.checkout(main)                          # the platform team adds the check to the job's settingsci.edit(branch, "governance/ci.toml", '"properties"]', '"properties", "id-columns"]')before, after = ci.build(main), ci.build(branch)report = ci.run(before, after)print("waivers in the file, before:", len(ci.waivers(after.governance)))noisy = next(check for check in report.checks if check.name == "id-columns")print("job, before the waivers:", "passed" if report.passed else "failed")print("id-columns, findings:", len(noisy.findings))print("id-columns, findings on main:", len(noisy.on_main))# the last word of each message is the classificationclassified = Counter(finding.message.rpartition(" ")[2] for finding in noisy.findings)for level, count in sorted(classified.items()):    print(f"id-columns, findings classified {level}:", count)# the part of the finding's ID after the check's name: the column's full nameprint("id-columns, the public one:", ", ".join(f.id.split("/")[1] for f in noisy.findings if f.message.endswith("public")))with open(after.governance / "waivers.toml", "a", encoding="utf-8") as waivers:    for finding in noisy.findings:        waivers.write(f'\n[[waivers]]\nfinding = "{finding.id}"\nowner = "{finding.owner}"\n'                      'reason = "An ID for joining, internal by decision."\nexpires = 2026-10-31\n')report = ci.run(before, after)print("waivers in the file, after:", len(ci.waivers(after.governance)))print("job, with the waivers:", "passed" if report.passed else "failed")for check in (check for check in report.checks if check.findings):    idle = [f for f in check.findings if f.waiver or f.on_main]          # findings nobody acted on    print(f"{check.name}, not acted on:", f"{len(idle)} of {len(check.findings)} findings, {len(idle) / len(check.findings):.0%}: "          f"{len(check.waived)} waived, {len(check.on_main)} on main")
輸出python noisy-check-waivers.py
waivers in the file, before: 0
job, before the waivers: failed
id-columns, findings: 21
id-columns, findings on main: 0
id-columns, findings classified internal: 20
id-columns, findings classified public: 1
id-columns, the public one: learning.courses.course_id
waivers in the file, after: 21
job, with the waivers: passed
coverage, not acted on: 2 of 2 findings, 100%: 0 waived, 2 on main
properties, not acted on: 4 of 4 findings, 100%: 0 waived, 4 on main
id-columns, not acted on: 21 of 21 findings, 100%: 21 waived, 0 on main

這項檢查找出 21 個欄位,每一個都是平台刻意分類過的 ID。其中 20 個是 internal,而 learning.courses.course_id 是 public。

豁免檔案中的豁免項目從 0 項增加到 21 項,而 ID 檢查顯示 21 of 21 findings, 100%: 21 waived, 0 on main。這已超過 Tricorder 的作者所採用的任何門檻,但此處僅作類比,因為他們計算的是點擊次數,而不是豁免項目。屬性檢查顯示相同的比例,即 4 of 4 findings, 100%: 0 waived, 4 on main,而這是合理的:它的發現是管線執行器需要的修正。數量無法區分這兩者,但原因可以。

實用原則: 新增檢查之前,先在主分支上執行它並閱讀每一項發現;如果大多數發現都會被豁免,就修改規則,而不是豁免這些發現。若某項檢查的發現長期大多被豁免,就移除它;若正確的檢查出現高比例,則將其視為需要排程的工作,並指定負責人與日期。

損毀的檔案會成為一項檢查發現

最近一次變動於第 2026.11.27 版

一位客服人員的項目被寫進 governance/users.toml,但少了一個引號。同一個 pull request 也把 crm.learners.country 從文字改為數值,並帶入 CRM 團隊尚未分類的 work_email:

broken-files-become-findings.py Python 3.12.15 · duckdb 2.0.0 · openlineage-python 1.55.0 · phonenumbers 9.0.43 · presidio-analyzer 2.2.366 · pyarrow 26.0.1 · pyiceberg 0.12.0 · pyyaml 6.0.3 · regopy 1.5.2 · sqlglot 30.33.0 · tldextract 5.4.0 通過
"""A pull request that breaks two files the job reads: a support agent added to the users file with a quote missing,and a migration Iceberg refuses. It also carries the CRM team's unclassified work_email column. The prose's point restson the two checks that could not run and on the exit code."""from lib import cimain = ci.checkout()branch = ci.checkout(main)# the closing quote after "support" is missing, so the users file no longer parsesci.edit(branch, "governance/users.toml", '[users.agent-a09]', '[users.agent-a12]\ngroups = ["support]\nregion = "emea"\n\n'        '[users.agent-a09]')(branch / "migrations" / "0001-add-work-email.sql").write_text("alter table crm.learners add column work_email varchar;\n")# a string column cannot become an int: that isn't one of Iceberg's type promotions, so the migration is refused(branch / "migrations" / "0002-country-as-number.sql").write_text("alter table crm.learners alter column country type int;\n")print("files the pull request changes:", ", ".join(ci.changed(main, branch)))report = ci.run(main, branch)for line in ci.lines(report):    print(line)print("checks that could not run:", ", ".join(check.name for check in report.checks if check.error))print("checks that ran:", sum(check.error is None for check in report.checks))print("exit code:", report.exit_code)
輸出python broken-files-become-findings.py
files the pull request changes: governance/users.toml, migrations/0001-add-work-email.sql, migrations/0002-country-as-number.sql
coverage: failed, findings 3, new 1, on main 2, waived 0, 12 tables checked
contract-rules: passed, findings 0, new 0, on main 0, waived 0, 10 contracts checked
contracts: passed, findings 0, new 0, on main 0, waived 0, 11 files checked
policy-tests: failed, the check could not run
enforcement-tests: failed, the check could not run
migrations: failed, findings 1, new 1, on main 0, waived 0, 2 migrations checked
pipelines: passed, findings 0, new 0, on main 0, waived 0, 4 pipelines checked
lineage-classifications: passed, findings 0, new 0, on main 0, waived 0, 23 columns checked
owner-review: passed, findings 0, new 0, on main 0, waived 0, 77 columns checked
removals: passed, findings 0, new 0, on main 0, waived 0, 87 columns checked
properties: passed, findings 4, new 0, on main 4, waived 0, 12 tables checked
coverage/ai.review_corpus: no metadata; on main, owner team-platform
coverage/crm.learners.work_email: not classified; its name suggests personal
coverage/marketing.audience: no metadata; on main, owner team-platform
policy-tests/error: the check could not run: governance/users.toml doesn't parse: Illegal character '\n' (at line 13, column 20)
enforcement-tests/error: the check could not run: governance/users.toml doesn't parse: Illegal character '\n' (at line 13, column 20)
migrations/0002-country-as-number.sql: refused: Cannot change column type: country: string -> int
properties/ai.review_corpus: 7 of 7 generated properties missing; on main, owner team-platform
properties/analytics.course_performance: 4 of 4 generated properties missing; on main, owner team-analytics
properties/analytics.learner_activity: 4 of 4 generated properties missing; on main, owner team-analytics
properties/marketing.audience: 7 of 7 generated properties missing; on main, owner team-platform
change crm.learners, field 16: added as work_email string; named by 0 pipelines, reaches 0 columns
job: failed
checks that could not run: policy-tests, enforcement-tests
checks that ran: 9
exit code: 1

這個使用者檔案讓讀取它的兩項檢查失敗:the check could not run: governance/users.toml doesn't parse: Illegal character '\n' (at line 13, column 20)。Iceberg 拒絕這項型別變更,因為它不屬於型別提升(promotion),結果為 refused: Cannot change column type: country: string -> int。這兩項無法執行的檢查不會阻止其他檢查,遷移檢查也包含在內,因此作者同時還會看到 not classified; its name suggests personal,而該工作會以結束碼 1 結束。若沒有這層攔截,工作會在第一個錯誤就停止,作者每執行一次只能修正一個問題。

實用原則: 把當機的檢查轉成一項會使工作失敗的檢查發現,附上錯誤的第一行與它所指出的檔案,仍然執行其他檢查,並且絕不讓豁免(waiver)將它壓下。

其他失效情形

最近一次變動於第 2026.11.27 版
  • 無人要求的關卡。 若某個工作的狀態檢查並未被分支保護列為必要項目,它雖會回報檢查結果,拉取請求仍會合併。應將它設為必要項目,並統計工作失敗但仍已合併的拉取請求。
  • 建置失敗會隱藏檢查結果。 損壞的管線若未寫出某個資料表,該資料表就會在沒有描述的情況下無從發現。請先讀取 pipelines 檢查。
  • 豁免比其原因更長命。 某項檢查結果已修正,其豁免卻仍留著,隨時可能掩蓋下一個 ID 相同的檢查結果。報告會列出不符合任何檢查結果的豁免,請將它們刪除。
  • 重新命名會改變檢查結果 ID。 ID 以欄位命名,因此被重新命名的欄位,其檢查結果會以新 ID 重新出現,而報告會將它們原有的豁免列為不符合任何檢查結果。請在該次重新命名的拉取請求中一併移動這些豁免。
  • 核准的效力超出其所核准的內容。 team-crm 核准了 city 的降級,隨後作者又推送 email 的降級,這項核准便同時涵蓋兩者。請讓分支保護啟用「當推送的提交影響拉取請求的差異時,撤銷過時的拉取請求核准」。
  • 一項核准代表整個團隊。 任何一位程式碼負責人的核准,就滿足 GitHub 的要求,而分支保護的計數是以分支為單位。若某個領域需要更多核准,請在工作中按團隊計算核准數。
  • 受阻的團隊修改關卡。 拉取請求失敗的團隊,會從 ci.toml 移除該檢查、新增豁免,或修改 CODEOWNERS。請將這三者的程式碼負責人都指定為平台團隊。
  • 拉取請求之外的變更。 有人在筆記本中建立資料表,或以手動方式執行遷移。也請讓該工作依排程對正式環境執行,如同第 2 章執行 problems 的做法。

本章的決定

最近一次變動於第 2026.11.27 版
  • **一個作業會在每個 pull request 上執行第 2 章到第 7 章的檢查,**即 lib.ci.run,檢查項目列於 governance/ci.toml;只有第 3 章的值抽樣改為依排程執行。lib.ci.main 會回傳結束碼,並以 Markdown 寫出報告。
  • 作業判斷的是 pull request 所改動的內容。 它新引入的發現會使作業失敗,除非已獲核准或豁免;main 上既有的發現則連同其負責人一併回報,不會使任何檢查失敗。檢查本身當機,算作一項失敗的發現。
  • **每項發現都有穩定的 ID,**由檢查與其對象組成,例如 coverage/crm.learners.work_email。
  • **pull request 會與 main 分支比較,在暫存平台上進行,**這些平台依平台實際運作的方式建置,各自擁有自己的遷移與管線。
  • **結構描述的變更依欄位 ID 做差異比對,**並從三個面向回報:Iceberg 讀取端、SQL 中指名該欄位的管線,以及血緣所指出會影響到的每一個欄位,包含 INDIRECT 邊。
  • **我們自訂的兩條規則:**調降分類、變更負責人,或將資料表移到另一個領域,需要 main 分支上該資料表負責人的核准,並按團隊計算;而欄位必須在 main 分支已將其標記為 deprecated 之後,才可移除。
  • **所有權是每張資料表一份 ODCS 合約,**包含一個領域,以及擔任角色 owner 的負責團隊;合約會產生到每個領域一個資料夾中,並附上一行 CODEOWNERS,由作業加以檢查。平台團隊擁有 CODEOWNERS、作業的設定、其全域規則、豁免與遷移。
  • **全域規則與領域規則皆為 Rego,**以 regopy 在行程內對每份合約執行,並位於存取政策的資料夾之外。
  • 刻意留下的缺口仍留在 main 上:marketing.audience 與 ai.review_corpus 會以涵蓋率發現的形式出現在每份報告中,並以平台團隊為其負責人,直到它們被描述為止。
  • **雜訊以無人處理的發現來衡量,按檢查分別計算:被豁免,或留在 main 上。**若一項檢查的發現大多被忽略,不是檢查有誤,就是平台有誤,單看數量無法分辨是哪一種。一項豁免只指名一項發現、一位負責人、一個理由,以及最多在 90 天之後的結束日期;涵蓋率與強制執行測試永遠不得豁免。
  • **pull request 的檢查依變更的規模調整;**讀取值的檢查依排程執行。這些檢查只有在人們持續開啟時才有用,因此每一項都依變更的規模來調整。

本章,於本版次中

版次 2026.11.31範例於 2026年11 月 19 通過測試本章 10 個範例 個範例中有 10 個通過

譯自英文書,版次 2026.11.31。

引用本節

格式

各種格式皆引用英文原書,本譯本即依循該原書。

每種格式都會標示本版。其連結會開啟目前版次,節標題會說明該節內文最後一次變動的時間。存取日期與擷取日期即為你開啟此頁的當日。

本頁內容

第 10 章,共 10 章: CI 中的資料治理

  1. 將所有檢查作為單一作業執行
  2. 把關在拉取請求,而非提交
  3. 回報結構描述變更的影響範圍
  4. 降低分類等級前先詢問擁有者
  5. Deprecate a column before removing it
  6. Route each domain's reviews by path
  7. Layer domain rules on the global rules
  8. 統計每項檢查中被豁免的發現
  9. 正式環境中會出什麼問題
  10. A check that reads every row
  11. 標記每個 ID 的檢查
  12. 損毀的檔案會成為一項檢查發現
  13. 其他失效情形
  14. 本章的決定

返回頂端所有章節