Repository navigation
mac: fix a second observe-then-defer-read flake in LayoutCapabilityConsumerTests (GH-680's class, needs #719 first) - #732
Closed
d-q222 wants to merge 1 commit into
Conversation
…ound hook LayoutCapabilityConsumerTests' AppliedResults had GH-680's exact observe-then-defer-read race: it tracked resultID with withObservationTracking and read result revision + negotiation in a deferred Task, so two applies landing before the deferred read runs coalesce and the first reply's pair is lost. A scratch probe of the old helper through two back-to-back applies confirmed it: [(rev3, ext), (rev3, ext)] -- rev2's legacy pair gone. Fix, mirroring #719's ResultIDChanges rewrite: ShellModel gains a test-only synchronous onResultBound hook fired after bindLayout (the existing onResultApplied fires BEFORE bindLayout, so negotiation read there would still hold the previous reply's value -- verified in handle(.result)); AppliedResults records the hook's (revision, negotiation) arguments synchronously. New deterministic regression test testAppliedResultsCapturesTwoBackToBackRepliesWithoutCoalescing applies a legacy then an extended reply with zero awaits between and asserts both pairs, each with its own reply's negotiation. Implementation-Agent: muse-spark-1.3-contributor
This was referenced Sep 16, 2026
jay3332
added a commit
that referenced
this pull request
Sep 19, 2026
…econd observe-then-defer-read flake in LayoutCapabilityConsumerTests Stacked on #719 (already on main as agent/daniel-parent/transcript-flake); only the branch's own commit lands. Test infrastructure plus one test-only `onResultBound` hook on ShellModel. Implementation-Agent: Claude Code (mac-claude-a / lane-integrate2) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
jay3332
added a commit
that referenced
this pull request
Sep 19, 2026
…he integration batch + package definitions The pin reads main again after the second integration pass (#827 cherry-picks, #863, #950, #737/#739/#758/#732/#740/#825, visual-oracle tooling) and the `metadata.packages` work (`crate::package_definitions`, tex-expansion's `package_defs.rs`). `git archive` of this tree's `crates/compiler` and `crates/tex-expansion`, PINs at the merge commit, VENDORING.md rows updated, `scripts/check-vendor-pins.sh` both "up to date". render-pipeline 819/0 in both profiles against the new pins; compiler 1368/0, tex-expansion 150/0 release; Mac inventory sync current; swift build clean. Implementation-Agent: Claude Code (mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
Member
|
Merged into main 2d6ac3e (merge commit on the integration branch; GitHub does not detect it because this PR's base is a stacked branch, whose content is already on main). |
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.
Draft — depends on #719 merging first (this branch is stacked on
agent/daniel-parent/transcript-flake, which is itself stacked on #698).Scope
Proactive fix for a second instance of GH-680's bug class, in
apps/mac/Tests/FlashTeXMacTests/LayoutCapabilityConsumerTests.swift'sprivate
AppliedResultshelper (Swift/Mac test infrastructure only;crates/untouched). Not filed against a numbered issue — found bydaniel-parent proactively after #719 fixed the first instance, since this
helper has the identical shape and would flake under load the same way.
AppliedResultsused the same observe-resultID-then-defer-read pattern#719 fixed for
ResultIDChanges:withObservationTrackingto detect achange, then a
Task { @MainActor ... }readingmodel.result?.revision/model.negotiationon a later turn. Racy for the same reason: twoapplies landing before the deferred read runs coalesce onto the second
value, silently dropping the first.
Not a copy-paste of #719's fix — a real ordering hazard found and handled
correctly. #719's
onResultAppliedhook fires inhandle(.result)before
bindLayoutsetsnegotiation, so reusing that hook here wouldhave synchronously captured the previous reply's negotiation — a subtler,
silent-wrong-value bug, not just a race. Added a second, later hook,
onResultBound: ((Int, LayoutNegotiation) -> Void)?, fired immediately afterbindLayoutreturns sonegotiationreflects the current reply. #719's ownhook and call site are untouched.
Overlap check
Compiler-only overlap: none (Swift-only change). No other open PR touches
ShellModel.swift's hook declarations orLayoutCapabilityConsumerTests.swift.Test results
New regression test
testAppliedResultsCapturesTwoBackToBackRepliesWithoutCoalescing:two back-to-back applies (legacy reply, then an extended-capability reply)
with zero awaits between them, asserting both
(revision, negotiation)pairs are recorded with each reply's own negotiation — a stale-negotiation
hookup fails this test too, not just a dropped-entry regression.
Independently re-verified by the supervisor:
ShellModel.swift(+12, hook declaration + onecall site after
bindLayout),LayoutCapabilityConsumerTests.swift(rewrote
AppliedResultsto record synchronously through the hook,removing
withObservationTracking/deferredTask; added the new test).swift build --disable-sandbox: succeeds (pre-existing unrelated resourcewarnings only).
swift test --disable-sandbox --filter ShellLayoutNegotiationTests:11 passed, 0 failed (includes the new test).
report): changed the
onResultBoundcall site to always pass.legacy(simulating a stale-negotiation bug), re-ran the new test: fails,
confirming it genuinely discriminates a wrong-negotiation hookup, not just
a missing one. Restored, re-ran: passes again.
pre-fix observe-then-defer helper driven through the same two-apply
sequence recorded the second reply's pair twice, losing the first —
reproducing RuntimeTranscriptTests: flaky extra compile_result under full-suite load #680's exact failure mode deterministically.
apps/macsuite (lane's own report, load 7.2→13.8 across 2 runs with--skip "DesignSnapshots|Completion|IMECompositionTests|DocumentFiles"forthe pre-existing crash/flake families mac: fix GH-680 flaky extra compile_result — test's observer, not the shell #719 already documented): identical
13 pre-existing failures in both runs (unrelated: keychain-in-sandbox and
timing-sensitive UI suites — confirmed present on the untouched base via
git stashtoo), zero failures elsewhere, includingShellLayoutNegotiationTestsandRuntimeTranscriptTests.Not done
Nothing else in scope.
apps/mac/Package.resolvedis untracked/generated bythe test runs and deliberately left out of this PR.
🤖 Generated with Claude Code