Repository navigation
Wait for writer recovery before testing backup export - #1196
Conversation
There was a problem hiding this comment.
ℹ️ Approved with one non-blocking finding for local test runs.
Approach Waiting for the writer’s recovery flag before submitting the export directly addresses the startup race observed in CI. Original CI failure
Reviewed changes I traced writer lease acquisition, recovery completion, and the backup test’s first request.
- Backup integration test. Waits for writer recovery before the first export through the read-only API.
- Recovery notification. Exposes the existing waiter under the bot’s
test-supportfeature. The waiter subscribes before checking the recovery flag, so it also handles recovery that completes before the wait starts.
The backup integration test passed in hosted CI. Formatting and service-boundary checks passed locally. Hosted API test run
Non-blocking
- A persistent recovery error can hang a direct
cargo testrun. Startup recovery retries database errors while the writer holds its lease, so the new fixture wait can stay pending indefinitely outside CI’s test runner. Give this wait a generous timeout with a message identifying startup recovery as the stalled step. Fixture wait
gpt-6.2-sol | 𝕏
2feccd5
|
Addressed review 6206626197 in 2feccd5. Direct |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes I reviewed the follow-up commit 2feccd5.
- Bounded startup recovery. Added a 180-second deadline to the backup integration fixture’s recovery wait. If recovery stalls during a direct
cargo testrun, the test now fails with a message that identifies the stalled step.
Formatting and diff whitespace checks passed. The API integration test was not rerun locally for this review. The hosted API jobs were still running when checked. Default features · No default features
gpt-6.2-sol | 𝕏

Backup export after writer startup
The read-only API integration test claimed the real bot writer lease and immediately submitted a backup export. The lease claim spawns startup recovery. If the writer received the export before recovery finished, it correctly refused the write pause and the test failed. Hosted failure
The fixture now awaits the existing recovery completion notification before submitting its first export. The API test enables the bot’s existing test-support feature to access that notification. The waiter registers before reading the recovery flag, so it also handles recovery finishing before the wait begins. The production write gate and every existing export, restore, rollback and lease assertion are preserved.
Verification
After review, the recovery wait also uses the CI runner’s 180-second limit when invoked directly with Cargo. Holding recovery indefinitely produced the startup-specific error at that limit. The same test passed when recovery was released after 2.5 seconds. The final test passed 20 serial and 12 concurrent runs, API Clippy in both feature configurations, API Dylint, formatting and contracts.
Part of #666. Tested commit
2feccd55ef2eecfea5f496169fcdd5702457715eonbf3a825.Summary by Sourcery
Bug Fixes: