| EX-TENANT-1 | Recorded observation |
|---|---|
| Required denial | Return 403 and preserve all stored document rows. |
| Old path | 403; label remains quarterly. |
| Candidate path | 403; label becomes revised. |
| Decision | Reject the candidate; repair and rerun remain open. |
The requirement and decision authority are fictional teaching records. The stored-state difference is a retained local execution observation. Inspect the result JSON.
01 / The promise across the transition
What must a database or API migration preserve?
Migration acceptance asks whether a particular transition preserves the behavior the project has agreed to support. The answer includes the intermediate states: an old worker running against an expanded schema, a partially copied population receiving new writes, or an old binary restarted after the candidate has written a new representation.
Define the promise in terms a consumer can observe. It might concern an authorization decision, a stored balance, an ordering rule, a supported payload, a retry’s effect or an operational limit. If the representation changes, describe how old and new records express the same logical state. Byte equality is only appropriate when those bytes are themselves the contract.
Four scopes that need different evidence
| Migration scope | What changes | Evidence to plan |
|---|---|---|
| API implementation cutover | The code serving an existing operation. | Required responses, rejection behavior, durable effects and supported callers, against identifiable old and candidate revisions. |
| Schema evolution | Tables, columns, constraints, indexes or other database structures. | Actual reader and writer compatibility at intermediate schemas, exact DDL behavior and operational impact. |
| Data or store migration | Existing records move or change representation. | Transformation correctness, population completeness, change ordering, reconciliation at a declared point and recovery from partial progress. |
| Engine or wire-format change | Storage semantics, database versions, snapshots, serialization or protocol representation. | Supported version combinations, read and write semantics, format compatibility, rollout controls and recovery on the actual platforms. |
One project can include all four. A Python handler test against SQLite exercises a narrow part of the first scope. It cannot supply evidence for the other three.
Also distinguish preserved behavior from authorized change. Correcting an old defect may require deliberately different output and a consumer transition plan. The old implementation helps reveal differences; the requirement and designated owner determine their meaning.
The differential-testing guide explains the general paired-computation method, comparators and tolerances. Here, the question is what that evidence permits during a migration, including what happens to data when the next phase fails.
02 / Start with the cutover record
Free migration acceptance worksheet
Copy these records into an issue, repository document or release review. They are an original planning worksheet, usable without Proof. Start with one consequential promise and the next phase you intend to enter, then add the obligations needed to support that decision.
Use actual revision identifiers and evidence locations. An empty field is unfinished work. “Not applicable” needs a reason and, where relevant, a deployment control that prevents the unsupported state.
Copyable migration and recovery record
MIGRATION BASIS
Migration ID and record revision:
Purpose and migration scopes:
Old code/build, schema, data-format and configuration identities:
Candidate code/build, schema, data-format and configuration identities:
Old and candidate entrypoints; adapter/migration-tool revisions:
Environment, engine versions, regions and endpoints:
Included population, tenants/key ranges and explicit exclusions:
Requirement sources, revisions and owners:
Preserved promises:
Intentional changes and their approval records:
Comparison phase: entry, exit and conditions that reopen it:
AUTHORITY
Promise owner:
Evidence executor and reviewer:
Authority to approve the next phase:
Operator authorized to pause traffic or migration work:
Authority and operator for recovery:
Authority to resume service:
Required separation of these roles:
CONSUMERS AND STATE
Supported web/API binaries, workers, delayed jobs and scheduled tasks:
Supported clients, integrations, CLI tools, views and exports:
Recovery binaries, restore tools and replay consumers:
Consumer inventory revision and compatibility-cell records:
Unsupported combinations and how deployment prevents them:
Authoritative store and write owner during each phase:
Equivalent starting state, snapshot or event watermark:
How that alignment is established and checked:
Old-to-new logical-state mapping and its revision:
Treatment of concurrent inserts, updates, deletes and retries:
Observation boundary: responses, errors, rows and external effects:
Capture point and evidence that asynchronous work has completed:
COMPARISON AND EXECUTION
Independent expected results and their approved basis:
Normal, denial, boundary, interruption and retry cases:
Controls proving both real entrypoints ran:
Known-mismatch and invalid-observation controls:
Permitted normalization, validation preconditions and approving owner:
Fields and effects that must never be discarded:
Enforced containment for writes, events, email, payments and retries:
Procedure, command, runtime and tool versions:
Required case/obligation IDs and completion rule:
Evidence location, retention and access:
OPERATIONS AND PHASE GATES
Selected phases and reasons for any omitted phase:
Required evidence IDs for each phase:
Workload, data volume and measurement environment:
Lock acquisition wait criterion:
Acquired-lock hold and transaction-duration criteria:
Latency, error, resource-load and replication-lag criteria:
Pause trigger, observation source and responsible operator:
Reads, writes and migration work allowed while paused:
Abort/cleanup/retry behavior:
Resume criteria, rechecks and decision authority:
RECOVERY
First write or schema step that prevents an easy return:
Recovery action selected for each phase:
Old-code compatibility with post-switch schema and records:
Retained source/copies/backups; recovery point and access:
Preservation criterion for acknowledged post-switch writes:
Durable change capture, ordering and replay watermark:
Reverse mapping or forward repair for new-format records:
Duplicate/conflict handling and external-effect reconciliation:
How writes arriving during recovery are stopped, buffered or reconciled:
Recovery-time criterion and dependencies:
Rehearsal procedure, environment, results and unresolved gaps:
Retention expiry and authority to remove recovery data:
RESULTS AND CLOSEOUT
Scheduled cases, actual calls and valid comparisons:
Passes, failures, skips, unsupported cases and harness errors:
Raw observations, run/review identities and source/input digests:
Discrepancy records, owners and dispositions:
Evidence freshness or justified reuse:
Next phase requested:
Decision: NOT ASSESSED / ADVANCE / PAUSE / REJECT:
Decision authority, evidence basis, scope and conditions:
Approved exceptions, expiry and revisit triggers:
Remaining work and accountable owners:
Final deployed versions and retired consumers:
Temporary routes/guards to remove and evidence to retain:
Initial evidence status: NOT RUN.
Initial phase decision: NOT ASSESSED.
No cutover acceptance is implied by completing this form.
Do not put “rollback available” in the recovery field without describing what happens to new writes. A useful record identifies the retained data, the recovery procedure, its authority and the observations that would demonstrate preservation.
Compatibility and consumer matrix
S0 means the original schema; S1 means the expanded schema; S2 means the contracted schema. Replace these planning names with actual revisions. The cells below identify questions to answer, not passing results.
| Reader or writer | S0: original | S1: old data | S1: backfill and live writes | S1: after switch and new writes | S2: contracted |
|---|---|---|---|---|---|
| Supported old application | Establish baseline. | Check if coexisting. | Check actual reads and writes. | Check if still live or used for recovery. | Retire or adapt before incompatible removal. |
| Candidate application | Declare whether supported. | Check rollout entry state. | Check mixed representations. | Check current reads and writes. | Check the final supported state. |
| Workers, delayed jobs and scheduled tasks | List actual versions. | Exercise old payloads. | Exercise retries and ordering. | Account for work queued before switching. | Retire or adapt every remaining dependency. |
| Clients, integrations, CLI tools, views and exports | Record supported contracts. | Check affected interfaces. | Check mapping and visibility. | Check new-format behavior. | Establish compatibility or explicit retirement. |
| Recovery and replay tools | Establish recovery baseline. | Exercise partial-step recovery. | Preserve partial progress and live changes. | Preserve acknowledged new writes. | Reassess recovery after removal. |
Not every cell must be supported. For example, a candidate may deliberately require S1 and never support S0. The deployment order must enforce that boundary. A missing test is different from a prohibited combination.
For each required or prohibited cell, copy this record. Separate reads and writes where they have different results.
COMPATIBILITY CELL
Consumer ID, role, version and owner:
Phase, schema revision and data-format revision:
Read operations and expected results:
Write operations, defaults and expected effects:
Queued/retried payload versions:
Required or intentionally unsupported:
If unsupported, reason and enforced deployment restriction:
Case/procedure IDs and environment:
Observed result and evidence:
Evidence status:
Reviewer and decision:
Recheck trigger:
Record an obligation and its phase decision separately
A passing case can support an obligation without completing the next phase. Use an obligation record for a test, review, reconciliation or rehearsal, and a gate record for the decision.
EVIDENCE OBLIGATION
ID and requirement revision:
Phase and consumer/schema/data combination:
Claim to establish:
Method and procedure revision:
Input, starting state and dependencies:
Expected observations and independent basis:
Executor, reviewer and environment:
Required evidence and completion rule:
Old raw observations and evidence identity, where comparing paths:
Candidate raw observations and evidence identity:
Paired comparison result and comparison-rule revision:
Independent expectation result for each path:
Required cases, actual invocations and usable comparisons:
Skipped, missing or invalid work and reasons:
Run/review identity, results and artifact references:
Status: NOT RUN / PARTIAL / FAILED / BLOCKED / STALE / SUPPORTED:
Discrepancy ID and accountable owner:
DISCREPANCY AND DISPOSITION
ID, affected requirement/phase and evidence references:
Comparison validity assessment:
Classification against the approved promise:
Serving and write policy while unresolved:
Repair, recheck or contract amendment required:
Disposition authority, decision, scope and conditions:
Exception expiry and revisit trigger, if authorized:
Owner and remaining work:
PHASE GATE
From phase and requested next phase:
Required obligation IDs:
Current evidence and compatibility-cell results:
Unresolved differences and their dispositions:
Operational pause criteria and observer:
Recovery action valid for the state this phase will create:
Post-switch-write preservation and rehearsal evidence:
Decision: NOT ASSESSED / ADVANCE / PAUSE / REJECT:
Authority, recorded basis and conditions:
Resume rule and required rechecks:
Exception scope, owner, expiry and revisit trigger, if authorized:
The procedure shows how to use these records. The next section fills a bounded specimen without inventing a completed database rollout.
03 / A failure you can reproduce
Both handlers return 403. One has already committed the update.
The retained teaching fixture simulates an API implementation replacement using local Python functions and separate temporary SQLite databases. It does not send HTTP requests to a network service or migrate a production schema.
Its authored contract, EX-TENANT-1, allows an owner to change its document’s label. A foreign tenant must receive 403 and leave all stored document rows unchanged. The authority is a fictional service owner created for the example.
Each path and case begins independently with the row [1, "alpha", "quarterly"]. The fields are document ID, owner and label. The authorized call does not prepare the database for the denied call.
Inputs and required results
| Case | Request | Independent expected status | Independent expected stored rows |
|---|---|---|---|
own_tenant
|
Tenant alpha changes document 1 to revised. |
200 |
[[1, "alpha", "revised"]]
|
other_tenant
|
Tenant beta requests the same change. |
403 |
[[1, "alpha", "quarterly"]]
|
The expected results come from the authored promise and cases. They are not inferred from whichever implementation was written first.
The fault is the order of authorization and commitment
| Path | Order in the teaching implementation |
|---|---|
| Old | Read ownership; reject a foreign tenant before mutation; otherwise update, commit and respond. |
| Candidate | Update and commit; then inspect ownership and possibly reject. |
For the foreign-tenant request, the rejection comes too late to prevent the candidate’s committed update. The runner closes the operation connection and reads ordered rows through a fresh connection. Python’s sqlite3 tutorial documents this commit, close, reopen and read mechanism. This observation does not test crash recovery or another engine’s durability behavior.
Exact retained observations for the failed case
| Observation | Old path | Candidate path |
|---|---|---|
| Response status | 403 | 403 |
| Response error |
forbidden
|
forbidden
|
| Request ID |
old-other_tenant
|
new-other_tenant
|
| Rows read through the fresh connection |
[[1, "alpha", "quarterly"]]
|
[[1, "alpha", "revised"]]
|
| Status/state expectation | Met for this case. | Failed: a rejected request changed another tenant’s row. |
The authorized control returns 200 and stores revised on both paths. Across the two cases and two implementations, the migration portion records four local calls. The old path meets both selected status/state expectations; the candidate meets one and fails one. Retained observations.
The independent assertions check status and stored rows. Error text is captured, but this fixture does not independently validate every error semantic, information-leakage property or authorization path. The precise unchanged-rows obligation belongs to EX-TENANT-1. OWASP’s authorization guidance supports checking permissions and handling denial safely; it does not make every 403 response evidence of unchanged state.
Keep the failure visible through normalization
| Comparison | Owner update | Foreign-tenant update |
|---|---|---|
| Raw response and stored rows | Unequal because request IDs differ. | Unequal IDs and stored labels. |
| Validate nonempty request IDs; remove only their exact values | Agreement. | Disagreement exposes the stored-state violation. |
| Drop request IDs and all durable rows | Apparent agreement. | One false agreement conceals the violation. |
The deliberately dangerous comparator does not validate request IDs itself. The retained IDs happen to be valid. The permitted comparator checks them first and retains the remaining response and all observed durable rows.
The fictional disposition record permits the narrow request-ID variation and rejects removal of stored-state observations. It rejects the candidate. A real migration needs corresponding authority from its actual requirement owner.
Inspect the existing result JSON · Get the runnable ZIP · Check the ZIP digest · Read the README
A filled decision record, with the open work intact
This is a summary of the retained teaching evidence in the worksheet’s terms, not a new execution or production approval.
migration_scope: API implementation cutover teaching fixture
requirement: EX-TENANT-1
authority: Fictional service owner
old_path: Archived old implementation in migration.py
candidate_path: Archived faulty candidate in migration.py
source_basis: Archived source/input hashes recorded in results/results.json
comparison_phase: Before accepting the candidate replacement
phase_exit: Not reached; candidate rejected
starting_rows_per_independent_call:
- [1, alpha, quarterly]
capture_point: Fresh connection after the operation connection closes
normalization:
request_id: Nonempty string required; exact value ignored
retained: Remaining response fields and ordered durable rows
cases:
- own_tenant
- other_tenant
local_migration_calls: 4
independent_status_and_state_checks:
old: 2 of 2 passed
candidate: 1 of 2 passed
permitted_comparison:
own_tenant: agrees
other_tenant: disagrees
dangerous_comparison_false_agreements: 1
candidate_accepted: false
repair_status: Proposed; no repaired candidate executed
schema_rollout: Not run; outside fixture scope
backfill_and_reconciliation: Not run; outside fixture scope
lock_load_and_failover_checks: Not run; outside fixture scope
recovery_rehearsal: Not performed
release_authorization: No real release decision
Proposed repair: authorize before writing, then obtain new evidence
For this sequential fixture, the proposed correction is:
Read the document owner.
If the requester is not that owner:
return 403 without changing document rows.
Otherwise:
update the label;
commit the authorized update;
return 200.
No repaired candidate has been executed. The expected repaired foreign-tenant result is 403 with the original row. Agreement on both selected cases is an expectation to check, not an observed result.
A concurrent service needs more than an earlier ownership read followed by an unconditional write. Enforce the protected predicate atomically at the mutation boundary using the actual store’s appropriate conditional-write, transaction or locking design. Test affected-row outcomes, denied effects and concurrent ownership changes separately. Moving the check explains this sequential ordering fault; it does not establish production tenant isolation.
The archive records the failure on 3 October 2026. A separate isolated rerun on 27 October reproduces the same migration-report subtree. Neither contains a repaired run. Provenance and commands.
Follow the cutover decision in six steps
Download the complete video transcript.
Read the complete video transcript
Before a cutover, name the behavior that must survive and who can approve the next phase. In this teaching contract, an owner may update its document. A request from another tenant must return 403 and leave stored document rows unchanged. The authority is fictional.
The retained example runs two selected cases through two local Python handlers. Each call starts with its own SQLite database containing document one, owned by alpha, with label quarterly. Two cases through two paths produce four local calls. No network service or production schema migration is exercised.
For the foreign tenant, both handlers return 403 and forbidden. The old path leaves quarterly in storage. The candidate leaves revised because it commits before checking ownership. A fresh connection reads those committed rows. Matching rejection responses therefore conceal a concrete violation of the authored promise.
The permitted comparison validates each request ID as a nonempty string, then ignores only its exact value. It retains the response and durable rows. The authorized case agrees; the foreign-tenant case disagrees. A dangerous comparison that drops the rows produces one false agreement and hides the violation.
The candidate is rejected. Checking ownership before writing is the proposed correction for this sequential example, but no repaired candidate has been executed. A concurrent service needs atomic enforcement at the mutation boundary and separate tests. A successful teaching-runner exit means the expected failure contrast reproduced.
For an actual migration, fill the consumer matrix and require evidence for the relevant schema, backfill and switch phases. Before the real switch, rehearse recovery after representative candidate writes in the rehearsal environment. Record who may pause, recover and resume. These checks remain outside the fixture; its four calls cannot approve a production cutover.
Read the text walkthrough
This walkthrough explains the retained observations and proposed work. The narration adds no execution evidence.
-
Name the promise. Before a cutover, name the behavior that must survive and who can approve the next phase. In this teaching contract, an owner may update its document. A request from another tenant must return 403 and leave stored document rows unchanged. The authority is fictional.
-
Prepare comparable state. The retained example runs two selected cases through two local Python handlers. Each call starts with its own SQLite database containing document one, owned by alpha, with label quarterly. Two cases through two paths produce four local calls. No network service or production schema migration is exercised.
-
Read beyond the rejection. For the foreign tenant, both handlers return 403 and forbidden. The old path leaves quarterly in storage. The candidate leaves revised because it commits before checking ownership. A fresh connection reads those committed rows. Matching rejection responses therefore conceal a concrete violation of the authored promise.
-
Preserve the decisive observation. The permitted comparison validates each request ID as a nonempty string, then ignores only its exact value. It retains the response and durable rows. The authorized case agrees; the foreign-tenant case disagrees. A dangerous comparison that drops the rows produces one false agreement and hides the violation.
-
Keep the repair open. The candidate is rejected. Checking ownership before writing is the proposed correction for this sequential example, but no repaired candidate has been executed. A concurrent service needs atomic enforcement at the mutation boundary and separate tests. A successful teaching-runner exit means the expected failure contrast reproduced.
-
Apply the real phase gates. For an actual migration, fill the consumer matrix and require evidence for the relevant schema, backfill and switch phases. Before the real switch, rehearse recovery after representative candidate writes in the rehearsal environment. Record who may pause, recover and resume. These checks remain outside the fixture; its four calls cannot approve a production cutover.
04 / The working method
How to build evidence for each migration phase
Begin with the next decision, then work backward to the evidence it needs. A plan may use expansion, backfill, switching and contraction, but an API-only change need not invent DDL work. Mark omitted phases explicitly and retain the evidence for the scopes that actually change.
1. Baseline the preserved promises and authority
Record old and candidate code, schema, data-format and configuration identities. List intended changes separately from preserved behavior. Turn each consequential promise into an observable criterion with an independent basis.
For a denied update, that might be a specified response and unchanged protected rows. For a data transformation, it might be preservation of each account’s logical balance and transaction history. For an operational claim, it needs the workload, measurement window, budget and stop action.
Assign the people or configured authorities who may amend the requirement, assess evidence, advance the rollout, invoke recovery and resume service. These powers can belong to different roles. An unresolved expectation blocks an acceptance claim until its owner resolves it.
2. Inventory consumers and choose the phase gates
List running and supported versions, including old jobs that have not yet executed. Add database views, exports, scripts and the tools you expect to use during recovery. For each matrix cell, decide whether the combination is required or prohibited and how that decision is enforced.
GitLab provides a concrete reason to inspect more than visible application reads: its Rails processes cache schema information, and views can retain column dependencies. Its column-removal procedure separates ignoring, dropping and removing the ignore rule across releases. That sequence belongs to GitLab’s deployment model, not a universal release count. GitLab: avoiding downtime.
Set the recovery action and its prerequisites while planning each phase. Obtain the necessary recovery evidence before creating that phase’s state, especially before an incompatible write or destructive operation.
| Phase | Evidence required before advancing | Pause or reject when | Recovery question |
|---|---|---|---|
| Plan and baseline | Approved promises, identifiable revisions, consumer inventory, credible checks and recovery design. | Intent, ownership, consumers or containment remain unresolved. | What state can be recovered before any change? |
| Expand | Reviewed exact DDL; supported readers and writers exercised; relevant operational and partial-failure checks. | A required consumer fails, a budget is exceeded or a partial change has no assessed recovery. | Can the old path operate on the state actually left behind? |
| Backfill and reconcile | Defined population and mapping; observed progress, discrepancy accounting and live-change handling through the chosen anchor. | Data is lost or duplicated, required population is unvalidated, or lag/load exceeds its criterion. | How will partial progress and acknowledged concurrent writes survive? |
| Switch | Current behavioral, compatibility, data and operational evidence; reviewed dispositions; valid recovery rehearsal; explicit decision. | A required gate fails, evidence is missing or recovery would discard acknowledged writes. | Can old code consume current data after candidate writes? |
| Contract | Evidence that supported and deferred consumers no longer need the old representation; final validation and retention decision. | Old jobs remain or recovery still depends on data about to be removed. | Which recovery options remain after removal? |
| Closeout | Deployed identities, residual work, evidence retention, recovery-data expiry and temporary-route cleanup. | A dependency or exception has disappeared from the record without resolution. | What remains recoverable, by whom and until when? |
These are proposed gates to tailor. None was exercised as a production rollout by the teaching fixture.
3. Establish comparable state and enforce replay containment
For independent cases, initialize equivalent isolated stores. For a sequence, replay the same reviewed history and compare at specified milestones. For a live comparison, identify the actual snapshot, object version or event watermark and demonstrate that both observations refer to it.
PostgreSQL 18 Read Committed can give successive statements different committed views, even within one transaction. Similar timestamps or two independently started transactions do not establish identical state. PostgreSQL 18: transaction isolation.
Choose alignment deliberately: a suitable shared snapshot mechanism, a retained event prefix, a controlled pause or another validated method. If alignment fails, report an invalid comparison or an unmet freshness obligation. Do not remove inconvenient rows to manufacture agreement.
Before replaying writes, enforce the containment boundary. Use isolated databases and controlled event or external-service destinations, with credentials and routing that prevent unintended live effects. Cover background workers, retries and outbox delivery as well as the foreground request. Confirm containment with a control before expanding the workload.
Running a mutating request twice against live state can duplicate effects. A feature flag that chooses which response the caller sees does not, by itself, prevent the other path from committing or sending an event. Keep actual capture and containment mechanisms in the record.
4. Exercise the actual schema operation and its operational effects
Inspect the exact engine, version, DDL subform and transaction context. PostgreSQL 18 normally uses ACCESS EXCLUSIVE for ALTER TABLE unless a subform specifies otherwise; some changes rewrite stored data. An additive change is not automatically cheap or compatible with every old consumer. PostgreSQL 18: ALTER TABLE.
Separate constraint installation from completed validation. For eligible foreign-key, check and not-null constraints, NOT VALID skips the initial existing-row scan while subsequent inserts and updates are constrained. Existing rows remain unvalidated until validation succeeds. VALIDATE CONSTRAINT itself acquires SHARE UPDATE EXCLUSIVE. PostgreSQL 18: constraint operations.
Choose explicit budgets and measure them under a relevant workload:
| Interval or effect | What to record |
|---|---|
| Lock acquisition waiting | Which operation waits, the configured wait policy and observed wait. |
| Time holding acquired locks | Actual hold interval, affected operations and cleanup behavior. |
| Statement and transaction duration | Start/end, cancellation or rollback behavior, connection state and retry policy. |
| Service impact | Latency, errors, resource use and replication lag for the declared workload. |
PostgreSQL lock_timeout bounds waiting separately for each lock acquisition attempt. It does not bound the time holding an acquired lock. Statement and transaction timeouts concern different intervals; none supplies an unmeasured service-latency guarantee. PostgreSQL 18: timeout settings.
No lock, load or DDL measurement is supplied by the SQLite API example. Keep those obligations open until their own evidence exists.
5. Reconcile the backfill, including changes made while it runs
Define the source population by keys, ranges, tenants or another stable selection rule. Record the transformation and the logical properties it must preserve. Count required, copied, checked, mismatched, skipped and pending work separately. Equal row counts can coexist with missing keys, duplicates or wrong values.
Specify what happens if a live update races with the copy, if a row is deleted, if a worker retries or if the process stops midway. A resumable checkpoint must identify what was completed and what remains. Test that restarting cannot silently skip a range or replay an effect twice.
Choose a cutover anchor and establish that the target represents the required changes through it. Keep a rule for writes arriving afterward. A statement that copying finished is incomplete without the population, alignment point and treatment of concurrent changes.
AWS DMS illustrates why validation needs its own accounting: it reports pending, failed and suspended work, has eligibility restrictions such as a primary key or unique index, and consumes source, target and network resources. Continuously changing rows may remain unvalidated; independent application writes to the target can make discrepancy reporting inaccurate. AWS DMS: data validation.
Treat those limits as inputs to the chosen DMS configuration and cutover design. Row validation also leaves application authorization, external effects and intended transformation semantics to their own checks.
6. Rehearse recovery with post-switch writes before approving the switch
Define the point at which restarting old code stops being a sufficient recovery action. It may be the first new-format write, a change in the authoritative store or removal of the old representation. Rehearse the failure on both sides of that point in an appropriate environment.
The recovery record should distinguish these actions:
| Action | What it changes | What the rehearsal must establish |
|---|---|---|
| Code rollback | Routes traffic to, or restarts, an earlier application revision. | That revision can use the current schema and all data it must serve, including post-switch writes. |
| Schema reversal | Applies a reverse structural or representation change. | The reverse mapping preserves required information and remains compatible with active writers and consumers. |
| Restore | Rebuilds data from a retained backup or recovery point. | Later acknowledged writes are accounted for and reapplied or reconciled through a tested preservation mechanism. |
| Compensating repair | Corrects identified effects using new operations. | The repair targets the right records, preserves legitimate concurrent changes and handles related external effects. |
| Roll-forward | Deploys a correction while continuing from the changed state. | The correction works on actual mixed or damaged state and completes the required reconciliation. |
GitLab’s guide distinguishes reversible migrations from its production recovery practices: its production environments use roll-forward, while its Self-Managed downgrade advice involves restoring a backup. It also recognizes information-losing transformations that cannot be undone. Those are GitLab’s practices, not instructions to choose the same recovery action everywhere. GitLab: migration reversibility.
For your project, require an explicit preservation path for writes acknowledged after switching. Identify the authoritative records, durable change capture, ordering, retained formats, replay watermark, duplicate/conflict rules and handling of writes arriving during recovery. Reconcile related events or external effects as required by the promise.
A backup from before the switch does not, by itself, contain later writes. That is why the rehearsal must include successful candidate writes before the injected failure. Restore or redirect, replay or repair as planned, then verify the resulting logical state and supported consumers. Record elapsed time, failures, operator actions and remaining gaps.
If the team cannot account for those writes, the preservation gate remains open. A runbook document or a booted old binary is insufficient evidence.
7. Resolve discrepancies and record the switch decision
First establish that the comparison was valid. Then judge each observation against the requirement and record the migration consequence.
| Finding | Disposition | Consequence for the next phase |
|---|---|---|
| Candidate violates a preserved promise. | Replacement regression. | Reject or pause; repair and renew the affected evidence. |
| Candidate corrects an old defect. | Existing defect corrected. | Verify the corrected rule and assess consumers relying on the old behavior. |
| An approved amendment requires the difference. | Intentional change. | Verify the changed contract and its transition plan. |
| The contract permits this exact variation. | Permitted variation. | Apply the authorized narrow comparison rule after its preconditions pass. |
| Input, state, execution or capture was invalid. | Invalid comparison or harness failure. | Repair the setup; do not count it as a successful comparison. |
| No approved rule resolves the difference. | Unresolved intent. | Keep the gate open and obtain the named owner’s decision. |
Agreement can also accompany a shared requirement failure. Retain both the paired result and the independent check. Neither a high agreement percentage nor a successful process exit can erase a failed obligation.
For every material difference, preserve its input/state, revisions, raw observations, requirement, classification, owner and disposition. If an exception is permitted, record its scope, rationale, expiry and authority without relabeling the failed observation as passed.
The switch decision should name the evidence reviewed, the exact phase allowed, the recovery action still valid and the pause/resume conditions. The fixture records candidate_accepted: false. That recorded rejection belongs to its fictional teaching contract and is not a production release decision.
8. Contract only after retirement and recovery are established
Before removing an old field, table, format or path, establish that supported readers, writers, delayed jobs and recovery tooling no longer depend on it. Confirm retention and replay requirements before deleting the source or the change history needed for recovery.
Stripe’s original account, published 2 February 2017, describes a particular subscriptions migration using dual writes, backfill, read switching, write switching and eventual old-data removal. It is a useful historical staged example. It does not establish consistency for an arbitrary dual-write design or supply a current benchmark. Stripe: Online migrations at scale.
Your design still needs to handle failure between writes, ordering, replay and reconciliation. Record the final deployed inventory, remaining exceptions, evidence locations and removal of temporary paths. A later consumer, schema, requirement or comparison change can reopen affected obligations.
05 / Check readiness and remaining work
Migration checklist: before the run and before the next phase
A ready environment, a passing check and an authorized cutover are separate states. Use this checklist against the current worksheet and evidence, not from memory.
Before execution
- The old and candidate revisions, requirement and phase are identifiable.
- Required consumers and intermediate schema/data combinations are recorded.
- Inputs, state alignment, independent expectations and capture points are reviewed.
- Both real entrypoints can be reached, and known mismatches cannot disappear.
- Mutating calls and external effects have enforced containment.
- Operational stop conditions, recovery prerequisites and accountable operators are ready.
Before advancing
- Every required obligation has current evidence or an explicitly authorized disposition.
- Executed calls, usable comparisons, skips, invalid runs and missing work are accounted for.
- Responses, persisted state and required external effects satisfy the declared criteria.
- Compatibility and reconciliation refer to the actual phase and population.
- Recovery has been exercised with the writes and formats that this phase can create.
- The designated authority records advance, pause or rejection and the conditions for resuming.
Keep evidence status separate from the phase decision
| Evidence status | Meaning |
|---|---|
| Not run | The required observation or review has not occurred. |
| Partial | Only part of the required evidence exists. |
| Failed | An observation violates its criterion. |
| Blocked or invalid | A prerequisite or harness problem prevents a credible conclusion. |
| Stale | The evidence basis changed and reuse has not been justified. |
| Supported | The required current evidence meets this obligation’s declared rule. |
| Not applicable, with reason | The obligation does not apply to the documented scope; any required prevention control is recorded. |
An approved exception is a disposition. It does not change what the test observed. “Supported” applies to the named obligation; it does not silently approve the whole migration.
Ten catalog prompts to assess, not ten completed controls
The following Proof migration-catalog labels help identify work. The teaching fixture establishes none of these ten as satisfied. For each applicable prompt, create an evidence obligation; otherwise record the scope reason. The labels are not independently verified standards controls or compliance mappings.
| Catalog prompt | When to ask | Evidence still needed beyond this fixture |
|---|---|---|
cross_engine_rollout_guarded
|
Engines or storage versions coexist during rollout. | Actual supported combinations, rollout guards and cutover observations. |
forward_compatible
|
Old and new code use evolving schemas. | Reader and writer results across supported intermediate states. |
hash_format_deterministic
|
Hashes, identifiers or canonical encoding cross the change. | Versioned encoding rules and cross-version test vectors. |
locks_bounded
|
DDL or migration work contends with traffic. | Wait, hold, transaction and load measurements with enforced responses. |
resource_lifetime_released
|
Migration work owns connections, handles or long-running resources. | Cleanup observations after success, failure and cancellation. |
reversible_or_documented
|
Recovery may be needed after a change. | The selected reverse, restore, compensating or forward procedure and preservation rehearsal. |
snapshot_consistency_anchor_declared
|
Copying or comparison relies on a snapshot or event boundary. | Actual anchor identity, alignment and convergence evidence. |
snapshot_wire_format_compatible
|
Snapshots cross binary or storage-format versions. | Producer/consumer format results and rejection or upgrade behavior. |
state_rewrite_preserves_logical_state
|
Stored representation is transformed. | Logical-state mapping, boundaries, partial failures and retry results. |
storage_read_semantics_preserved
|
Read paths, engines or layouts change. | Required visibility, ordering, missing-value and related read semantics. |
The two selected API cases support their own agreement and denial observations. They do not complete a schema-compatibility assessment, a full authorization suite or the database-migration catalog.
06 / Avoid a misleading green result
Migration testing mistakes and what they cost
| Mistake | Consequence | Correction |
|---|---|---|
| Approve on matching response codes. | A denied operation can still change data. | Assert the required durable and external effects. |
| Treat the old implementation as unquestionable authority. | Old defects become accidental requirements. | Use approved expectations and assess consumer dependencies. |
| Replay both write paths against live destinations. | Comparison can duplicate writes, events or other effects. | Enforce isolation and controlled destinations before replay. |
| Test only the new web binary. | Old workers, queued jobs or recovery code fail later. | Exercise actual supported readers and writers across phases. |
| Call equal counts a reconciled backfill. | Missing keys and incorrect values remain hidden. | Account for the population and verify its logical mapping at a declared anchor. |
| Treat installed constraints as fully validated. | Existing bad rows can remain unexamined. | Retain a separate validation obligation and result. |
| Use a lock-wait setting as a lock-hold guarantee. | An acquired lock can still block traffic beyond the intended budget. | Measure the distinct intervals and test the stop/cleanup response. |
| Say “rollback” without accounting for new writes. | Recovery returns service while losing acknowledged work. | Select the actual recovery action and rehearse preservation. |
| Treat a zero exit code or empty campaign as acceptance. | Expected failures or missing comparisons appear green. | Inspect substantive results and require a separate phase decision. |
Ask: What could still be wrong if every comparison currently listed agrees? For a migration, the answer often includes unsupported consumers, incomplete data, concurrent changes or recovery after the candidate begins writing.
07 / Keep intent and evidence connected
How Proof fits a migration evidence workflow
Use Proof to connect the preserved promises, affected code and dependencies, planned checks, evidence and known issues. The portal provides project records; MCP brings that context into a coding agent’s workflow. Application checks and migration operations still run through the appropriate repository, CI and database tooling. Proof: Agents and MCP.
A practical migration record should preserve four distinct questions:
| State | Question for this cutover |
|---|---|
| Planned | Which promise, consumer combination and phase does this obligation address? |
| Executed | What ran or was reviewed, on which basis, and what was observed? |
| Current | Does that evidence still apply to the code, schema, data and configuration under review? |
| Accepted | Which designated authority permitted which phase, with what conditions? |
Configure authority deliberately. Proof’s public agent workflow makes requirement approval policy configurable and initially open to agents; human-only requirement approval must be configured. Do not infer a human release approval from an evidence link or an agent’s passing check. Approval policy and execution boundaries.
A configured comparison needs the right observations
The documented differential_conformance check compares proof.fixtures/v1 cases through configured shims. A shim must collect relevant durable effects into its output for those effects to participate in comparison. Registering an API case does not automatically inspect its database or external destinations.
Inspect actual work: empty corpora can pass; incomplete registrations can skip. Only top-level JSON corpus files are read, and malformed fixtures fail before cases execute. Two refusals can count as parity without comparing error text; Python import failures can become refusals. Use independent expectations and expected-success controls that reach the intended code. Documented differential workflow and limits.
Inactive or out-of-scope requirements are filtered when the requirement set loads successfully. On a requirement-loading error, this check does not apply that filter. Check the executed case IDs against the planned requirement scope.
The migration evidence contains no executed Proof audit. Keep the migration-specific operational and recovery gates alongside any configured comparison.
Use Spec Lab for a bounded written decision
For a rule such as “allow this update only when the requester owns the document,” free Spec Lab can help plan reviewable decision cases. Review its interpretation and expected outcomes. It does not execute application code, validate DDL or approve a cutover. A broader migration needs the worksheet and actual evidence.
08 / Choose tools by the claim
Which migration testing workflow should you use?
Choose the workflow that can observe the required behavior in the relevant environment. Several rows may belong in the same migration plan.
| Workflow | Useful question | Evidence it can contribute | What remains with your team |
|---|---|---|---|
| Application integration harness with isolated stores | Does the candidate preserve this operation’s responses and effects? | Real entrypoint observations and independent assertions, as in the SQLite fixture. | Consumer coverage, concurrency, external effects, actual-engine behavior and deployment checks. |
| Engine-native DDL and constraint checks | What does this exact schema operation do? | Version-specific locking, validation and execution observations. PostgreSQL 18 | Representative workload, compatibility, stop criteria and recovery. |
| Versioned migration framework and staged application releases | Can schema and application changes be sequenced for supported versions? | Controlled steps and project-specific upgrade procedures. GitLab’s example | Actual consumer inventory, data mapping and verification of every required state. |
| AWS DMS replication with data validation | Does eligible replicated data match under this task’s rules? | Row-validation results and discrepancy accounting. AWS DMS | Eligibility, task configuration, pending/skipped work, change alignment and API behavior. |
| Controlled read comparison during staged migration | Do old and new read paths agree on the intended data? | Comparisons against live workload, as described in Stripe’s 2017 account. | Comparable state, operational impact and separate protection for any mutating path. |
| Proof requirements and evidence workflow | Which promises, changes, results and unresolved issues inform the decision? | Connected project context and configured checks. Proof | Appropriate execution tools, complete observations, evidence freshness and configured authority. |
This guide is published by Proof and includes its workflow. The comparison is based on documented roles and boundaries, not a comparative performance study. No migration platform was benchmarked for this article.
Take one representative obligation through the complete process before expanding: prepare the state, exercise the real operation, preserve a meaningful failure, inspect the report and rehearse the corresponding recovery. Include environment setup, evidence storage, operational load and maintenance effort in the choice.
For application teams, begin with preserved operations and consumers. For data and platform teams, begin with the population, change stream, operational budgets and recovery boundary. For reviewers, ask whether each claimed result actually supports the next phase recorded in the worksheet.
09 / Evidence behind the guide
Primary sources and reproducible teaching artifacts
External documentation supports the engine semantics, tooling limits and historical migration patterns. The teaching archive supports the concrete denied-write failure. The separate research rerun records the same migration observations under its own execution metadata. These evidence classes remain distinct.
Primary documentation used
| Source | Used for | Boundary |
|---|---|---|
| Python 3.14: sqlite3 | Commit, close, reopen and reread mechanics. | Documentation does not establish that a fixture ran or demonstrate crash recovery. |
| PostgreSQL 18: ALTER TABLE | Operation-specific locks and constraint validation. | Exact engine and operation matter; no DDL was exercised here. |
| PostgreSQL 18: client connection defaults | Distinct lock, statement and transaction timeout semantics. | Settings do not supply measured operational results. |
| PostgreSQL 18: transaction isolation | Read Committed snapshot behavior. | A project still needs an actual alignment mechanism. |
| GitLab: avoiding downtime in migrations | Consumer dependencies and staged schema removal. | GitLab/Rails guidance, not a universal release sequence. |
| GitLab: migration style guide | Reversibility and distinct production recovery choices. | Its operating practices do not select your recovery plan. |
| Stripe: Online migrations at scale | A phased subscriptions migration described on 2 February 2017. | Historical original account; no current performance or availability claim is transferred here. |
| AWS DMS: data validation | Validation states, eligibility, changing-data limitations and resource cost. | Tool-specific comparison, not complete application acceptance. |
| OWASP: authorization guidance | Permission checks and safe handling of failed authorization. | EX-TENANT-1 supplies the fixture’s exact promise; no standards-control mapping is asserted. |
Product scope uses Proof’s Agents and MCP page, Spec Lab, and the differential-testing guide’s documented check boundaries. The linked local Python/SQLite executions do not include a Proof audit.
Reproduce the retained teaching contrast
Download the existing evidence-methods ZIP, compare it with the adjacent SHA-256 file, inspect the README, and extract it. Use Python 3.9 or later with its sqlite3 module. No pip packages, network service or Proof binary are required by this fixture.
From the parent of the extracted evidence-methods directory, run the following commands. Choose a new or empty output directory:
cd evidence-methods
python3 run.py --output rerun-results
The runner refuses to overwrite retained evidence. It also runs a separate token/mutation exercise. Inspect the migration report separately; do not add that exercise’s observations to the four migration calls.
The expected teaching outcome includes the candidate’s one failed requirement case, the dangerous comparator’s one concealed violation and candidate_accepted: false. Exit zero means that this expected contrast reproduced. It does not mean the candidate passed.
Inspect the runner, handler source, requirements, cases, disposition, retained result JSON and result digests. A new run should retain its own command, environment and observations.
Preserve the provenance distinctions
| Evidence | Recorded basis | What it supports |
|---|---|---|
| Archived execution | 3 October 2026, 09:30:30 UTC; Python 3.14.7, SQLite 3.53.4, Darwin/arm64. | The original selected observations and rejected candidate. |
| Separate research rerun | 27 October 2026, 20:28:31.471905 UTC; Python 3.14.7, SQLite 3.53.4, Darwin/arm64. | Exit zero, seven source/input hashes matching the archive and an identical migration-report subtree. |
| Proposed repair and rollout plan | Written explanation, worksheet and gates. | Work to perform; no repaired or production result. |
Inspect the rerun’s checksums and recorded stdout alongside its result.
Recorded command for the separate rerun:
/opt/homebrew/opt/python@3.14/bin/python3.14 run.py --output ../rerun-results
The research rerun used an isolated copy and left the original archive unchanged. The rerun’s complete JSON differs because command, time and runtime metadata belong to that execution; it is not a replacement for the downloadable archive.
Archived results.json SHA-256:
8819dd948702332953a3cf281fe8b70ec7f8a4fa81f2509cda04a9a166596f92
Separate research-rerun results.json SHA-256, listed in its checksums:
7e725cd139954726cd7157668c38a54d749ae906096e63ab93d82ac05aa8a75b
These digests identify bytes. They are not signatures, proof of origin or customer acceptance.
The retained work does not cover network behavior, missing documents, authentication, concurrent ownership changes, retries, outbox effects, DDL, backfill, data volume, locks, load, engine conversion, failover or a recovery rehearsal. Those remain separate evidence obligations where applicable.
10 / Put the gates under pressure
Two migration examples beyond the API fixture
These are planning examples with stated expectations. They are not additional executions or additions to the four-call count.
1. An added column can still leave old writers incompatible
Suppose a project replaces total_cents with amount_minor while preserving the same integer amount and currency. A backfill copies 1,000 into the new field. An old queued worker later updates only total_cents to 1,200.
Keeping both columns does not make the candidate’s read of amount_minor current. The compatibility question includes who keeps the representations aligned and which write is authoritative.
| Planned case | Required observation under this illustrative contract |
|---|---|
| Old worker updates after the row was backfilled. | Candidate reads the current logical amount, 1,200, at the contract’s required completion point. |
| Backfill retries after that update. | It does not overwrite the current amount with stale copied data. |
| Old queued work remains when contraction is requested. | The removal gate stays closed unless that work is retired or adapted and the relevant checks support it. |
The project might choose a synchronization mechanism, a different deployment sequence or an enforced pause. Whichever design it selects needs its own ordering, failure and retry evidence. “Both columns exist” is only a schema observation.
2. Restoring before the switch leaves later writes to recover
Suppose a retained snapshot represents events through 100. After switching, the candidate acknowledges events 101 and 102. A failure then requires recovery.
A restore of the snapshot alone returns to the state through 100. To satisfy a promise that acknowledged writes survive, the plan must preserve and correctly apply 101 and 102, plus account for any new work arriving during recovery.
| Planned recovery check | Evidence required |
|---|---|
| Identify the recovery point. | The restored population and event boundary are known. |
| Recover acknowledged later writes. | Retained records cover 101 and 102 with the required payloads and ordering. |
| Transform or replay them. | The chosen recovery path can represent their logical effects without loss or duplication. |
| Resume supported consumers. | Readers and writers operate on the reconciled state; required external effects are accounted for. |
If old code cannot read the format of event 102, code rollback alone does not meet this plan. A tested reverse mapping, compensating repair or roll-forward may be required. If no preservation path exists, keep the recovery gate unresolved.
11 / Questions at the cutover review
Database and API migration questions, answered
Does an API-only cutover need expand and contract phases?
Only if the change actually requires those schema or representation stages. An implementation replacement still needs its preserved contract, caller inventory, state/effect checks, operational criteria and recovery plan. Mark unrelated phases not applicable with a reason. Do not turn the absence of DDL into a claim that recovery is trivial.
When can we remove the old schema or representation?
When evidence shows that no supported reader, writer, delayed job or recovery path still requires it, and the retention and recovery decision permits removal. Check actual versions and pending work. A deployment date or the new web binary’s successful tests cannot establish that inventory by themselves.
Can we recover by rolling back just the application?
Sometimes, if the old revision remains compatible with the current schema and every record it must handle. Verify that condition after candidate writes. If new formats, changed ownership of writes or removed data break it, choose and rehearse another recovery action. Recovery actions and required evidence.
Does NOT VALID mean the new constraint is ready?
NOT VALID defers eligible existing-row checks. Require completed validation when that is the next phase’s acceptance criterion. PostgreSQL 18: ALTER TABLE.
Is zero reported DMS mismatches enough to switch?
No. Establish the eligible population, pending or suspended work, exclusions and the actual comparison point. AWS documents these validation distinctions and changing-data limits. Then assess the remaining application, compatibility, operational and recovery gates. AWS DMS validation.
Can we shadow live requests that write?
Only with an enforced design for all their effects. An isolated database does not contain an email, payment or worker using live credentials. Define destinations, permissions, retries and background processing, then verify the boundary. A read-comparison pattern does not automatically make duplicate writes safe.
What if the old behavior is undocumented or known to be wrong?
Retain both observations and identify the consumer impact. Use an approved requirement or obtain a decision from its owner. A deliberate correction can be acceptable while still needing a transition plan. The legacy characterization guide covers deciding which observed behavior should be preserved.
How many passing cases establish migration readiness?
There is no universal count. Required evidence follows the preserved promises, supported versions, data population and failure consequences. This fixture’s four calls expose one candidate regression. They establish neither a passing repair nor a completed cutover plan. Missing operational or recovery work stays missing even when every selected application case passes.