HomeTrang chủ Standards & DoDStandards & DoD
One tree of rules · one gate that reads themMột cây luật · một gate đọc chúng

Standards & DoDStandards & DoD

.std.yaml · rule-coverage · test-policy

"Standards" are the coding rules a review checks against — naming, security, test discipline, language-specific traps. In v3 they all live in one place: the standards operational tree, as plain-YAML .std.yaml files. A "Definition of Done" (DoD) is the checklist a change must satisfy before it can ship. The gate reads both — so a rule is not a suggestion, it is something a real check can block on."Standards" là các luật code mà review đối chiếu — đặt tên, bảo mật, kỷ luật test, bẫy theo ngôn ngữ. Trong v3 tất cả ở một nơi: cây standards vận hành, dạng YAML thuần .std.yaml. "Definition of Done" (DoD) là danh sách một thay đổi phải thoả trước khi ship. Gate đọc cả hai — nên một luật không phải gợi ý, nó là thứ một check thật có thể chặn.

🧭
What changed in v3. There used to be two systems — a flat review-rules folder and the standards tree. They were merged: the flat subsystem is gone, and every rule now lives in the standards operational tree (*.std.yaml). One source, one loader, one gate.Đổi gì ở v3. Trước có hai hệ — một thư mục review-rules phẳng và cây standards. Chúng được gộp: hệ phẳng biến mất, mọi luật giờ nằm trong cây standards vận hành (*.std.yaml). Một nguồn, một loader, một gate.

Shipped rules, and your overridesLuật ship sẵn, và override của bạn

Layer A — shipped standardsLớp A — standards ship sẵn

The harness ships review areas (STD-REVIEW-COMMON / PY / GO / JAVA / TS …) as .std.yaml. render_standards.py turns the tree into the code-standards.md digest and a --check mode fails CI if the digest drifts from the source.Harness ship các vùng review (STD-REVIEW-COMMON / PY / GO / JAVA / TS …) dạng .std.yaml. render_standards.py biến cây thành bản tóm code-standards.md và chế độ --check fail CI nếu bản tóm lệch nguồn.

Layer B — your repo overridesLớp B — override của repo bạn

A repo tunes rules in its own folder (docs/standards/*.std.yaml) without touching the shipped tree — author one with hs:rule-author. Same-area edits merge, with your override winning. A floor rule is marked inviolable: an override can never lower it, and the gate refuses an attempt to shadow it.Một repo chỉnh luật trong thư mục riêng (docs/standards/*.std.yaml) mà không đụng cây ship — tạo bằng hs:rule-author. Sửa cùng-vùng được gộp, override của bạn thắng. Luật floor được đánh dấu bất khả xâm phạm: override không bao giờ hạ được, và gate từ chối mọi mưu toan che nó.

The rule-coverage gateGate phủ-luật

When code-review runs, rule_view.py matches the changed files against every applicable operational rule and emits a rule-scan artifact recording which rules were in scope. The gate then refuses a scan that omits an applicable rule — you cannot quietly skip one. A skip needs an explicit, capability-gated rule-coverage-skip artifact, and floor rules can never be skipped. The ramp is off → soft → hard (default soft).Khi code-review chạy, rule_view.py khớp file đã đổi với mọi luật vận hành áp dụng và phát một artifact rule-scan ghi luật nào trong phạm vi. Gate sau đó từ chối một scan bỏ sót một luật áp dụng — bạn không thể lặng lẽ bỏ qua. Một skip cần artifact rule-coverage-skip tường minh, có capability-gate, và luật floor không bao giờ skip được. Nấc là off → soft → hard (mặc định soft).

Definition of Done — proof, not a checkboxDefinition of Done — bằng chứng, không phải tick

The stage gate does not trust a self-declared "tests pass". It derives the change class from the files actually touched (the commit label is never trusted), then re-reads the raw result files — JUnit, Cobertura, SARIF — that verification.json points at. A hard change class missing a required test type, or with a failing or under-covered result, is blocked. A change touching a sensitive component path (auth, payment) additionally requires a clean security SARIF.Stage gate không tin "test pass" tự khai. Nó suy lớp thay đổi từ file thực sự đụng (nhãn commit không bao giờ được tin), rồi đọc lại các file kết quả thô — JUnit, Cobertura, SARIF — mà verification.json trỏ tới. Một lớp thay đổi cứng thiếu loại test bắt buộc, hoặc kết quả fail/thiếu coverage, bị chặn. Thay đổi đụng đường component nhạy cảm (auth, payment) còn cần một SARIF bảo mật sạch.

Policy lives in harness/data/test-policy.yaml (shipped tier-1) plus an optional repo test-policy.yaml (tier-2, add-only, strengthen-wins). If the evaluator itself crashes, it now blocks loudly rather than silently letting the change through.Chính sách nằm ở harness/data/test-policy.yaml (tier-1 ship sẵn) cộng test-policy.yaml repo tuỳ chọn (tier-2, chỉ thêm, siết-thắng). Nếu chính bộ đánh giá crash, giờ nó chặn lớn tiếng thay vì lặng lẽ cho qua.

FAQHỏi đáp

Can I just disable a rule that does not fit my repo?Tôi tắt một luật không hợp repo được không?
Yes for normal rules — author a layer-B override in docs/standards/ with hs:rule-author, which records a mandatory reason. No for floor rules: those are marked inviolable and the gate refuses an override that would lower or shadow one.Được với luật thường — tạo override lớp-B trong docs/standards/ bằng hs:rule-author, nó ghi lý do bắt buộc. Không với luật floor: chúng bất khả xâm phạm và gate từ chối override hạ hoặc che chúng.
What if I do not have JUnit/SARIF files?Nếu tôi không có file JUnit/SARIF?
The DoD gate only enforces what the policy declares for your change class; absent a tier-2 policy the stage floors ship off and nothing new blocks. Adopt it deliberately — and a grace window (which must carry an expires date) lets you ramp in.DoD gate chỉ ép cái chính sách khai cho lớp thay đổi của bạn; không có chính sách tier-2 thì các floor stage ship tắt và không gì mới chặn. Hãy áp dụng có chủ đích — và một cửa sổ grace (phải kèm ngày expires) cho bạn vào dần.