05 — Deferred Substrate Completion: Rollback Readiness (additive; per-item DROP restores ACCEPTED_BUILD_STATE, 2026-06-02)
05 — Rollback Readiness
Build is additive ⇒ reversible. Rollback scripts staged before COMMIT; not exercised (none warranted — substrate is safe + inert).
5.1 SB-10 aux rollback (sql/sb10_aux_rollback.sql)
DROP TABLE IF EXISTS governance_candidate_object; -- has the FK into the keystone; drop first
DROP TABLE IF EXISTS candidate_scan_run;
Indexes drop with their tables. Removes 100% of SB-10-aux state; the accepted keystone governance_candidate_state is unaffected (it never gained a reverse FK).
5.2 SB-2 views rollback (sql/sb2_views_rollback.sql)
DROP VIEW IF EXISTS v_object_owner_gap; -- depends on effective_owner + inventory seam
DROP VIEW IF EXISTS v_object_owner_conflict; -- depends on the store only
DROP VIEW IF EXISTS v_object_effective_owner; -- recursive form (9 cols)
CREATE VIEW v_object_effective_owner AS -- restore EXACT original direct form (verified vs pg_get_viewdef)
SELECT object_type, object_ref, scope, owner_gov_code, owner_kind
FROM governance_object_ownership
WHERE owner_kind='accountable' AND lifecycle_status='active';
DROP VIEW IF EXISTS v_governance_object_inventory;
DROP VIEW IF EXISTS v_governance_object_containment;
Order: drop dependents → drop+recreate v_object_effective_owner in its original 5-col form (CREATE OR REPLACE cannot drop appended columns, so DROP+CREATE) → drop the two seams. End state = byte-for-byte the ACCEPTED_BUILD_STATE for SB-2.
5.3 Reversibility properties
- Additive only: every committed object is a
CREATE; the oneCREATE OR REPLACE(effective_owner) is strictly additive (appended columns) and its prior definition is captured. - No data to lose: all new objects are empty; rollback discards nothing of value.
- No coupling created: keystone soft-ref unchanged;
governance_relationsnever altered; seams empty. - Transactional proof: the rehearsals demonstrated full auto-reversal under
ROLLBACK(entry==exit, including DDL of the replaced view).
5.4 Disaster backstop
Schema-only dump directus-pre-phase1-testmode-20260602T062711Z.schema.sql and full VPS vps-backup-20260601_203701.tar.gz (referenced by the accepted build) remain the last-resort restore. Not needed for this additive completion.
5.5 Verdict
ROLLBACK READINESS = PROVEN (not exercised). Two per-item scripts staged + hash-indexed (doc 07 §inventory); both restore the exact ACCEPTED_BUILD_STATE.