Repository navigation
fix(snapshot): finish queued writes without blocking quit (CC-196) - #344
Conversation
This comment has been minimized.
This comment has been minimized.
|
@kody start-review Final-code review requested for exact head 578c90a. Addresses both previous findings: one shared flush task with a reply per quit callback; termination closes queue admission before awaiting without clearing the ordered chain. Actual Mac compile plus 10 focused tests pass (0 failures), including post-close enqueue rejection and source integration coverage. No merge, runtime install or deployment performed. |
This comment has been minimized.
This comment has been minimized.
|
@kody start-review Final-code review requested at exact 97f8835. Follow-on cancellation/restart findings fixed: clear retained flush task before replying and reopen admission in MonitorModel.start, retaining old chain ordering. Actual Mac compile and 11 focused snapshot/termination/dedup tests pass. No runtime installation or deployment performed. |
This comment has been minimized.
This comment has been minimized.
|
@kody start-review Final-code review requested for exact 5c86684. Owner-aligned terminal-stop lifecycle, not cancelled-quit recovery. Behavioral repeated callbacks share one retained drain forever; no stale task clearing/newer generation exists. MonitorModel.start cannot reopen after termination. No unsafe reset of potentially active disk I/O. Actual Mac compile and 12 focused tests pass, 0 failures. See unresolved discussion4433420643 for lifecycle evidence and disputed recovery assumption. No merge, runtime install or deployment. |
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Summary
Ensures queued snapshot writes finish during app quit without blocking termination.
On
applicationShouldTerminate, the app now stops sampling, asynchronously flushes pending snapshot writes with a 2-second deadline, then confirms termination, instead of quitting immediately and dropping queued I/O.What changed
terminateLater) untilflushSnapshotWrites()completes or times out, keeping the main actor free for queued completions.SnapshotWriteDrainhelper that waits for the in-flight write chain with a timeout. Timeout unblocks quit without cancelling the underlying disk write.platformOrderat completion time instead of using a value captured at enqueue time.SnapshotWriteDrainTestscovering empty queue, main-actor completion ordering, real queued file write + flush, timeout behavior, and termination/disable integration checks.Ensures queued snapshot writes finish during app quit without blocking termination (CC-196).
What changed:
Summary
Ensures queued snapshot writes are finished during app quit without blocking termination, and that a restarted monitor starts a new drain lifecycle (CC-196).
What changed
AppDelegate.swift): After awaiting the in-flight snapshot flush, clears the flush-task tracking before replyingtoApplicationShouldTerminate: true, allowing quit to proceed asterminateLateronce queued writes complete.MonitorModel.swift):start()reopens snapshot-write admission by resettingsnapshotWritesClosedForTerminationtofalse, so writes enqueued after a restart are accepted and waited on by the next drain while remaining ordered behind any unfinished I/O.Tests
testRestartReopensAdmissionAndNextDrainWaitsForNewWritesto verify stop → drain → start reopens admission and a resumed write completes on the next drain.Summary
Ensures app quit finishes queued snapshot writes without blocking, then allows termination to proceed.
What Changed
terminateLater, stops new work, asynchronously waits for queued snapshot writes to flush, then replies to allow quit.