KB-160A

10 — Rollback Readiness & Residue Check — PROVEN (2026-06-02)

3 min read Revision 1
one-roof-governancephase1test-mode-buildrollback-readinessresidue-check2026-06-02

10 — Rollback Readiness & Residue Check

10.1 Rollback readiness — PROVEN (every step reverses)

The whole build is additive ⇒ reversible. Staged per-step rollback scripts (in sql/):

step rollback script reverses
SB-0 sb0_rollback.sql DROP verifier, view, 2 fns, table (+4 idx)
SB-12+SB-13 sb12_sb13_rollback.sql DROP governance_ruleset, gov_worker_cursor
SB-11 sb11_rollback.sql DELETE 5 event_type_registry governance rows
SB-2 sb2_rollback.sql DROP view, ownership table, scope table
SB-10 sb10_rollback.sql DROP governance_candidate_state
SB-1 sb1_rollback.sql DELETE 8 vocab rows + their 8 birth rows + restore argless trigger*

* The SB-1 rollback restores the original argless trigger, which re-introduces the latent F-83-1 NULL bug. Recommendation in the script: prefer to KEEP the F-83-1 fix (a genuine repair) and only DELETE the 8 vocab rows unless a full revert is explicitly required.

Each script was authored from the exact committed DDL; FK/dependency drop order is correct (view→fns→table; ownership→scope; birth rows→vocab rows). A full-restore backstop exists: schema-only dump /opt/incomex/backups/directus-pre-phase1-testmode-20260602T062711Z.schema.sql + full VPS backup vps-backup-20260601_203701.tar.gz.

10.2 Dependency order for a FULL rollback (if ever needed)

SB-10 → SB-2 → SB-11 → SB-13 → SB-12 → SB-1 → SB-0 (drop dependents first; SB-10 FK→SB-12 means SB-10 before SB-12). No cross-step FK except SB-10→SB-12(governance_ruleset)/evolution_snapshots.

10.3 Residue check

  • No BEGIN..ROLLBACK rehearsal left residue: each rehearsal verified post-rollback NULL in the same session AND each was re-confirmed by the independent query_pg channel.
  • idle_in_transaction = 0 after every step and at final verification — no dangling write transactions.
  • No leftover workflow_admin sessions (each psql invocation is one-shot via stdin and exits).
  • Committed state contains exactly the authorized objects + the legitimate seeds; nothing partial.

10.4 Verdict

ROLLBACK READINESS: PROVEN. RESIDUE: NONE (beyond the intended committed substrate).

Back to Knowledge Hub knowledge/dev/reports/architecture/one-roof-phase1-test-mode-build-2026-06-02/10-rollback-readiness-and-residue-check.md