Repository navigation
Rehearse compat claim-slot proofs across a released leader's rotations - #908
Conversation
|
The API added a "Generated by Claude Code" footer to the end of this PR description automatically. It fails the Generated by Claude Code |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Add test_compat_rescue_after_released_leader_rotates_claim_ring to the rolling-upgrade rehearsal. Under compat ring authority, a current runtime leads and proves the sealed claim slots closed. It then loses leadership without restarting, so its proof cache survives. A released 0.6.19 leader rotates the claim ring into a slot, a released claimer takes a claim there and is killed, and the 0.6.19 leader rotates past the slot. Leadership returns to the same current process, which must rescue the dead claim within a bound that ends before any proof it made could expire. The 0.6 rotation is the released artifact's own, not SQL that emulates it. The cell fails without #906's fix: the cached proof hides the dead claim until it expires. mixed_fleet_helper.py gains three opt-in settings the cell uses: MIXED_MAINTENANCE_LEADER, MIXED_HEARTBEAT_STALENESS_MS and MIXED_CLAIM_ROTATE_INTERVAL_MS.
cae2197 to
75e78a3
Compare
f546557 to
10a5e6d
Compare
Stacked on #906. The base is #906's branch, so the diff shows only the new cell. Retarget this PR to
mainonce #906 merges.What the cell does
test_compat_rescue_after_released_leader_rotates_claim_ringadds a rehearsal cell that runs a released 0.6.19 runtime and the current runtime on one database, under compat (columns) ring authority, after a migrate-first upgrade.claim_ring_stateand the rotation ledger that both rotations were 0.6's, and that nothing rescued the claim yet.The released helper gains three opt-in settings:
MIXED_MAINTENANCE_LEADER=0,MIXED_HEARTBEAT_STALENESS_MSandMIXED_CLAIM_ROTATE_INTERVAL_MS. Their defaults are unchanged.Why the SQL emulation was not enough
The unit-level tests emulate a 0.6 rotator with SQL. Before #906 that SQL stamped
claim_ring_slots.generation, because the code assumed 0.6 does. It does not, so the emulation and the code agreed and the tests passed. This cell runs the released artifact's own rotation, so it checks what 0.6 actually writes.One more thing the real binary showed: a 0.6.19 leader whose lock session is terminated keeps rotating for a while. The cell therefore stops released leaders by killing the process, and only terminates the current runtime's lock session.
Evidence
Without #906 (
f546557a'sawa-model/srcchange reverted, so the source matchesf546557a^):CI=1failed the same way at the 9 s bound.With #906:
CI=1passed. Rescue took 986 ms.Runtime
The cell takes about 12 s locally and 16 s with
CI=1. About 7 s of that is the released install and the migration.CI placement
Today the rehearsal runs only in
release-gate.yml, on manual dispatch and fromrelease.ymlon tag push. A regression like the one #906 fixes would surface only at release time.Recommendation: add the rehearsal job to
ci.ymlfor pull requests, gated by the existingchangesjob and pass markers. Gate it onawa-model/src,awa-model/migrations,awa-worker/src,awa/tests/rolling_upgrade_rehearsal_test.rsandawa-python/tests/mixed_fleet_helper.py. The pass markers already skip it for pull requests that do not touch those paths.Cost: the whole rehearsal is about 2 minutes of test time locally, and likely 3 to 5 minutes on a shared runner. Add the test build, which the Rust cache mostly covers, and about 10 s to install the wheel. Running only this cell is about 15 to 20 s of test time. The whole job is still cheap enough, and the other cells guard the same mixed-version boundary. I have not changed any workflow triggers.
Checks
On Postgres 18.7 (Docker, localhost), with
awa-pg==0.6.19from PyPI in auvvenv, installed asrelease-gate.ymldoes:cargo fmt --allSQLX_OFFLINE=true cargo clippy --all-targets --all-features -- -D warningsSQLX_OFFLINE=true cargo build --workspacescripts/check-advisory-locks.py,scripts/check-transaction-isolation.py,scripts/ci-test-shard.sh checkcargo test --package awa --test rolling_upgrade_rehearsal_test -- --ignored: the new cell as listed above, and the full suite once.