test: isolate cloud recovery lifecycle timing - #268
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens test-only lifecycle and instrumentation timing around cloud recovery to eliminate two independent races seen in consecutive final main Core CI attempts, without changing production recovery or persistence behavior.
Changes:
- Split cloud test options so the short (100ms) cloud shutdown drain timeout is confined to the intentionally failing upload lifecycle; healthy reopen/recovery uses normal timeouts.
- Adjust the fake cloud backend’s “in-flight” instrumentation to end the measured interval before sending the completion callback, preventing overlap with the next bounded batch.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/cloud_persistence_hardening.rs |
Separates “failure” vs “recovery” open options so the short drain timeout doesn’t leak into the healthy reopen path. |
src/engine/startup/tests.rs |
Moves in_flight decrement to occur before publishing the callback to avoid batch-overlap in bounded hydration tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the two independent test races reported by consecutive Core attempts on final main after PR #267.
Production recovery, persistence, deadline, and batching behavior is unchanged.
Why are you making this contribution?
Final-main CI run https://github.com/cntryl/midge/actions/runs/33527456724 failed twice with different test-only races. Attempt 1 timed out a healthy recovery shutdown because the intentionally short failure timeout leaked into the reopened engine. Attempt 2 recorded more than eight hydration requests because the fake backend decremented its counter after the callback had already admitted the next batch.
Linked issues
No issue: this is a test-only follow-up to consecutive red final-main Core attempts after PR #267.
Acceptance audit
Evidence: The full all-features workspace suite passes; the three upload-failure lifecycles passed 5 of 5 focused repetitions each; bounded hydration passed 25 of 25 focused repetitions; its timeout sibling passed 5 of 5.
Production entry point: Cloud shutdown recovery in tests/cloud_persistence_hardening.rs and bounded cloud WAL hydration in src/engine/startup/cloud_recovery.rs.
Resolution: Separate failure and recovery options over the same database path, and decrement the fake backend in-flight counter before publishing completion.
Risk and compatibility
Low risk. This PR changes test setup and instrumentation only. It does not change production code, persistence formats, durability behavior, cloud protocols, recovery policy, or public APIs.
Verification
Tool assistance disclosure
Codex inspected both failed hosted attempts, traced each failure to test lifecycle or instrumentation timing, audited sibling tests, implemented the test-only fixes, and ran the reported verification.
Contributor responsibility