KB-6BE3

01 — Law, Design & Claim Recovery

5 min read Revision 1
auditlawsbirth-registry-lawdieu33dieu35reconciliation2026-06-03

01 — Law, Design & Claim Recovery

A. What the laws REQUIRE

Đ0-G — Birth Registry Law (LUẬT KHAI SINH) v1.0

  • "Mọi entity sinh ra PHẢI có birth record" — every entity born MUST have a birth record.
  • "Hạ tầng phải sẵn sàng đếm được MỌI THỨ SẼ SINH RA" — infra must be ready to count everything that will be born.
  • Mechanism: AFTER INSERT trigger fn_birth_registry_auto() on every governed collection; reads NEW.code, resolves species/composition/governance_role, INSERT ... ON CONFLICT DO NOTHING.
  • Labels for missing birth: orphan (entity in governed collection, no birth row) and phantom (birth row, source entity deleted).
  • Process law (birth-process-v1): QT-001 backfill (dot-birth-backfill) for existing rows; QT-002 birth-first for new entities. "Không khai → không sinh. Không khai → không đếm được." "Entity mới KHÔNG THỂ tồn tại nếu chưa có birth record."

Đ33 — PostgreSQL Law v2.1

  • "PG = NƠI ENFORCE TẤT CẢ LUẬT." PG enforces all law; app only reads enforced results.
  • 5 scanners (§11.6): DOT-ORPHAN-SCANNER (mồ côi, Daily 2AM), DOT-SCHEMA-SCANNER (Weekly Sun 1:30AM), DOT-LIFECYCLE-SCANNER, DOT-AUTOMATION-SCANNER, DOT-MISCLASS-SCANNER (Weekly Sun 3:30AM).
  • Missing-birth = Loại-2 (auto-fix): "Thiếu birth → tạo birth." Detection is scheduled (cron), not immediate.

Đ35 — DOT Governance Law v5.2

  • A lawful DOT requires the 8-step flow (§5): (1) APR new_dot → (2) approve → (3) create .ts/file → (4) register dot_tools 11/11 fields → (5) declare target_collections → (6) birth (Đ0-G auto-trigger) → (7) dot-dot-health → (8) PASS → active.
  • "TUYỆT ĐỐI CẤM POST partial/placeholder"; "KHÔNG có cửa bypass."
  • A file-only DOT that is unregistered in dot_tools is NOT yet a lawful DOT (only step 3 done).

GPT decision (2026-06-03)

  • "every new object must be automatically born or immediately detectable as an orphan/unborn object; if already born, governance onboarding/backfill must automatically detect whether it is governance-covered or a governance orphan."
  • Decisive test: "can any object appear in the system without birth, without orphan label, and without governance onboarding? If yes, identify the exact hole … before continuing DOT registration/cleanup."

B. What previous reports CLAIMED complete

  • S157-A (2026-03-21, "COMPLETE", PR #558): birth_registry created (CAT-023); dot_tools backfilled 112/112 certified; auto-insert trigger test PASS. But admits trigger coverage = "PASS (partial)" — only dot_tools; entity_labels trigger dropped (junction table, no code).
  • Pack-21 (2026-05-05): birth-trigger coverage expanded to 162 instances; status column added. Law warns these counts are dynamic — re-query.
  • Governance design docs 31/32/34 (2026-06-01): all explicitly "DESIGN ONLY / APPLY NO-GO / BUILD NO-GO". Birth→governance handoff = a cursor-tail worker (not a trigger), not running; candidate-state store at that time "table ABSENT (SB-10)".

C. Live vs Design — reconciliation (verified this audit)

Capability Law/Design says Actually LIVE (2026-06-03)?
Auto-birth row on governed collection required (Đ0-G) LIVE & broad — 216 birth/orphan trigger rows, fn_birth_registry_auto on ~100+ tables, synthetic-code fallback; 1,116,379 birth rows / 79 collections.
Birth-first enforcement (block if no license) required (QT-002) Advisory onlyfn_birth_gate defaults to warning, has kill-switch GUC, skips null-code.
Orphan = missing-birth detection required (Đ0-G/Đ33) NOT live as defined — live fn_refresh_orphan_* compute metadata-completeness, not missing-birth.
Scheduled ORPHAN/SCHEMA/MISCLASS scanners required (Đ33 §11.6) Registered but unscheduled — cron NULL; no pg_cron; last related scan 2026-05-25.
Birth→governance handoff worker designed (doc 32) Not running (cursor=0, event_pending=0).
Candidate scan / candidate_state designed (doc 34) Tables now EXIST (built post-design) but empty/unfed (0 rows).
Backfill sweep (existing → onboarding) designed (doc 31) Not run (ownership=0).
Governance ownership coverage gated (ospa≥1) INERT — ospa=0, ownership=0; collection-granularity inventory (35).

Net: birth creation is far more live than the 2026-06-01 design docs imply; birth enforcement, orphan detection, and governance onboarding are not. Detail in docs 02–04.

Back to Knowledge Hub knowledge/dev/reports/architecture/birth-governance-orphan-detection-systemic-automation-audit-2026-06-03/01-law-design-and-claim-recovery.md