KB-356B
S146 Audit Fix Sprint Report
3 min read Revision 1
reports146audit-fixlifecycleedgesreconciliation
S146: Audit Fix Sprint — Lifecycle + Edges + Cleanup
Date: 2026-03-19 Status: COMPLETE (verified production)
Results Summary
| Metric | Before | After | Change |
|---|---|---|---|
| Rule 8 (Liveness) | 23 | 0 | -23 |
| Rule 4 (Connectivity) | 586 | 560 | -26 |
| Total violations | 830 | 781 | -49 |
| Universal edges | 450 | 578 | +128 |
| Lifecycle log | 828 | 851 | +23 |
| verify_counts | 19/19 OK | 19/19 OK | — |
| Reconciliation DRIFT | 4 | 1 | -3 |
Part A: Lifecycle Backfill (Rule 8 → 0)
Backfilled lifecycle_log for 23 entities:
- 22 trigger_registry (TRG-BIRTH-001..016, TRG-EDGE-001..006)
- 1 meta_catalog (CAT-100)
All created via direct INSERT before lifecycle_log backfill. performed_by = PG:audit_s146_backfill.
Part B: CAT-100
Backfilled lifecycle_log entry (not deleted — meta_catalog has DELETE guard). CAT-100 no longer causes Rule 8 violation since it now has lifecycle_log entry.
Part C: FK-to-Edge Sync Triggers + Backfill
Triggers Created
- Updated
trg_sync_edges_taxonomyto also sync facet_id → taxonomy_facets - Created
trg_sync_edges_label_rules(facet_id → taxonomy_facets) - Created
trg_sync_edges_taxonomy_matrix(facet_id → taxonomy_facets)
Edges Backfilled
- taxonomy.facet_id → taxonomy_facets: 55 edges
- label_rules.facet_id → taxonomy_facets: 37 edges
- taxonomy_matrix.facet_id → taxonomy_facets: 36 edges
- Total: 128 new edges
Reconciliation Fix
Fixed fn_reconcile_fk_vs_edges to filter by source_info (FK column) — eliminates false positives.
- Excluded universal_rule_* infrastructure tables
- Remaining DRIFT: taxonomy.parent_facet (21 FKs but only 4 match parent_id — different semantics)
Part D: Orphan Edges
replaced_by DRIFT was false positive (fixed by improved reconciliation function). No actual orphans to clean.
Verification
| # | Condition | Result |
|---|---|---|
| 1 | Rule 8 = 0 | PASS |
| 2 | Reconciliation improved | PASS (5/6 OK, 1 expected DRIFT) |
| 3 | verify_counts | PASS (19/19 OK) |
| 4 | lifecycle_log count | 851 (was 828) |
| 5 | Edge count | 578 (was 450) |
| 6 | Production verified | PASS (Nuxt 200, Directus 200, Registries 200) |