Add an atomic zone event outbox - 2 - #5730
Open
Pixelobserver wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical concurrency and coalescing issues, plus moderate expiry and error-propagation issues, block approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a standalone, persistent outbox for zone events without integrating delivery into ZoneManager.
Changes:
- Adds persisted pending-event models and outbox operations.
- Implements expiry, coalescing, capacity handling, and atomic file storage.
- Adds 23 focused XCTest cases.
File summaries
| File | Summary |
|---|---|
Tests/App/ZoneManager/ZoneEventOutbox.test.swift |
Tests persistence, ordering, expiry, coalescing, capacity, and failure handling. |
Sources/App/ZoneManager/ZoneEventOutbox.swift |
Defines the outbox interface. |
Sources/App/ZoneManager/PendingZoneEvent.swift |
Defines persisted zone-event data. |
Sources/App/ZoneManager/AtomicFileZoneEventOutbox.swift |
Implements file-backed storage and queue management; has two critical and two moderate unresolved findings covering concurrency, coalescing, expiry, and error propagation. |
Review details
Suppressed comments (1)
Sources/App/ZoneManager/AtomicFileZoneEventOutbox.swift:44
- Appending an already-expired event returns before
load(). If the persisted file is corrupt or otherwise unreadable, this path silently hides the read/decoding error instead of propagating it as promised by the outbox contract, so callers can continue believing the store is usable. Load the existing events before applying the freshness guard (without saving the expired input).
guard isFresh(event, at: now) else { return }
var events = try freshEvents(from: load(), at: now)
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
AI Policy
Select exactly one option that describes AI usage in this contribution:
Summary
Add a standalone, atomic file-backed outbox for pending zone events. This is part 2 of the split requested for #5629.
This foundation does not activate outbox delivery in ZoneManager and does not depend on #5703. Delivery integration will follow separately.
Screenshots
N/A — internal persistence changes only; no visual changes.
Link to pull request in Documentation repository
N/A — this foundation does not activate user-facing functionality or configuration.
Any other notes
Completed validation:
Pending CI verification:
The test count describes the available test cases, not a completed test run.