fix(queue): recover fast-policy partial records - #79
Merged
Conversation
Reconcile incomplete split queue rows during fast-policy startup with a durable cleanup transaction, while keeping buffered and strict policies fail-closed. Audit the remaining persistent domains and document why their transactional write shapes do not admit the same policy-permitted partial state.
There was a problem hiding this comment.
Pull request overview
This PR hardens Queue startup recovery under the fast write policy by durably reconciling policy-permitted partial split-record remnants (header-only or body-only) so they don’t cause permanent startup failure loops, while keeping buffered/strict policies fail-closed and leaving complete/legacy records untouched.
Changes:
- Introduces fast-policy startup preparation that scans persisted queue state, deletes incomplete header/body remnants, and invalidates derived queue indexes for rebuild.
- Wires boot-time Queue initialization to use broker-level durable write options for reconciliation, and adjusts sink initialization to call the new “prepare” routine.
- Adds regression tests for missing-body/orphan-body reconciliation, durable-write requirement, realm-aware pairing, and persistence across restart; updates ops/dev documentation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/domains/queue/sink/domain_sink_impl.rs | Calls queue “prepare persisted state” on sink initialization and threads recovery write options into construction. |
| src/domains/queue/actor/constructors_validation.rs | Implements persisted-state scanning, fast-policy reconciliation (durable delete + index invalidation), and realm-aware header/body pairing. |
| src/domains/queue/actor/storage_keys/keys.rs | Removes now-unused body-suffix helper (replaced by full storage-key construction). |
| src/boot/domains.rs | Passes broker durable write options into Queue sink creation; small refactor for RPC timeout variable. |
| src/domains/queue/actor/tests/startup_reconciliation.rs | Adds reconciliation-focused regression tests including realm collision and restart persistence. |
| src/domains/queue/actor/tests.rs | Registers the new startup reconciliation test module. |
| docs/operations/cloud-setup.md | Documents fast-policy startup reconciliation and durable cleanup behavior. |
| docs/development/recovery-internals.md | Updates recovery steps and adds a persisted partial-state policy table including Queue fast-mode reconciliation. |
| docs/development/domain-boundaries-spec.md | Documents fast-policy startup discard/rebuild behavior and buffered/strict fail-closed contract. |
Comments suppressed due to low confidence (1)
src/domains/queue/actor/constructors_validation.rs:448
- The durable-policy failure here also says
queue validation failed, but it is emitted from the reconciliation step. Aligning the prefix withqueue reconciliation failedmakes it clearer that the operator action is about the cleanup write policy, not corrupted state validation.
if !recovery_write_options.is_sync() && !recovery_write_options.is_cloud_strict() {
return Err(format!(
"queue validation failed: family={family} key_category=reconciliation error=durable recovery write policy required"
));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Prevent fast queue recovery from turning a policy-permitted partial split record into a permanent startup outage. Fast-policy startup now durably removes incomplete header/body remnants and invalidates affected derived indexes; buffered and strict policies remain fail-closed.
Fixes #78
What Changed
Validation
Domain Boundary Review
Notes