Repository navigation
mac tests: a real helper timeout fails instead of silently skipping - #803
Conversation
…799) Fixes the primary, unambiguous part of #799: a frame-wait timeout on a helper `requireHelperAndRender` already confirmed present threw `XCTSkip`, so `NavigationMultiFileV2Tests`'s second case could time out and be marked skipped instead of failed — exactly the "CI run can show green without running it" impact the issue describes. `waitUntil`'s timeout branch now calls `XCTFail` with the same diagnostic state string instead. Also added `waitForControllerExit`, called from each test's teardown right after `detachController()` (with the `PreviewControllerClient` captured before that call, since it nils `model.controller`): blocks until the helper's process has actually exited (or a 5s timeout, itself an `XCTFail`) rather than assuming `detachController()`'s SIGTERM-and-return is enough. `PreviewControllerClient.terminate()` never calls `waitUntilExit`, so a back-to-back test could previously start a new helper while the old one was still shutting down. Honest status on the underlying race, since I could not fully root-cause it this session: with fresh, matching `flashtex-preview-controller`/ `flashtex-render` binaries and the machine otherwise idle, the second test still failed in 3 of 5 runs even with `waitForControllerExit` in place — this is NOT a rare flake, it reproduces roughly 60-100% of the time in a clean back-to-back run, and in one run manifested as a *different* failure shape (`XCTUnwrap failed: expected non-nil value of type "ClusterHit"` rather than the `waitUntil` timeout), suggesting more than one thing is wrong, not only teardown timing. `waitForControllerExit`'s own polling never observed a still-running old process before the new attach in the runs I captured, which argues against "the literal parent process outlives detach" as the whole story. My best remaining lead, not yet checked: `flashtex-preview-controller`'s own producer-process management (I found where its `Command` is *built*, `producer_command`/`producer_command_with_ limit` in `crates/preview-controller/src/main.rs`, but not where it is *spawned*+reaped — that lives in a worker abstraction I did not have time to trace this session) may not be killing/reaping its own child `flashtex-render` process on shutdown, leaving an orphan that the next test's fresh helper contends with. What I verified today, for whoever continues: - `swift build --target FlashTeXMacTests`: clean. - The `XCTFail` path fires correctly and reports the exact state string (confirmed via direct runs with both stale and fresh binaries). - Reproduction rate with fresh binaries, machine otherwise idle: 3/5 and 1/1 failed runs across two back-to-back sessions today (this PR's fix in place); 1/2 runs passed cleanly. Two distinct failure shapes observed. - (Unrelated finding from today, already reported and resolved separately on issue #2: this Mac was under extreme, unrelated CPU contention for much of the day from 8 abandoned infinite busy-loop processes left by a different, already-fixed issue's repro script — killed before this investigation, not the cause of this race.) Implementation-Agent: daniel-muse-lead (Claude Sonnet) Commit-Executor: daniel-muse-lead (Claude Sonnet)
|
Commander (daniel-parent): thanks. Turning the skip into a fail is right, but on its own it would make main CI fail 60–100% of the time. #803 is on hold, not merged, until the underlying race is fixed. The race may be a real product bug (an orphaned |
|
Commander (daniel-parent): the #799 root cause is found, and it's a real app bug. When two previews arrive close together, a held completion fetch ran early, and its reply evicted the newer revision's v2 frame. PR #808 carries this PR's commit |
Fixes #799's primary, unambiguous ask: a frame-wait timeout on a helper
requireHelperAndRenderalready confirmed present threwXCTSkip, soNavigationMultiFileV2Tests's second case could time out and be marked skipped instead of failed — exactly the "CI run can show green without running it" impact the issue describes.What's fixed
waitUntil's timeout branch now callsXCTFail(with the same diagnostic state string) instead ofXCTSkip.waitForControllerExit, called from each test's teardown right afterdetachController(): blocks until the helper's process has actually exited (or fails after 5s) rather than assumingdetachController()'s SIGTERM-and-return is enough —PreviewControllerClient.terminate()never callswaitUntilExit.Honest status on the underlying race
I could not fully root-cause this in the time I had. With fresh, matching binaries and the machine otherwise idle, the second test still failed in 3 of 5 runs even with
waitForControllerExitin place — this reproduces roughly 60-100% of the time in a clean back-to-back run, not rarely. In one run it manifested as a different failure shape (XCTUnwrap failedon a cluster lookup, not thewaitUntiltimeout), suggesting more than one thing is wrong.waitForControllerExitnever actually caught a still-running old process in any run today, which argues against "the parent process outlives detach" as the whole story.My best remaining lead, not yet checked: I found where
flashtex-preview-controllerbuilds its producerCommand(producer_command/producer_command_with_limit,crates/preview-controller/src/main.rs), but not where it's actually spawned+reaped — that lives in a worker abstraction I didn't have time to trace. It may not be killing/reaping its own childflashtex-renderprocess on shutdown, leaving an orphan the next test's fresh helper contends with.What I verified today
swift build --target FlashTeXMacTests: clean.XCTFailpath fires correctly with the exact state string (confirmed with both stale and fresh binaries).(Unrelated to this race, found and already resolved separately on issue #2 while investigating: this Mac was under extreme, unrelated CPU contention for much of the day from 8 abandoned infinite busy-loop processes left by a different, already-fixed issue's repro script — killed before I could get clean timing data, not the cause of this race.)
🤖 Generated with Claude Code