KB-3DEC
Dieu 37 P1 — Audit Addendum v2
2 min read Revision 1
Dieu 37 P1 — Audit Addendum v2
Date: 2026-04-02 | Full re-audit after Desktop request
Issues Found and Fixed
1. FK Constraints MISSING → FIXED
Directus Collections API does NOT create PG FK constraints despite foreign_key_table/column in schema. Fix: Added 6 FK constraints via ALTER TABLE:
- law_jurisdiction.law_code → law_registry.code ON DELETE RESTRICT
- law_jurisdiction.domain → dot_domains.code ON DELETE RESTRICT
- governance_registry.domain → dot_domains.code
- governance_registry.created_by_law → law_registry.code
- law_dot_enforcement.law_code → law_registry.code ON DELETE RESTRICT
- governance_audit_log.relation_id → governance_relations.id
2. Permissions NOT CREATED → FIXED
Bash for-loop variable expansion failed silently. Fix: Recreated all 53 permissions one by one (IDs 639-690). Verified: 0 DELETE permissions. Summary matches prompt exactly.
3. Species Mapping MISSING → FLAGGED
6 new collections have NO species mapping in species_collection_map. Only species_code matching is governance_infra (atom) — not suitable for compound/policy entities. Per prompt: DUNG + ghi report + hoi Desktop. KHONG tu tao species.
Final Verification: 17/17 PASS
All V1-V17 re-verified after fixes. Full evidence in main report.