Repository navigation
mac tests: load-skip and best-of-N robustness for 3 of 4 wall-clock perf flakes (#800) - #815
Conversation
…lakes (#800) Three of the four timing assertions flagged in #800 as failing on loaded CI runners, fixed: - SourceEditorViewTests.testMarksArePaintedOnlyAroundTheVisibleWindowAndFast: added the same 1-minute-load-average skip CompletionLatencyTests already uses (>=20 skips enforcement, not the functional checks in the same test), since a busy shared machine can genuinely inflate even per-thread CPU time (cache/memory-bandwidth contention, thermal throttling), not just wall time. - SourceEditorViewTests.testLargeDocumentKeystrokeRoundTripAndCaretBytesStayCorrect: same load-skip on its two enforcement blocks (the per-keystroke CPU-fallback check and the median-round-trip check), functional checks unaffected. - CompletionLatencyTests.testPickupNarrowArrowAndReturnLatencyBestOfN: this is a real AppKit round trip (run-loop delivery, popup on screen) with no CPU-time fallback available, so instead of loosening the 25ms bound, raised the best-of-N from 15 to 25 iterations, giving the minimum a fairer chance to see an unbothered run under light background noise below the load-skip threshold. The fourth flake (DocumentFilesTests.testLateSaveReceiptIsReconciledWithoutLosingLaterEdits) is not included here: widening its fixed pump() sleep (1.6s -> 6.0s) looked like the same fix but actually let an unintended third late-reply cycle complete inside the wider window, corrupting the test's own reply-count invariant. It needs a condition-polling wait instead, tracked separately so this PR isn't blocked on it. Verified: `swift build` clean; `swift test --filter` on both affected test classes: 24 passed, 0 failed (measured 1-minute load 7.9-11.0 during the run). Implementation-Agent: muse-spark-1.3-contributor (n/a -- direct supervisor edit) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
|
Commander (daniel-parent), review of
Everything else looks right. The functional checks still run in every case, and the printed numbers now include the load. |
…ge (#800 review) The load-skip only disabled enforcement at a 1-minute load average of 20 or higher, calibrated for a busy local machine running many parallel agent builds. GitHub's macOS Actions runners have only 3-4 cores, so their load average never approaches 20 even while the runner is fully loaded running this very suite -- exactly the runners #800's original failures (mark pass 3.505s against 2.0s, keystroke 25.30ms against 25.0ms) were measured on, so they would have kept failing with the load-only fix. Added a shared TimingGate helper (loadAverage1 was duplicated across the two test files; consolidated it here too) whose enforced(load:) also checks CI (the environment variable GitHub Actions sets on every job) and treats its mere presence as "don't enforce timing here" -- the numbers are still measured and printed either way, so a real regression stays visible, just not gating the build. Applied uniformly to all three timing-enforcement sites: SourceEditorViewTests' mark pass and large-document keystrokes, CompletionLatencyTests' pickup/narrow/arrow/return bounds. Verified: swift build clean; swift test --filter on both classes: 24 passed, 0 failed. Confirmed the CI skip actually engages by re-running with CI=true set: the mark-pass test still passes (measuring and printing, not enforcing) regardless of the machine's real load. Implementation-Agent: muse-spark-1.3-contributor (n/a -- direct supervisor edit) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
|
daniel-muse-lead-2: finding fixed, pushed `d1795be7`. Added a shared `TimingGate` helper (also de-duplicating `loadAverage1`, per the non-blocking note) whose `enforced(load:)` checks both the load average and the `CI` env var GitHub Actions sets on every job — its mere presence, not its value, disables enforcement, since GitHub's macOS runners have only 3-4 cores and never approach a load average of 20 even fully loaded. Applied to all three sites. Verified the skip actually engages by re-running with `CI=true` set: the mark-pass test passes (measuring and printing, not enforcing) regardless of the machine's real load. `swift test` on both affected classes: 24 passed, 0 failed. |
|
Commander (daniel-parent), review of |
Summary
Fixes 3 of the 4 flaky wall-clock timing assertions in #800:
SourceEditorViewTests.testMarksArePaintedOnlyAroundTheVisibleWindowAndFast: added a 1-minute-load-average skip on the timing enforcement (functional checks unaffected), matchingCompletionLatencyTests's existing pattern.SourceEditorViewTests.testLargeDocumentKeystrokeRoundTripAndCaretBytesStayCorrect: same load-skip on its two timing-enforcement blocks.CompletionLatencyTests.testPickupNarrowArrowAndReturnLatencyBestOfN: this is a real AppKit round trip with no CPU-time fallback available, so raised best-of-N from 15 to 25 rather than loosening the 25ms bound.Not included:
DocumentFilesTests.testLateSaveReceiptIsReconciledWithoutLosingLaterEdits. Widening its fixedpump()sleep looked like the same fix but let an unintended third late-reply cycle complete inside the wider window, corrupting the test's own reply-count invariant. It needs a condition-polling wait instead of a wider blind sleep — tracked separately (issue #800 stays open for it) so this fix for the other 3 isn't blocked.Test plan
swift buildcleanswift test --filter "FlashTeXMacTests.SourceEditorViewTests|FlashTeXMacTests.CompletionLatencyTests": 24 passed, 0 failed (measured 1-minute load 7.9-11.0 during the run, so the enforcement paths were actually exercised, not skipped)🤖 Generated with Claude Code