Repository navigation
mac tests: measure the wall-clock budgets everywhere, enforce them where the clock is ours - #661
Merged
Merged
Conversation
…ere the clock is ours Three of the four timing failures on main are small margins against absolute constants calibrated on an M1 Max: 54.588 ms against 50 ms, 15 and 16 timer ticks against a required 20, 1.693 s against 1.5 s. A shared GitHub runner is slower and noisier -- this project has already measured the same binary varying ~7% run to run on its own Linux host -- so none of these is evidence that anything got slower. Deleting the budgets would throw away how a 10x regression gets noticed. Leaving them gating on shared hardware is worse than deleting them: a perf test that fails a third of the time teaches people that red CI is normal, which is how 35 failures went unnoticed here until `pipefail` landed. So the numbers are measured and printed everywhere, and enforced where the machine's speed is known. An overrun on a shared runner prints a greppable `perf(non-gating on a shared CI runner)` line instead of failing. The invariants that hold at any speed stay gating everywhere, unchanged: maxGap < 0.5 s (a main thread stalled for half a second is broken on any hardware -- and it PASSED on CI, which is what says the main actor was fine), send() returning inside 0.2 s, backpressure refusing, results being correct. RustPDFExportPipeTests was a plain test bug, not a slow runner: the pump loop exits at `ticks < 10`, so it promises ten ticks, and the assertion demanded `> 10` -- it could only pass when something unrelated pumped an extra turn. CI reported "10 is not greater than 10". Fixed to what the loop guarantees. LargeDocumentEditorTests is deliberately untouched: it did not miss a deadline, it got `helper exited (1)` from the real helper. Calling that a slow runner would be a mislabel. #659 makes that exit report its reason. Implementation-Agent: claude-fable-5 (Claude Code subagent, linux-primary) Commit-Executor: claude-fable-5 (direct; Cursor usage limit) Co-authored-by: GoKubar <[email protected]>
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.
Three of the four timing failures on main are small margins against absolute constants. This PR keeps all of them measuring and reporting, and stops the ones that depend on runner speed from gating a shared runner.
Third of three PRs off the red-CI investigation (#659 evidence capture, #660 snapshot gating).
What actually failed
EditorIndentationPerfTests.testReindentOf560KBDocumentIsUnder50ms< 50.0BridgeRecoveryTests— heartbeat ticks>= 20BridgeRecoveryTests— elapsed over the stall< 1.5RustPDFExportPipeTests— heartbeat ticks> 10The constants were calibrated on an M1 Max. A shared GitHub runner is slower and noisier — this project has already measured the same binary varying ~7% run to run on its own Linux host, and a shared runner is worse than that. None of these is evidence that anything got slower.
Why not just delete them, or just relax them
Deleting throws away real information: an absolute budget is how a 10x regression gets noticed.
Leaving them gating on shared hardware is worse than deleting them. A perf test that fails a third of the time teaches people that a red CI is normal — which is precisely how 35 failures went unnoticed on this repo until #490 landed
pipefail. A gate nobody believes is not a gate.So: measure everywhere, report everywhere, enforce where the number means something. On a shared runner an overrun prints a greppable line to stdout and stderr (the CI step pipes stdout through
tail -n 400, and a measurement is worth nothing if it is the part that gets cut):Locally and on the owner's Mac, the budget is enforced exactly as before. Anyone who wonders whether something got slower can still grep
perf:out of any run.What stays gating, everywhere
This is the part that matters for "not weakening a test". The policy applies only to "how fast is this machine" assertions. The invariants that hold at any speed are untouched:
maxGap < 0.5 s— a main thread stalled for half a second is broken on any hardware. Note this passed on CI: the main actor was never held. It is the assertion that actually detects the bug the test is named for; the tick count is only a proxy for it, and the proxy is what CI missed.sendDuration < 0.2 s—send()returning to the main thread immediately.pendingWriteBytesbounds; both captures completing; results correct.Test changes, justified
Per the standing rule, every edit:
EditorIndentationTests—XCTAssertLessThan(best, 50.0)→TimingBudget.assertWithin(best, 50.0, …). Same budget, same best-of-8 measurement, sameprint. Only the consequence on shared hardware changes.BridgeRecoveryTests(2 sites) — the twoticks >= 20assertions and theelapsed < 1.5 sassertion become reporting on CI. The tick count asks a 25 ms timer to have fired 20 times inside ~0.9 s ofTask.sleeps, i.e. near-perfect timer delivery;maxGapstays gating and is the real check.RustPDFExportPipeTests— a genuine test bug, and worth calling out as such. The pump loop's own exit condition isticks < 10, so it guarantees ten ticks, not eleven. The assertion demanded> 10, which could only pass when something unrelated pumped an extra turn; CI reported"10" is not greater than "10". Corrected to what the loop actually promises. This is a fix, not a loosening — the previous assertion was unsatisfiable by the loop's own contract.TimingBudget.swift(new) — the policy, plus three tests of the policy itself, so "non-gating on CI" is a decision with a test rather than a claim in a comment: a met budget never fails; an overrun reports on shared hardware and fails elsewhere;isSharedRunnerfollows theCIvariable the workflow sets.Deliberately not touched
LargeDocumentEditorTests.testLargePasteSelectionAndTypingEndDurableThroughTheRealHelper— the fourth failure, and not a timing miss. It gotControllerError(message: "helper exited (1)"): the real Rust helper died. Its sibling 60 KB / 560 KB real-helper tests passed in the same run. Labelling that "slow runner" would be a mislabel, and if it turns out to be a real helper bug under slow I/O it is a product fix, not CI hygiene. #659 makes that exit report its reason; the decision waits for that evidence.Verification
I could not run
swift testlocally — Linux host; this was diagnosed from themac-swift-test-logartifact and CI is the verification loop. Expected result: these three stop failing while still printing their measurements,LargeDocumentEditorTestsstill fails (now with a reason, once #659 lands), and the 12 snapshot comparisons skip once #660 lands.Implementation-Agent: claude-fable-5 (Claude Code subagent, linux-primary)