RFC-0053 view lifecycle contract proposal
Versioned draft snapshot
RFCs, reference catalogs, and evidence reflect Spec 3b2e3e7a114fb826b1445d39a48756b8fff629cd. Counts and pending/status notes belong to that snapshot. Read the dated project update for later progress.
Source repositories are private during staging. Links marked “repository access required” need access to the linked repository.
This is a trace and gap record from the pinned draft specification. It does not establish proof or implementation conformance.
Status: proposed, awaiting owner decision. Owners: Compiler, Storage. No normative source changes applied.
Evidence
RFC-0053 §9.2 makes deletion of retained JSON keys optional after removing a view column. Lean M53030 nevertheless rejects column removal without a core.migrations.RemoveField migration. The source and diagnostic prescribe different behavior.
§9.1 assumes DROP VIEW automatically cascades, although its example omits CASCADE. PostgreSQL’s DROP VIEW contract defaults to RESTRICT. Its CREATE OR REPLACE VIEW contract permits appending columns while preserving existing names, order, and types.
Recommended contract
- Removing a projected column changes the relational view shape. Retain its JSON key by default; this alone neither requires a data migration nor emits M53030. Update the view and remove only indexes whose ownership/reference inventory proves they are no longer needed by any retained declaration.
- Deleting retained JSON data is a separately requested semantic migration. Require an explicit core.migrations.RemoveField plan before deleting it. Apply the normal data-deletion acknowledgement and validation contract. M53030 remains Error when a plan requests removal of stored field data without its required migration; it must not diagnose mere column hiding.
- Prefer CREATE OR REPLACE VIEW for additions satisfying PostgreSQL’s existing-column constraints. Preserve ownership, grants, security options, and approved dependency semantics; verify these after replacement.
- When replacement requires drop/recreate, enumerate the complete dependent object closure before mutations. Drop dependents before dependencies and recreate dependencies before dependents in a deterministic order within the approved installation transaction.
- Fail planning if a dependent object is unowned or cannot be reconstructed from the plan. Use explicit ordered drops with RESTRICT to catch inventory drift. Do not issue broad CASCADE and silently discard unmanaged objects.
- A failure rolls back the whole approved transaction, including grants and definitions. If the dependency closure crosses module ownership, reject the plan until the canonical installer supplies an authorized atomic scope; this proposal does not silently enlarge module transactions.
Concurrent index creation remains subject to the pending RFC-0054 execution contract. This proposal does not authorize an out-of-transaction install phase or change the destructive-operation classification.
Exact changes after approval
- RFC-0053 §9.1: replace automatic cascade prose and unconditional drop example with constrained replacement and inventoried drop/recreate paths.
- RFC-0053 §9.2: distinguish column hiding, index ownership, and requested stored-data deletion.
- Lean M53030 and its claim: diagnose missing semantic data-deletion migration rather than every projected column removal.
- Lean example/catalog statements, generated references, and authored RDF: propagate these contracts without changing unrelated type or security facts.
Acceptance
- Remove a column while retaining its JSON key; verify no M53030 and no data mutation. Request data deletion without a migration; verify M53030.
- Apply an explicit acknowledged RemoveField migration and verify only its intended field data is removed.
- Append a compatible column without losing dependent views, grants, owner, or security options.
- Rebuild a declared dependency chain for a shape change, including a retained index referenced by another declaration.
- Reject an unmanaged dependent before mutation; introduce dependency drift after planning and verify RESTRICT causes rollback.
- Inject a recreate failure and verify every definition and privilege is restored, with no committed partial module state.
- Run Lean/reference/projection drift and reviewed-query gates. Resolve any cross-module transaction scope with the installer owner before claiming support for that closure.