feat(migrate): 0.7 migrate gate + canonical engine deprecation (ADR-037)#386
feat(migrate): 0.7 migrate gate + canonical engine deprecation (ADR-037)#386hardbyte wants to merge 2 commits into
Conversation
…ate canonical engine (#370) Implements ADR-037 / roadmap decision D2: - `awa_model::migrations::run` refuses to apply pending migrations unless the storage transition is finalized (state = active) or the install is fresh — mirroring the exact conditions awa.storage_auto_finalize_if_fresh accepts at worker startup (canonical, unprepared, no jobs, no runtime seen in 90s). Nothing is applied on refusal; the new AwaError::StorageNotFinalized error names the finalize steps. - Worker runtimes that resolve to the canonical engine log a startup deprecation warning (removal in 0.8). - TLA+: AwaStorageTransition gains the Migrate07 action, the Migrate07OnlyOnQuiescedCanonical invariant, and an expected-counterexample config (Migrate07Ungated) witnessing the gate; transition model family added to nightly CI. - Docs: full ADR-037, docs/upgrade-0.6-to-0.7.md, pointer from the 0.5→0.6 guide, CHANGELOG breaking-change entry. - Tests: six migrate-gate integration tests; step-through data-survival test reworked to assert the refusal and keep survival coverage via the 0.6-equivalent raw-SQL path.
|
Warning Review limit reached
Next review available in: 55 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (20)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8aa60335c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| no recently-live runtimes) are exempt. See docs/upgrade-0.6-to-0.7.md and \ | ||
| docs/upgrade-0.5-to-0.6.md." | ||
| )] | ||
| StorageNotFinalized { state: String }, |
There was a problem hiding this comment.
Add Python mapping for the new error variant
Adding StorageNotFinalized makes AwaError gain a new concrete variant, but awa-python/src/errors.rs::map_awa_error still exhaustively matches the old set. Any build of the Python extension now fails with a non-exhaustive match when this gate error is reachable from migrate(), which blocks the Python package/nightly maturin develop path; add a Python error mapping for this variant.
Useful? React with 👍 / 👎.
The #370 migrate gate added a new AwaError variant; awa-python's map_awa_error matches exhaustively, so the extension stopped compiling. Expose it as awa.StorageNotFinalized (subclass of AwaError) so Python callers of migrate() get the same operator guidance.
Closes #370. Implements roadmap decision D2 (docs/0.7-roadmap.md, PR #384).
Design
The canonical engine is deprecated in 0.7 and removed in 0.8, so
awa migratemust never land 0.7-era migrations on a cluster that can still route work to it. The gate sits inawa_model::migrations::run(covering the CLI, library callers, TestClient, and Python), evaluates before anything is applied, and admits exactly two shapes:storage_transition_state.state = 'active'.awaschema at all, or canonical + unprepared with zero jobs and no runtime seen in 90s — deliberately the same conditions asawa.storage_auto_finalize_if_fresh, so the migrate gate and the worker-startup auto-finalize door admit the same clusters.Everything else gets
AwaError::StorageNotFinalized, whose message names the exact 0.6 finalize steps and both upgrade guides. Refusal is a no-op: nothing half-applied.--sql/--extract-to(print-only) are unaffected. Runtimes whose effective storage resolves to canonical now log a startup deprecation warning (inlog_transition_startup_status).An alternative — gating only v40+ migrations so a 0.7 binary could still bring a 0.5 schema to v39 — is recorded and rejected in the ADR (splits the operator experience; the applied prefix just duplicates the supported 0.6 binary).
TLA+
correctness/storage/AwaStorageTransition.tlagains aMigrate07action gated byMigrate07GateOpen, a ghost bit recording whether canonical work / canonical-capable runtimes existed at fire time, and the invariantMigrate07OnlyOnQuiescedCanonical:AwaStorageTransition.cfg(gate on): passes, 444 distinct states.AwaStorageTransitionMigrate07Ungated.cfg(gate off): expected counterexample — TLC trips the invariant, witnessing why the gate is load-bearing.AwaStorageTransitionCurrentGate.cfg: still tripsMixedHasQueueExecutor(its historical purpose).The transition model family is now also run in nightly CI (it previously only existed in the docs).
Docs
docs/adr/037-canonical-engine-deprecation.md— full ADR (supersedes the placeholder in docs: add 0.7 planning brief (0.6 recap + open-issue inventory) #384; trivial conflict there indocs/adr/README.mdif this merges second).docs/upgrade-0.6-to-0.7.md— the short guide: the storage step is 'be finalized'.docs/upgrade-0.5-to-0.6.md; CHANGELOG breaking-change entry.Tests
prepared,mixed_transition, and recently-live-runtime (and re-allows once the heartbeat is >90s stale).test_step_through_upgrade_preserves_datareworked: asserts the refusal on canonical-with-data, keeps data-survival coverage via the raw-SQL path (what a 0.6 binary applies), and asserts run() stays a no-op success with no pending migrations.Verification
cargo fmtclean,clippy --all-targets --all-features -D warningsclean.migration_testfull suite: 49/49 pass;storage_finalize_cli_test4/4;sql_only_storage_upgrade_test2/2.