P2B-INV — Birth Pipeline Inventory Report
P2B-INV — Birth Pipeline Inventory Report
Date: 2026-05-05 | Status: COMPLETE — read-only Executed by: Claude Opus 4.7 agent Controlling prompt:
knowledge/dev/laws/dieu44-trien-khai/prompts/p2b-inv-birth-pipeline-inventory-prompt.mdrev2 Connection:docker exec -i postgres psql -U directus -d directus(VPS 38.242.240.89) Scope: hiện trạng — không thiết kế mới, không mutation.
§0. Executive answer (8 câu hỏi)
| # | Câu hỏi | Trả lời ngắn | Runtime-active? |
|---|---|---|---|
| 1 | Kênh chính khai sinh | PG safety-belt trigger fn_birth_registry_auto trên 157 trigger instances trên ~160 collections (KHÔNG phải QT-002 — QT-002 chỉ là chính sách văn bản, chưa có tool wrapper) |
✅ YES |
| 2 | Động cơ phụ/backfill | /opt/incomex/dot/bin/dot-birth-backfill v1.0.0 (DOT-118) — backfill birth_registry cho governed entities đã tồn tại, set certified=true |
✅ YES (tool); ❌ KHÔNG có cron — chạy thủ công |
| 3 | Warning khi động cơ phụ chạy | KHÔNG có warning chuyên biệt. Tín hiệu gián tiếp: fn_registry_health() so noi_chua (entity count) vs noi_sinh (birth count) → status ORPHAN (gap>0) hoặc PHANTOM (gap<0) |
⚠️ partial |
| 4 | Orphan detector | (a) fn_registry_health() PG function (status=ORPHAN); (b) dot-orphan-scanner cron 02:30; (c) dot-orphan-scan (DOT-095) full system scan; (d) dot-sync-orphan-scan (DOT-317) cron 05:00 AD↔Directus |
✅ YES (4 mechanisms) |
| 5 | Ghost detector | fn_registry_health() status=PHANTOM (birth > entity). Hiện 13 collections PHANTOM (vd dot_tools −283, universal_edges −362, system_issues −129) |
✅ YES |
| 6 | Tool/function/trigger phụ trách từng vai trò | Bảng đầy đủ ở §6 | — |
| 7 | Hardcode còn lại | Đã tìm thấy ở (a) dot-pg-triggers-ensure (16 atom collections list); (b) dot-schema-birth-registry-ensure (CAT-023 metadata); (c) dot-orphan-scanner (governance scope hardcoded). DOT-119 v2 đã loại bỏ hardcode collection list. |
— |
| 8 | Runtime-active vs design only | §8 | — |
Cốt lõi: Pipeline khai sinh thực tế hiện chạy chủ yếu bằng PG triggers (162 triggers tổng cộng — 31 trg_birth_* + 131 birth_trigger_*), không phải QT-002 wrapper tool. QT-002 vẫn là policy. fn_registry_health() đã runtime-active làm orphan + ghost detector duy nhất theo cơ chế "đếm 2 nơi". Cron-driven detectors khác (dot-orphan-scanner, dot-orphan-scan, dot-sync-orphan-scan) hoạt động ở tầng registry/sync — không trực tiếp đối chiếu birth_registry.
§1. Inventory — DOT tools birth-related (disk + dot_tools registry)
§1.1 Disk binaries (active, không tính .bak-*)
| Tool (filename) | Bytes | Date | Vai trò gọn |
|---|---|---|---|
dot-birth-backfill |
6738 | 2026-04-04 | QT-001 backfill — DOT-118 |
dot-birth-trigger-setup |
14417 | 2026-05-05 | DOT-119 v2 metadata-driven trigger installer |
dot-schema-birth-registry-ensure |
19557 | 2026-04-04 | DOT-133 birth_registry collection setup (Đ0-G) |
dot-pg-triggers-ensure |
9746 | 2026-04-04 | sequences/functions/triggers cho 16 atom collections |
dot-orphan-scan |
16871 | 2026-04-02 | DOT-095 full-system coverage scanner (Đ19 Side B) |
dot-orphan-scanner |
7098 | 2026-04-20 | DOT-115 governance orphan scanner (cron 02:30) |
dot-sync-orphan-scan |
3181 | 2026-04-07 | DOT-317 AD↔Directus sync orphan (cron 05:00) |
dot-trigger-guard |
3392 | 2026-04-05 | DOT-316 v2 trigger-guard self-check (mỗi run report exceptions) |
dot-inspect-pen |
6141 | 2026-04-04 | Phase A inspector — fills birth_registry.inspect_pen |
dot-schema-trigger-registry-ensure |
8633 | 2026-04-04 | trigger_registry collection setup |
dot-schema-dot-origin-ensure |
13664 | 2026-04-04 | _dot_origin column + orphan counting refresh |
dot-pg-views-ensure |
23523 | 2026-04-04 | v_registry_counts, v_registry_summary |
§1.2 dot_tools registry (16 hits)
DOT-095 dot-orphan-scan (active)
DOT-115 dot-orphan-scanner (active)
DOT-118 dot-birth-backfill (active)
DOT-119 dot-birth-trigger-setup (active)
DOT-133 dot-schema-birth-registry-ensure (active)
DOT-317 dot-sync-orphan-scan cron 0 5 * * * paired DOT_KB_PROTECT
DOT_BIRTH_BACKFILL dot-birth-backfill paired DOT-HEALTH-DOT
DOT_BIRTH_TRIGGER_SETUP dot-birth-trigger-setup paired DOT-HEALTH-DOT
DOT_KG_ORPHAN dot-kg-orphan cron 0 */6 * * * paired DOT_KG_CORRECT
DOT_SCHEMA_BIRTH_REGISTRY_ENSURE dot-schema-birth-registry-ensure paired DOT-HEALTH-DOT
DOT_SCHEMA_REGISTRY_CHANGELOG_ENSURE … paired DOT-HEALTH-DOT
DOT_SCHEMA_REGISTRY_COLLECTIONS_ENSURE … paired DOT-HEALTH-DOT
DOT_SCHEMA_TABLE_REGISTRY_ENSURE … paired DOT-HEALTH-DOT
DOT_SCHEMA_TRIGGER_REGISTRY_ENSURE … paired DOT-HEALTH-DOT
DOT-TAC-BIRTH-GATE TAC Birth Gate event/gate paired DOT-TAC-BIRTH-VERIFY
DOT-TAC-BIRTH-VERIFY TAC Birth Verify cron 0 6 * * *
Lệch disk vs registry:
dot-kg-orphanxuất hiện trongdot_toolsnhưng KHÔNG có trong/opt/incomex/dot/bin/listing → GHOST registry entry hoặc tool ở chỗ khác.- Các DOT codes dạng UPPER_SNAKE (
DOT_BIRTH_BACKFILL…) trùng filename với DOT-NNN canonical → 2 record/1 file = duplicate registration (cần đánh giá riêng, ngoài scope read-only này).
§2. PG triggers — birth/gate/guard (runtime ground truth)
§2.1 Aggregate counts
trg_birth_* pattern : 31
birth_trigger_* pattern : 131
TOTAL birth installer triggers : 162
By function used:
fn_birth_registry_auto : 157
fn_birth_registry_auto_id : 3 (law_jurisdiction, governance_relations, law_dot_enforcement)
fn_birth_gate : 16 (BEFORE INSERT gate trên các governed tables)
fn_description_birth_guard : 21 (BEFORE INSERT/UPDATE OF description)
Lưu ý quan trọng: 31 trigger ghi trong các report trước (DOT-119 báo cáo, IU pilot báo cáo) là số lượng pattern
trg_birth_*mới (do DOT-119 v2 sinh). 131 trigger còn lại dùng pattern cũbirth_trigger_*— vẫn active, vẫn gọifn_birth_registry_auto. Hai pattern song song, không xung đột (mỗi collection chỉ có 1 trong 2).
§2.2 31 triggers trg_birth_* (DOT-119 v2 generated)
agents, checkpoint_sets, checkpoint_types, collection_registry, dot_tools,
entity_dependencies, meta_catalog, modules, system_issues, table_registry,
tasks, ui_pages, workflow_change_requests, workflow_steps, workflows,
taxonomy_facets, taxonomy, entity_species, law_catalog, measurement_registry,
pivot_definitions, approval_requests, pivot_results, normative_registry,
governance_registry, information_unit
+ 4 dùng fn_birth_registry_auto_id: law_jurisdiction, governance_relations, law_dot_enforcement
+ 1 dùng fn_birth_auto_certify (ON birth_registry BEFORE UPDATE)
+ 1 dùng fn_birth_change_flag_matrix (ON birth_registry)
§2.3 Other named triggers (samples)
trg_before_birth_gate_<table> → fn_birth_gate (16 collections)
trg_desc_guard_<table> → fn_description_birth_guard (21 collections, vd agents, apr_*, checkpoint_*, dot_domain_rules…)
trg_count_birth_registry → update_record_count (counter trigger trên birth_registry)
trg_refresh_orphan_col → trg_fn_refresh_orphan_col (collection_registry)
§2.4 IU pilot trigger (mới nhất)
trg_birth_information_unit AFTER INSERT trên information_unit → fn_birth_registry_auto (cài đặt 2026-05-05 bởi DOT-119 v2; xác nhận đếm 30→31 trong report iu-birth-trigger-install-18c-report.md).
§3. PG functions — birth/orphan/health (runtime ground truth)
| Function | Loại | Vai trò |
|---|---|---|
fn_birth_registry_auto() |
trigger | Safety-belt: AFTER INSERT auto-write birth_registry row. md5 1f729b3571a74963089bb3ef388217f3 (UNCHANGED). |
fn_birth_registry_auto_id() |
trigger | Variant cho 3 governance tables dùng id thay vì code. |
fn_birth_auto_certify() |
trigger | BEFORE UPDATE on birth_registry — auto certify khi đủ inspect_*. |
fn_birth_change_flag_matrix() |
trigger | Trigger trên birth_registry (matrix flag). |
fn_birth_gate() |
trigger | BEFORE INSERT gate (16 tables) — block insert nếu missing prerequisite. |
fn_iu_birth_gate_layer1() |
trigger | IU L1 gate (PILOT-ONLY mode emit WARNING — xem báo cáo P2B-P1). |
fn_iu_birth_gate_layer2() |
trigger | IU L2 deferred gate (anchor consistency at COMMIT). |
fn_tac_birth_gate_lu() / fn_tac_birth_gate_uv() |
trigger | TAC birth gates cho LU/UV. |
fn_pre_birth_check(p_collection,p_code,p_name,p_dot_origin) → TABLE |
function | 4 checks pre-birth (dùng nội bộ bởi gates). |
fn_description_birth_guard() |
trigger | Description gate (Đ4 §2.1) BEFORE INSERT/UPDATE OF description. |
fn_registry_health() → TABLE(collection_name, noi_chua, noi_sinh, gap, status) |
function | Orphan + Ghost detector duy nhất: status ∈ {KHOP, ORPHAN(gap>0), PHANTOM(gap<0)}. |
fn_rule_birth_violations() → TABLE |
function | List birth violations từ rule engine. |
fn_refresh_orphan_col/_dot/_species() |
trigger | Refresh orphan_count cho v_registry_counts (cron mỗi 10 phút). |
trg_fn_refresh_orphan_col/_dot/_species |
trigger | Triggers attach các fn_refresh_* trên. |
fn_reconcile_all_labels() → jsonb |
function | Reconcile labels. |
fn_reconcile_fk_vs_edges() → TABLE |
function | Reconcile FK vs universal_edges (orphan_edges col). |
fn_reconcile_rules_vs_views() → TABLE |
function | Reconcile rules vs measurement views. |
§4. Birth registry — schema + coverage
§4.1 Schema birth_registry (19 cols, runtime)
id (PK) sort user_created/updated date_created/updated
entity_code (NN) collection_name (NN)
species_code composition_level dot_origin
born_at (default CURRENT_TIMESTAMP)
governance_role
inspect_pen inspect_stamp inspect_gate
certified (NN default false) certified_at
status (default 'born') ← cột MỚI so với KB doc Đ0-G v1.0
§4.2 Coverage hiện tại
Total birth_registry rows : 76004
Distinct collections : 78
Top 12 collections:
registry_changelog 42076 (changelog đếm vào birth)
entity_labels 19082
system_issues 3396
universal_edges 2561
universal_rule_violations 1741
knowledge_documents 1729
directus_fields 1505
lifecycle_log 851
dot_tools 590
law_dot_enforcement 272
task_comments 250
meta_catalog 191
§4.3 fn_registry_health — gap report (top 20 |gap|)
collection_name noi_chua noi_sinh gap status
birth_registry 76004 0 76004 ORPHAN ← self-noise (BR không birth chính nó)
measurement_log 18916 0 18916 ORPHAN
universal_edges 2199 2561 -362 PHANTOM
dot_tools 307 590 -283 PHANTOM
task_comments 75 250 -175 PHANTOM
approval_requests 211 62 149 ORPHAN
measurement_registry 142 10 132 ORPHAN
system_issues 3267 3396 -129 PHANTOM
pivot_results 124 4 120 ORPHAN
v_registry_counts 169 50 119 ORPHAN
entity_labels 18981 19082 -101 PHANTOM
knowledge_documents 1642 1729 -87 PHANTOM
directus_fields 1468 1505 -37 PHANTOM
pivot_definitions 37 10 27 ORPHAN
meta_catalog 169 191 -22 PHANTOM
entity_dependencies 142 160 -18 PHANTOM
normative_relations 18 0 18 ORPHAN
species_collection_map 153 159 -6 PHANTOM
law_catalog 5 0 5 ORPHAN
trigger_registry 107 110 -3 PHANTOM
→ Có cả ORPHAN (entities thiếu birth) và PHANTOM/ghost (birth thừa) đang tồn tại runtime. Đây là tín hiệu duy nhất hiện có cho "động cơ phụ cần chạy" / "ghi cũ chưa khớp".
§5. dot_config + system_health_checks
§5.1 dot_config
Query với keys LIKE %birth%, %backfill%, %orphan%, %ghost% → 0 rows.
→ Không có config-key birth-runtime. Mọi chính sách birth đang nằm trong code (PG functions + DOT scripts), không externalize.
§5.2 system_health_checks
Query với code/name/executor_ref ILIKE %birth%|%orphan%|%ghost%|%registry% → 1 row:
DOT-H7 | Orphan — file trên disk không trong dot_tools registry |
check_kind=detect_only | executor_type=builtin | executor_ref=check_orphan_file |
severity=warn | is_active=true
→ KHÔNG có health-check chuyên biệt cho birth_registry gap, không có check cho fn_registry_health PHANTOM/ORPHAN. (Khoảng trống — nhưng outside scope read-only.)
§6. Vai trò ↔ implementation map
| Vai trò | Implementation runtime-active | Source |
|---|---|---|
| Khai sinh chính (safety belt) | Trigger fn_birth_registry_auto × 157 instances |
PG (DOT-119 v2 + legacy birth_trigger_* installs) |
| Khai sinh chính (canonical theo policy) | QT-002 — chưa có tool wrapper ngoài DOT-119 | Doc birth-process-v1.md |
| Birth gate (block prerequisites) | fn_birth_gate × 16; fn_iu_birth_gate_layer1/2; fn_tac_birth_gate_lu/uv |
PG triggers |
| Birth backfill (QT-001) | dot-birth-backfill v1.0.0 (DOT-118, DOT_BIRTH_BACKFILL) |
/opt/incomex/dot/bin/dot-birth-backfill |
| Birth trigger installer | dot-birth-trigger-setup v2.0.0 (DOT-119) |
/opt/incomex/dot/bin/dot-birth-trigger-setup |
| Birth schema setup | dot-schema-birth-registry-ensure (DOT-133) |
disk |
| Trigger guard self-check | dot-trigger-guard (DOT-316 v2) — current: AD 2/2, Directus 2/2 active, 27 active exceptions |
runtime; kèm WARNING [TRIGGER-GUARD] (xem IU install report) |
| Description gate | fn_description_birth_guard × 21 + cron H11 (Đ4 §2.1) |
PG; cron H11 chưa kiểm chứng trong scope này |
| Inspect pen (Phase A) | dot-inspect-pen v1.0.0 |
disk; viết inspect_pen + entity_audit_queue |
| Inspect stamp/gate (Phase B/C) | DOC: dot-inspect-stamp, dot-inspect-gate, dot-certify-scan, dot-birth-orphan-scan |
chưa có file trên disk — design only (Đ0-G doc) |
| Auto-certify | Trigger trg_birth_auto_certify → fn_birth_auto_certify |
PG, runtime |
| Orphan detector — birth-aware (đếm 2 nơi) | fn_registry_health() status=ORPHAN |
PG function — runtime |
| Orphan detector — registry coverage | dot-orphan-scan (DOT-095) |
disk |
| Orphan detector — governance scope | dot-orphan-scanner (DOT-115) — cron 30 2 * * * |
disk + crontab |
| Orphan detector — sync (AD↔Directus) | dot-sync-orphan-scan (DOT-317) — cron 0 5 * * * |
disk + crontab |
| Orphan detector — KG | dot-kg-orphan (DOT_KG_ORPHAN) — cron 0 */6 * * * |
registry only (file chưa thấy trong /opt/incomex/dot/bin) |
| Ghost detector (birth thừa) | fn_registry_health() status=PHANTOM |
PG function — runtime |
| Refresh orphan_count cron | fn_refresh_orphan_species/_dot/_col mỗi */10 * * * * qua docker exec psql |
crontab |
| Reconcile (broader) | fn_reconcile_all_labels, fn_reconcile_fk_vs_edges, fn_reconcile_rules_vs_views + scripts reconcile-tasks.sh, reconcile-knowledge.sh cron 0 */6 * * * |
PG + cron |
| TAC birth verify | DOT-TAC-BIRTH-VERIFY cron 0 6 * * * (event-paired với DOT-TAC-BIRTH-GATE) |
dot_tools; binary location chưa map (no dot-tac-* file in disk listing) |
§7. Cron (active jobs liên quan birth/orphan/registry/health)
*/10 * * * * fn_refresh_orphan_{species,dot,col,species_per_level} (S147-M4d-C dual-trigger safety-net)
30 2 * * * dot-orphan-scanner (Đ32 / DOT-115)
0 4 * * * dot-pivot-health (Đ26 dual-trigger)
0 4 * * * dot-collection-health --local (Đ36)
0 3 * * * dot-dot-health --local (Đ35)
30 4 * * * dot-apr-health --local (S155-P1c)
5 4 * * * dot-matrix-health (S150-P1)
30 21 * * * dot-api-health.sh (DOT-API-HEALTH)
0 5 * * * dot-sync-orphan-scan (DOT-317 sync orphan)
0 */6 * * * reconcile-tasks.sh, reconcile-knowledge.sh (AD↔Directus reconcile)
*/5 * * * * test-mcp-connectivity.sh (MCP health)
0 6 * * * DOT-TAC-BIRTH-VERIFY (registry only — binary chưa xác minh)
0 */6 * * * DOT_KG_ORPHAN dot-kg-orphan (registry only — binary chưa xác minh)
KHÔNG có cron cho:
dot-birth-backfill— phải chạy thủ công per-collectiondot-birth-trigger-setup— chỉ chạy khi cần cài trigger mớidot-inspect-pen— phải chạy thủ công
§8. Runtime-active vs document/design
§8.1 Runtime-active (ĐÃ chạy trên VPS, đã có evidence)
- 162 PG birth triggers (
trg_birth_*31 +birth_trigger_*131) fn_birth_registry_auto(md5 unchanged),fn_birth_registry_auto_id,fn_birth_auto_certify,fn_birth_change_flag_matrixfn_birth_gate× 16,fn_iu_birth_gate_layer1/2,fn_tac_birth_gate_lu/uv,fn_description_birth_guard× 21,fn_pre_birth_checkfn_registry_health()(orphan + ghost reporter — đã chạy trả về 78+ rows)fn_refresh_orphan_*(cron */10 min)fn_reconcile_*(callable functions)- DOT-118 backfill, DOT-119 trigger-setup v2, DOT-115/095/317 orphan scanners, DOT-316 trigger-guard, DOT-133 schema-ensure, DOT-H7 health check
dot-inspect-pen(binary có, chưa có cron)
§8.2 Documented/design only — KHÔNG runtime
- QT-002 wrapper tool — văn bản gọi tên QT-002 birth-first nhưng chưa có DOT tool dedicated. DOT-119 chỉ cài trigger; thực tế "birth-first" được safety-belt trigger thực hiện sau INSERT, không có gating layer trừ
fn_birth_gate/fn_iu_birth_gate_*/fn_tac_birth_gate_*cho 16 + few tables. fn_birth_first()— nêu trong birth-process-v1.md như shared helper. KHÔNG tồn tại trong pg_proc.dot-iu-create— đề xuất trongiu-birth-philosophy-…review. Chưa có file.dot-content-create— file có (8591 B) nhưng chưa được refactor sang QT-002 (theo birth-process-v1.md).dot-inspect-stamp,dot-inspect-gate,dot-certify-scan,dot-birth-orphan-scan— Đ0-G doc đánh dấu "Cần tạo". Không có file trên/opt/incomex/dot/bin/.v_all_governed_entitiesview (Đ0-G doc nêu) — chưa kiểm chứng (out of scope §3 query này; nhưngfn_registry_healththay thế chức năng tương tự).- system_health_checks rows cho birth_registry gap — không có. Chỉ có
DOT-H7cho orphan filename. - dot_config keys cho birth/backfill/orphan/ghost — không có. Chính sách hardcoded.
§8.3 Lệch giữa doc & runtime
- KB doc Đ0-G + DOT-119 báo cáo: trigger count "31". Thực tế: 162. Nguyên nhân: prefix khác (
birth_trigger_*131 trigger cũ). Doc/report chỉ đếm prefixtrg_birth_*mới do DOT-119 sinh. - KB doc liệt kê
birth_registry18 cols. Thực tế: 19 cols — thêmstatus(default'born'). - DOT_KG_ORPHAN, DOT-TAC-BIRTH-VERIFY có trong
dot_toolsnhưng binary file chưa thấy trong listing → có thể nằm ở subdir hoặc registry ghost. dot-birth-backfillvàdot-birth-trigger-setupxuất hiện 2 lần trongdot_tools(DOT-118/DOT-119 canonical + DOT_BIRTH_BACKFILL/DOT_BIRTH_TRIGGER_SETUP UPPER_SNAKE) → duplicate registration.
§9. Hardcode khảo sát (Q7)
Tìm thấy hardcode runtime-active trong:
| File | Loại hardcode | Ghi chú |
|---|---|---|
dot-pg-triggers-ensure |
Liệt kê 16 atom collections | Pre-DOT-119 era. |
dot-schema-birth-registry-ensure |
CAT-023 metadata + 12 fields cụ thể | Bootstrap nature, chấp nhận được. |
dot-orphan-scanner |
Scope governance (registries/policies/laws) hardcoded | DOT-115 — pre-metadata-driven. |
dot-orphan-scan |
Sources cứng (catalog/table/module/workflow/wcr/page/dot_tool/collection/task/agent/checkpoint_*) | DOT-095. |
dot-pg-views-ensure |
v_registry_counts field list, CAT-000 SQL row |
Bootstrap. |
KHÔNG hardcode trong dot-birth-trigger-setup v2 (đã refactor metadata-driven, xác nhận bởi DOT-119 P2 report — 0 hardcode collection list).
§10. Cảnh báo & gaps (chỉ liệt kê — không đề xuất thiết kế)
- 162 birth triggers song song hai pattern — không có policy chính thức về việc đồng bộ migrate
birth_trigger_*cũ sangtrg_birth_*mới (DOT-119 v2 mới sinh 31). - Không có cron cho fn_registry_health — không có scheduled job nào emit warning khi gap > 0. ORPHAN/PHANTOM hiện hữu (vd 149 orphan approval_requests, 283 phantom dot_tools) nhưng không trigger cảnh báo.
fn_registry_healthkhông phân biệt nguồn gap — không biết gap do safety-belt trigger fire (mong muốn) hay do bypass (cần fix).- Không có dot_config externalization — toàn bộ chính sách birth nằm trong code/triggers, mọi thay đổi đòi hỏi code change.
- Phase B/C inspectors thiếu — pen có (file binary), stamp/gate/certify-scan/orphan-scan dedicated KHÔNG có file dedicated (mặc dù
fn_birth_auto_certifytrigger đã tự động hoá phần certify). - DOT_KG_ORPHAN, DOT-TAC-BIRTH-VERIFY đăng ký trong
dot_toolsmà không thấy binary trong/opt/incomex/dot/bin/. Có thể là:- Binary ở location khác (nuxt-repo/agent-data-repo/...).
- Registry ghost.
- Tool chưa deploy.
§11. Trả lời 8 câu hỏi (chi tiết)
Q1. Kênh chính khai sinh hiện là gì?
Runtime: PG safety-belt trigger fn_birth_registry_auto (cộng variant _auto_id) trên 160 trigger instances bao trùm 78 collections đã có rows + nhiều collection chưa có rows. Function md5 invariant 1f729b3571a74963089bb3ef388217f3.
Doc/Design: QT-002 birth-first (birth-process-v1.md) — chưa có dedicated wrapper tool ngoài DOT-119 (cài đặt trigger).
Found: runtime-active (PG triggers + DOT-119) + documented (QT-002 process).
Q2. Động cơ phụ/backfill hiện là gì?
Runtime: /opt/incomex/dot/bin/dot-birth-backfill v1.0.0 (DOT-118). Inserts birth records cho governed entities đã tồn tại, set certified=true, verify count.
Doc/Design: QT-001 (birth-process-v1.md).
Found: runtime-active (binary có, không cron, chạy thủ công).
Q3. Khi động cơ phụ chạy thì warning/health signal nào báo?
KHÔNG có warning chuyên biệt cho QT-001 backfill. Tín hiệu gián tiếp:
fn_registry_health()cho ra statusORPHAN(gap>0) hoặcPHANTOM(gap<0) — sự thay đổi gap khi backfill chạy.dot-trigger-guardbáo[TRIGGER-GUARD]exceptions khi DDL trigger thay đổi.- Không có
system_health_checksrow dedicated. - Không có
dot_configswitch/observation key.
Found: runtime-active partial (signal có nhưng gián tiếp; gap: không có cảnh báo trực tiếp khi QT-001 chạy).
Q4. Orphan detector nào đang có?
Runtime, 4 mechanisms:
fn_registry_health()status=ORPHAN — birth-aware (đếmbirth_registryvs entity table).dot-orphan-scanner(DOT-115, cron30 2 * * *) — governance scope.dot-orphan-scan(DOT-095, manual) — full system coverage (Đ19 Side B).dot-sync-orphan-scan(DOT-317, cron0 5 * * *) — AD↔Directus sync.
Plusfn_refresh_orphan_*(cron */10 min) cập nhậtv_registry_counts.orphan_count.
Doc/Design: Đ19 doc gọi tên "Orphan Scanner" generic, không tách 4 layer này → doc dưới runtime.
Found: runtime-active (4 separate detectors).
Q5. Ghost detector nào đang có?
Runtime: fn_registry_health() status=PHANTOM (birth_registry > entity table). Hiện đang report 13 PHANTOM collections (vd dot_tools −283, universal_edges −362, system_issues −129, task_comments −175, entity_labels −101, knowledge_documents −87, directus_fields −37, meta_catalog −22, entity_dependencies −18, species_collection_map −6, trigger_registry −3).
Doc: birth-registry-law.md đề cập "ghost/phantom SQL" như query-trên-yêu-cầu, không mention function name.
Found: runtime-active (fn_registry_health); doc phần lớn dưới dạng SQL snippet, không tool.
Q6. Tool/function/trigger nào phụ trách từng vai trò?
Xem §6 ở trên — bảng đầy đủ.
Q7. Hardcode còn lại ở đâu, nếu có?
Có, ở 5 file (xem §9). Quan trọng: dot-birth-trigger-setup v2 (DOT-119 v2) đã loại bỏ hardcode collection list — đó là điểm sáng của session 2026-05-05. Hardcode còn lại tập trung ở các tool legacy (dot-pg-triggers-ensure, dot-orphan-scanner, dot-orphan-scan, dot-pg-views-ensure, dot-schema-birth-registry-ensure bootstrap).
Q8. Cái gì runtime-active, cái gì chỉ là document/design?
Xem §8 ở trên — bảng đầy đủ. Tóm:
- Runtime-active: 162 birth triggers, 13+ birth/gate/health functions, DOT-118/119/115/095/317/316/133/H7,
fn_registry_health, cron */10 min orphan refresh, cron daily orphan scanners. - Document/design only: QT-002 wrapper tool,
fn_birth_first(),dot-iu-create,dot-content-createrefactor, Phase B/C inspectors (dot-inspect-stamp,dot-inspect-gate,dot-certify-scan,dot-birth-orphan-scan),v_all_governed_entitiesview,system_health_checksrows cho birth gap,dot_configkeys cho birth. - Lệch: trigger count doc 31 vs runtime 162; birth_registry doc 18 cols vs runtime 19 (
status); 2 DOT codes có duplicate registration; 2 DOT codes có registry entry nhưng chưa thấy binary.
§12. Hard boundaries respected
- ✅ NO mutation: tất cả query READ-ONLY (
SELECT,--help,ls,grep,crontab -l). - ✅ NO design proposal trong report.
- ✅ NO new tool/script tạo ra.
- ✅ NO recommendation thiết kế mới.
P2B-INV report | 2026-05-05 | Inventory toàn diện birth pipeline runtime + doc/design. Read-only.