Repository navigation
mac tests: bound published() wait, make last-wins prove the generation guard - #452
Conversation
Follow-up to #418 (merged as 7f67984 before this round of review feedback landed -- redirected here per daniel-parent's instruction, not pushed to the merged branch). 1. published() now bounds its wait: the settle continuation races a 5s Task.sleep timeout (both on @mainactor, so the shared `settled` flag is never raced) and XCTFails with a clear message instead of hanging the whole suite forever if a settle is ever missed. 2. testOnlyTheLastScheduledUpdateWins now captures both scans via recomputeExecutor and replays them OUT OF ORDER -- newer first, stale second -- so submission order can no longer mask a removed generation guard. Verified independently outside the sandbox (Muse could not run `swift test` at all here -- SwiftPM's nested sandboxing conflict): - `swift test --filter WordCountModelTests`: 2 passed, 0 failed. - Mutation check: removed the `gen == self.generation` guard in `recompute` -- testOnlyTheLastScheduledUpdateWins fails exactly as predicted (`XCTAssertEqual failed: ("Optional(1)") is not equal to ("Optional(4)")`). Restored the guard -- passes again. - Full Mac suite: 1162 tests, 0 failures. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane fix418, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Co-authored-by: muse-spark-1.3-contributor <[email protected]>
|
daniel-parent review of #452 at f88e4a5: moved to draft; the simplest fix is to narrow it.
Mark it ready again once it's just the bounded wait plus its timeout test. |
Fixes daniel-parent's re-review of #452: 1. Reverted testOnlyTheLastScheduledUpdateWins to the simple inline-order version. It still depended on schedule order (both publishes run as unstructured Task { @mainactor }), and #406 already tests stale-generation suppression directly -- that coverage belongs there, not here. 2. published() now returns Bool (true = settled before the timeout, false = timeout fired first) instead of calling XCTFail internally, so a test can assert on the timeout path itself. Happy-path callers let-bind and assert true. 3. Added testPublishedWaitReportsTimeoutInsteadOfHanging: a model whose recomputeExecutor swallows the work (no publish, no settle) proves published() gives up and returns false within its bound (~1s here) instead of hanging. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane fix452v2, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet)
|
Pushed ( Not based on current main yet — will do that once you've reviewed this content, to avoid a second round of conflict noise. Waiting for your review before this goes ready. |
|
daniel-parent re-review of #452 at e639677: the code is accepted. Fix the body, then mark it ready yourself; this is an explicit OK for a body-only edit. The reviewer's defect is Body:
After those edits, mark it ready. |
#406 landed `testCancelledScheduleNeverPublishesItsResult` at the same place this branch adds `testPublishedWaitReportsTimeoutInsteadOfHanging`. They test different things -- a cancelled debounce never publishing, and the bounded `published()` wait reporting a timeout rather than hanging -- so both are kept. The two conflicting hunks shared the closing brace that followed them, so the first test needed its own `}` restored; without it the second nested inside the first and the file would not compile. Implementation-Agent: orchestrator-astra Commit-Executor: orchestrator-astra (direct; Cursor usage limit)
Scope
Follow-up to #418 (merged before this round of review landed — opened as a new PR off current main, not pushed to the merged branch). Adds a bounded wait to
published()and a test proving its timeout path fires instead of hanging.apps/mac/Tests/FlashTeXMacTests/DocumentStatisticsTests.swiftonly.Overlap check
#406 (cancellation coverage) also touches this test file; daniel-parent separately merged main into #406.
testOnlyTheLastScheduledUpdateWinsis main's own existing test, left unchanged here — generation-guard coverage belongs to #406, not this PR.Test results (head
e639677e, re-run on this exact commit, outside the Muse sandbox)Mutation check (re-run by me independently): disabled the timeout branch's
continuation.resume()inpublished()(if !settled && false { ... }) —testPublishedWaitReportsTimeoutInsteadOfHangingthen hangs indefinitely (didn't complete within 15s, confirmed via an external kill rather than letting it hang) instead of returningfalse, proving the bound is load-bearing. Restored — passes again in ~1s.Not done
Nothing further deferred.