KB-4226

Pack 21 — Birth Runtime Truth Doc Fix Report

7 min read Revision 1
birth-pipelinedoc-fixpack-21reportno-hardcoderuntime-truth

Pack 21 — Birth Runtime Truth Doc Fix Report

Date: 2026-05-05 | Status: DONE Scope: Doc patches only. Không runtime/PG/DOT mutation. Nguyên tắc: query-path language. Không hardcode numbers as timeless truth.


§1. Patches applied

Doc Patched? Query-path compliant? Changes summary
knowledge/dev/architecture/birth-registry-law.md yes yes Thêm 2 runtime-truth note blocks: (a) sau §2.1 schema — query information_schema.columns để lấy schema thực + snapshot 2026-05-05 ghi rõ status column added post-v1.0; (b) sau §2.2 trigger — query pg_trigger group by pattern + snapshot 162 (31 dot119_v2 + 131 legacy) + re-query instruction; thêm fn_birth_first planned-verify SQL. Phase B/C tools (dot-inspect-stamp, dot-inspect-gate, dot-certify-scan, dot-birth-orphan-scan) trong §VI table được append (Planned — verify: ls /opt/incomex/dot/bin/...). Giữ nguyên DDL design + mọi mô tả mechanism đúng.
knowledge/dev/architecture/birth-procedures.md yes yes Thêm 2 runtime-truth note blocks: (a) QT-001 — verify dot-birth-backfill binary + cron via ls/crontab, snapshot 2026-05-05 binary present, manual only, no cron; (b) QT-002 — query pg_trigger cho birth triggers + schema-tolerant query trên dot_tools (verify columns trước, adjust nếu schema khác), snapshot 2026-05-05 no QT-002 wrapper binary, enforcement = fn_birth_registry_auto AFTER + fn_birth_gate BEFORE. Thay 2 chỗ "138 collections" hardcode bằng "dynamic — query collection_registry". Giữ nguyên process steps.
S145 report (knowledge/current-state/reports/s145-m2-dot119-birth-triggers-report) yes yes Append-only. Marker Historical context note (Pack 21 không tồn tại trước → append. Note ghi rõ point-in-time snapshot, query path hiện tại bằng pg_trigger group by pattern, snapshot P2B-INV 2026-05-05 162 total. Không sửa nội dung gốc.
registries/meta_catalog/CAT-023 skip n/a Doc tồn tại nhưng không có fields-list section để thêm status field entry. Doc-level Status: active đã có trong header + metadata. Không có cấu trúc field schema để minimal-patch. SKIP per execution prompt §2 E4 anti-over-patch principle.
knowledge/dev/laws/law-04-birth-process.md (Đ4) skip n/a Đã đọc full doc. Không phát hiện hardcode trigger count, schema column count, hoặc "QT-002 tool" wording. §2.1 + §2.1.1 định nghĩa policy + trigger functions, không phát biểu number-as-truth. Đ4 là enacted law — không over-patch.

§2. Per-doc check (anti-hardcode)

birth-registry-law.md

  • Số con dynamic (trigger coverage, schema column count) đều có query + snapshot date
  • Có query source-of-truth cho mỗi dynamic fact
  • Có "re-verify" instruction
  • Không rewrite mô tả thiết kế (DDL gốc giữ nguyên)
  • Không xóa mô tả đúng (chỉ append)

birth-procedures.md

  • Hardcode "138 collections" thay bằng "dynamic — query collection_registry"
  • QT-001 + QT-002 đều có verify command + snapshot
  • Snapshot có ngày + observed value
  • Process steps giữ nguyên

S145 report

  • Idempotent check passed (marker "Historical context note (Pack 21" không có trước)
  • Append-only, nội dung gốc nguyên vẹn
  • Note có query + ngày + observed value

§3. Anti-hardcode self-check (cuối)

  • Naked dynamic runtime constants introduced: NO
  • Each dynamic count has query/path: YES
  • Each snapshot has date/evidence: YES (mọi snapshot đều ghi "P2B-INV (2026-05-05)" + observed value)

§4. TDs logged (KB only, không runtime)

TD Nội dung Status
TD-A birth-registry-law §VI: Phase A tools (dot-birth-trigger-setup, dot-inspect-pen) verify-state pending — chưa append planned-verify vì là Phase A "active" open (KB)
TD-B birth-procedures: "138 collections" được rephrase, nhưng các con số khác trong sub-flows chưa scan toàn diện — cần inv pass riêng open (KB)
TD-C CAT-023: thiếu structured fields-list section để thêm status field entry → không patch được trong scope Pack 21 open (KB)
TD-D Đ4 law-04: enforcement detail trong §2.1 không có hardcode trigger count, nhưng tham chiếu "fn_birth_gate (16 BEFORE INSERT)" trong design Pack 21 §1.2 không có trong Đ4 → no-op closed
TD-E fn_birth_first() chỉ được mark "Planned — verify". Nếu function tồn tại / không tồn tại trong PG → cần followup runtime check (out of scope Pack 21) open (KB)
TD-F Phase A tool readiness check (dot-birth-trigger-setup actual vs DOT-119 binary) cần một inv pass — không nằm trong scope doc-fix open (KB)
TD-G Idempotency marker conventions: dùng "Historical context note (Pack X, YYYY-MM-DD)" làm convention cho future report-append patches open (convention)
TD-H (giữ từ design rev3) Tạo v_birth_pipeline_runtime_stats view/function tập trung dynamic birth facts → runtime mutation, pack riêng open (runtime — out of Pack 21)

§5. Hard boundaries respected

  • ❌ Không PG/runtime mutation — confirmed
  • ❌ Không DOT script patch — confirmed
  • ❌ Không system_issues mutation — confirmed
  • ❌ Không rewrite historical content (S145 report append-only) — confirmed
  • ❌ Không over-patch enacted laws (Đ4 SKIP) — confirmed
  • ❌ Không hardcode numbers as timeless truth — confirmed
  • ❌ Không tự tạo doc path mới (không có target missing — CAT-023 + Đ4 tồn tại) — confirmed

§6. Verdict

PASS — 3 docs patched (birth-registry-law, birth-procedures, S145 report), 2 docs SKIPPED with documented rationale (CAT-023 no field structure, Đ4 not stale). Tất cả patches dùng query-path language + snapshot date + re-verify instruction. Không có hardcoded runtime constant nào được introduced.


§7. Next

  • Pack 22 — dot-iu-create wrapper design (per execution prompt §4)
  • TD-E + TD-F runtime checks (out of Pack 21 scope)
  • TD-H v_birth_pipeline_runtime_stats view design (separate runtime pack)

Pack 21 Doc Fix Report | 2026-05-05 | Query-path language. No hardcode numbers. HARD STOP after report.