86 — All Drift Findings & Mandatory Build Fold-Ins — FINAL (2026-06-01)
86 — All Drift Findings & Mandatory Build Fold-Ins — FINAL
Branch D (mission §7). Tier: consolidated engineering fold-in list. Mutation footprint: ZERO (catalogue only). Authoritative for build: every COMMIT build step MUST apply the relevant fold-ins below; none requires a council/sovereign decision (they are engineering corrections), EXCEPT where a decision is explicitly called out (F-R7-2 naming, H-OPT-2 default change). Sources: doc 65 §65.2, doc 69 (verbatim), GCOS rehearsals 57–63, SB-2 docs 75–80, SB-1 docs 83–84 (this mission), live re-verify 2026-06-01.
86.1 Master fold-in table
| ID | Issue | Risk if ignored | Mandatory build adjustment | Verification test | Rollback impact | Build step affected |
|---|---|---|---|---|---|---|
| F-83-1 (NEW, critical) | Inserting into apr_action_types fires trg_birth_apr_action_types → fn_birth_registry_auto() with no code-field arg; table has no id col → synthetic entity_code=NULL → birth_registry not-null violation. The 6 existing rows predate the trigger (birth_registry.apr_action_types=0). |
SB-1 Phase-A INSERT fails outright — the 4 governance action-types cannot be registered. | Before the 4 INSERTs, re-wire the trigger: DROP TRIGGER trg_birth_apr_action_types ON apr_action_types; CREATE TRIGGER … AFTER INSERT … EXECUTE FUNCTION fn_birth_registry_auto('action_code'); (mirrors the working approval_requests trigger fn_birth_registry_auto('code')). |
BEGIN; <fix>; INSERT 4 rows; SELECT count(*) FROM birth_registry WHERE collection_name='apr_action_types'; -- 4, entity_code=action_code; ROLLBACK; (proven live, doc 83 §83.3). |
Trigger DDL is transactional; ROLLBACK restores the no-arg def (proven). At build, the re-wire is a permanent corrective DDL on a directus-owned table (needs owner/superuser). |
SB-1 build (Phase A) |
| F-83-2 (NEW, observation) | A [TRIGGER-GUARD] DDL-audit event trigger emits a WARNING on DROP/CREATE TRIGGER ([TRIGGER-GUARD] DROPPED…, DDL detected: CREATE TRIGGER…). Non-blocking in rehearsal. |
None functional; but an unreviewed build that re-wires the birth trigger will trip the guard — could be mis-read as an error, or (if the guard is later hardened to RAISE) block the F-83-1 fix. | Build agent expects + records the TRIGGER-GUARD warning when applying F-83-1; confirm the guard is WARNING-level (not blocking) at build time; if blocking, route the trigger re-wire through the guard's allow path. | BEGIN; DROP/CREATE TRIGGER …; -- observe WARNING not ERROR; ROLLBACK; (observed live, doc 83). |
None (warning only). | SB-1 build (Phase A) |
| F-57-1 | queue_heartbeat real columns: PK executor_name; cols executor_name/executor_kind; executor_kind ∈ {DOT, Agent, Hermes, Codex, PG_worker, external_worker, future_Kestra_adapter}; last_tick_status ∈ {ok,warn,error}; metadata jsonb under an Điều-45 safe-check forbidding keys body/content/raw/vector/embedding/secret/token/password/ssn/personal_data. (doc 39's representative DDL assumed generic columns.) |
SB-13 heartbeat inserts fail (wrong cols/PK), or the Điều-45 safe-check rejects the metadata, or a worker writes data-not-signal into the queue (Điều-45 violation). | SB-13 DDL/inserts use executor_name='gov_<worker>', executor_kind='PG_worker', last_tick_status ∈ {ok,warn,error}, metadata='{}'::jsonb (safe keys only). Never body/content/secret keys. |
BEGIN; INSERT … gov_backfill_sweep …; SELECT executor_name,executor_kind FROM queue_heartbeat WHERE executor_name LIKE 'gov\_%'; ROLLBACK; → row present, kind=PG_worker, no safe-check RAISE (proven R-3/doc 59). |
Reuse-table additive rows; rollback = DELETE WHERE executor_name LIKE 'gov\_%' or whole-tx. Zero schema change. |
SB-13 build (patch doc 39) |
| F-57-2/3/4 | event_type_registry live CHECKs: delivery_lane ∈ {immediate, delayed} (not deferred); event_stream ∈ {comment, review, update, birth, task, alert, health} (not governance); default_severity ∈ {info, warning, critical} (not medium). event_domain='governance' is free-text (new domain). PK (event_domain, event_type). |
SB-11 registration INSERT fails on CHECK → register-before-emit blocked → G-RBE cannot COMMIT. | Register the 5 governance event types with delivery_lane='delayed', event_stream='alert' (finding-type) / 'health' (heartbeat-type), default_severity='warning' (medium input finding; else 'info'), event_domain='governance', active=false (RR-9). |
BEGIN; INSERT 5 governance rows active=false; SELECT count(*) FROM event_type_registry WHERE event_domain='governance' AND active=false; SELECT count(*) FROM event_outbox WHERE event_domain='governance'; ROLLBACK; → 5 registered, outbox governance=0 (proven R-5/doc 61). |
Additive reuse-table rows; rollback = DELETE WHERE event_domain='governance'. Rows inactive → nothing emitted to unwind. |
SB-11 build (patch doc 41), addendum #9 |
| F-R7-1 | dot_coverage_required.domain has FK → dot_domains(code). dot_domains lacks the 4 GCOS subdomains. First R-7 attempt failed: Key (domain)=(governance.backfill) is not present in dot_domains. |
T6/T7 addenda build fails at the dot_coverage_required insert (FK violation) → addenda #4/#5 cannot COMMIT. |
First INSERT governance.{backfill,handoff,input,candidate} into dot_domains (parent governance), then dot_tools, then dot_coverage_required. Ordering: dot_domains → dot_tools → dot_coverage_required. |
BEGIN; INSERT 4 dot_domains; INSERT 4 dot_tools; INSERT 4 dot_coverage_required; SELECT count(*) FROM dot_coverage_required WHERE domain LIKE 'governance.%'; ROLLBACK; → 4, no FK error (proven corrected R-7/doc 63). |
Three additive reuse-table inserts; rollback in reverse order or whole-tx. | T6/T7 addenda build (#5, mandatory order) |
| F-R7-2 (decision) | dot_tools Birth-Gate warns when code ≠ PREFIX-NNN; dot_governance_* codes raise non-blocking WARNING … sai format. INSERTs succeed. |
None functional (warning only); un-decided → noise + inconsistent naming. | Decision required: rename the 4 GCOS DOTs to GOVDOT-001..004 (PREFIX-NNN-compliant) or explicitly accept the warning as intentional descriptive naming. Recommend GOVDOT-###. Record in addendum #4. |
BEGIN; INSERT 4 dot_tools with chosen codes; -- observe WARNING count; ROLLBACK; → renamed=0 warnings; accepted=4 non-blocking. |
Additive rows; DELETE the 4. Naming choice has no rollback consequence. |
T6/T7 addenda build (#4, decision) |
| OI-45-1 | doc 35 §7 says "eleven targeted addenda"; the §3.2/doc 45 §45.4 patch table has exactly 10 rows (the "11th" is an off-by-one — the production-gate rule is the 10th in-table row). | A build agent hunts for a non-existent 11th addendum or believes one was skipped. | Authoritative addenda count = 10. When surgically patching frozen docs at build, correct doc 35 §7 "eleven" → "ten". | Count rows in doc 45 §45.4 table = 10; production-gate is addendum #10. | Documentation only; no PG impact. | doc 35 wording (count pin) |
86.2 Live data corrections (the substrate reality the design docs must defer to)
| ID | Correction | Build consequence |
|---|---|---|
| L-CANON-NULL | birth_registry.canonical_address is NULL in all 1,048,181 rows (was so across the project; live re-confirmed 2026-06-01). |
SB-10 `candidate_key = COALESCE(canonical_address, collection_name |
| L-WATERMARK | Watermark id types are mixed: birth_registry.id=integer, registry_changelog.id=integer, iu_route_worker_cursor.last_event_id=uuid, event_outbox.id=uuid. |
SB-13 gov_worker_cursor.last_watermark_id must be type-generalized text (proven: int & uuid watermarks coexist in one text col, doc 59). Never reuse 1:1 a uuid/int column. |
| L-NO-GOV-EVENTS | event_type_registry has 0 governance-domain rows; no governance event domain exists live. |
SB-11 must register the governance free-text domain (register-before-emit, active=false) before any emit. F-57-2/3/4 enum values apply. |
| L-BIRTH-GROW | birth_registry is growing organically (1,042,945 → 1,048,181 over the package's runs). |
Baselines are point-in-time; build re-verify must allow organic growth on birth_registry/event_outbox (they are never mutated by governance work). |
| L-APR-NO-BIRTH | birth_registry.apr_action_types = 0 (the 6 existing action-types have no birth row). |
Root evidence for F-83-1; the birth trigger has never successfully fired for this table. |
86.3 Authorization / safety fold-ins (carried, must hold at build)
- SB-1 auto-approve risk (doc 27/84): every governance APR MUST use
action='review'(neveraction='add') — theaction='add'BEFORE-INSERT auto-approve bypasses the BEFORE-UPDATE quorum gate. Thedot_governance_gap_proposeDOT setsaction='review'by contract and is paired-tested to refuseaction='add'. Phase-A safeties:action≠'add'(protects approval) +handler_ref='unimplemented'(protects apply). Durable hardening (T11): H-OPT-4 allowlist + H-OPT-2 default change (both DDL, separately gated). - SB-2 rehearsal notes (doc 76–80):
governance_object_ownershipis an additive table, never agovernance_relationsCHECK-widen; partial UNIQUE enforces one accountable owner per(object_type,object_ref,scope);owner_kind∈{accountable,supporting,delegated,exception}are ROLES, the 6 scopes stay{policy,health,execution,render,approval,audit};delegatedrequireseffective_to(TTL CHECK); table is trigger-less (no birth/emit side effects — so SB-2 has no F-83-1-class problem). Owner-link inheritance only (anti-masquerade: exception/support never inherit as accountable). - G-APPLY do-not-build: the mutating DOT
dot_governance_assignment_applyMUST NOT be created until A-9 (H-1/H-2/SB-6) sovereign sign-off exists. T6/T7 build registers only tier-A read/propose DOTs. - docs 24/25 addenda (T7/T6 design): at build these frozen design docs are surgically patched (doc 69 §69.3 landing table): F-57-2/3/4 → doc 41 (addendum #9); F-R7-1 → doc 45 §45.4 (#5); F-R7-2 → doc 45 §45.4 (#4); F-57-1 → doc 39. Doc 45 §45.9 cross-ref headers on docs 24/25 are retained (RR-12); the 10-addendum count is authoritative (OI-45-1).
86.4 Fold-in completeness attestation
This list is the union of: doc 65 §65.2 (F-57-1/2/3/4, F-R7-1/2, OI-45-1) · doc 69 verbatim per-finding text · the 5 live data corrections (§86.2) · the SB-1 auto-approve convention · the SB-2 additive-table notes · the two new SB-1 findings F-83-1 (critical) and F-83-2 (observation) discovered live this mission. No drift finding from any prior doc is dropped; F-83-1 is the only new blocker-class finding and it has a live-validated fix. Total mandatory engineering fold-ins for build = F-83-1, F-57-1, F-57-2/3/4, F-R7-1 (+ decision F-R7-2, observation F-83-2, doc-count OI-45-1, and the 5 live corrections).