KB-D7F8

Report S178 Fix 28 Steps 7-9

6 min read Revision 1
reports178-fix28description-governancestep-7step-8step-9

title: Report S178 Fix 28 — §VIII Steps 7+8+9 Description Governance Deployment session: S178-Fix28 date: 2026-04-22 law_reference: Đ3 §2.4, §2.5, §2.6 | Đ43 §9.1 | du-thao-description-governance-package-fix27 §VIII admin_fallback_log_id: 22 retroactive_apr_deadline: 2026-04-23 (24h from log insert)

Report Fix 28 — Description Governance §VIII 7+8+9

§1. Tóm tắt 1 câu

Triển khai xong migration provenance legacy (bước 7), deploy H11a/H11b queries (bước 8), backfill 1459 description cơ bản (bước 9) — 2951/2951 entity governed có description ≥ 30 char và provenance label; H11a=0, H11b=1238 (PROV-DOT chờ AI enrichment).

§2. admin_fallback_log

Field Value
id 22
dot_code DOT-DESC-GOV-MIGRATION
reason description_governance_migration_s178_fix28
status applied
approved_by president
session_code S178-FIX28
retroactive_deadline 2026-04-23 (24h từ INSERT)
backup_path _desc_backup_fix28 (table trong DB)

★ Retroactive APR TODO: Trong 24h phải tạo APR documenting write-path exception và UPDATE admin_fallback_log SET status='retroactive_documented'. Nếu không: cron sẽ flip thành audit_overdue (pattern Fix 16 + Fix 20 M3B).

§3. Kết quả numeric

Step 7 — Migration provenance legacy (PROV-HUMAN)

Metric Count
PROV-HUMAN gán (entity có desc non-empty + 0 PROV) 1713
PROV-DOT có sẵn (trước migration) 15

Step 8 — H11a/H11b queries

Doc ID Severity
knowledge/current-state/queries/h11a-description-basic-missing CRITICAL
knowledge/current-state/queries/h11b-description-detail-missing WARNING

Upload: cả 2 HTTP 200, revision 1.

Step 9 — Backfill

Reason Count
h11a_null_empty 1223
too_short (< 30, hoặc < 50 cho dot_tools) 236
gaming (repeat / punct only) 0
Total rows backup + backfill 1459

Top 5 bảng backfill:

Table Count
system_issues (h11a) 852
collection_registry (h11a) 147
meta_catalog (h11a) 130
dot_tools (too_short) 111
dot_domain_rules (too_short) 67

Step 9b — PROV-DOT label cho backfilled entities

1223 entity được backfill từ NULL/empty → gán PROV-DOT (bypassed trg_desc_provenance vì AFTER INSERT only, backfill dùng UPDATE).

§4. Verify H11a/H11b sau backfill

Query Findings
H11a (description null/empty) 0
H11b transitional (PROV-DOT hoặc no-prov legacy) 1238
entity 0 PROV label sau migration 0
length < 30 còn lại 0

Đạt 100% tiêu chí đo #6.

§5. Trigger ordering verify

Ví dụ dot_tools (pattern giống 20 bảng khác):

trg_auto_code_dot_tools        BEFORE INSERT   -- auto-gen code (< desc_guard alphabetically)
trg_desc_guard_dot_tools       BEFORE INSERT+UPDATE
trg_desc_provenance_dot_tools  AFTER INSERT

Đạt trg_auto_* < trg_desc_guard < trg_desc_provenance. PG fire alphabetically cùng timing → naming OK (★ R2 Desktop P10).

Lưu ý: prefix là trg_auto_code_ (không phải trg_auto_id_ như tiêu chí #7). Về chữ cái vẫn auto_ < desc_ nên ordering bảo đảm.

§6. Phát hiện + điều chỉnh so với dự thảo

# Phát hiện Điều chỉnh
1 fn_description_birth_guard chỉ auto-gen trên INSERT (hoisted IF TG_OP = 'INSERT') Backfill phải tự compute inline qua fn_description_context + fn_render_description_template. Dùng pg_temp.fn_compute_desc_fix28 mirror 4-tier lookup.
2 trg_desc_provenance_<table> AFTER INSERT → không fire khi UPDATE backfill Thêm Step 9b: gán PROV-DOT thủ công cho 1223 entity mới có description sau backfill.
3 dot_domain_rules không có column code; entity_code tổng hợp `'RULE-'
4 apr_action_types, apr_request_types, dot_domain_rules không có record trong birth_registry Chỉ migrate qua v_entity_full_classification (UNION đầy đủ tất cả 21 bảng).

§7. Tech debt & Follow-up

  1. Retroactive APR (deadline 24h): document ngoại lệ write-path. Session kế tiếp chạy APR với reason='description_governance_migration_s178_fix28' tham chiếu admin_fallback_log.id=22.
  2. fn_description_birth_guard gap: hiện chỉ auto-gen trên INSERT. Cân nhắc mở rộng UPDATE SET description='' triggers auto-gen — giảm nhu cầu inline compute trong các backfill sau. Log APR tương lai.
  3. H11b 1238 findings là PROV-DOT chờ AI enrichment (pha bước 10 — §VIII roadmap).
  4. dot_domain_rules 67 entity mô tả render default-template [active] Entity (chưa có) trong dot_domain_rules. — thiếu template riêng cho rule pattern. Session sau seed desc_template_dot_domain_rules.
  5. Backup retention: _desc_backup_fix28 giữ 90 ngày tối thiểu để rollback nếu AI enrichment sai.

§8. Files changed

  • KB uploaded: 2 queries H11a, H11b (path knowledge/current-state/queries/)
  • DB: _desc_backup_fix28 (new table, 1459 rows), admin_fallback_log (id=22), entity_labels (+1713 PROV-HUMAN, +1223 PROV-DOT), 20 governed tables description column (1459 rows updated)

S178 Fix 28 | Steps 7-9 complete | 2026-04-22 | Đ3 §2.4 exception documented