Repository navigation
Catch SwiftLint's size limits and unexplained wall-clock test waits before CI - #404
Merged
Merged
Conversation
A review of the multi-commit PRs in #350-#401 found two causes behind most follow-up CI runs, and both are checkable without a macOS toolchain: - SwiftLint's file_length (400) and type_body_length (250): #358, #363, #364, #368, #378 and #380 each spent a ~37-minute run only to split a file or suite, twice because two PRs that fit alone overflowed together. scripts/check-swift-size.sh counts both (the type body as an estimate, ignoring strings and comments), fails past a limit, and notes files within 20 lines of one. Checked against the historical failures: it flags #358's 452-line file, #364's 404-line file and #368's suite. - Tests waiting on real time, the flakes behind #353, #357, #370, #379, #380, #396 and #399-#401: scripts/check-test-clock.sh is a ratchet over test-clock-baseline.txt, so no test file gains a fixed sleep or a real clock without a `// wall-clock-ok: <reason>`. Both run in check.sh --portable and, for the edited file, in a new PostToolUse hook (swift-budgets.sh) that works in the web sandbox. check.sh also checks the Mac pbxproj's repo-root folder is named `blurt`, the drift #392 hit after regenerating in a worktree. AGENTS.md adds the file-split import advice from #392. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DS5B1VCs8R8Y7JjnpdVdsa
…ther wait check-test-clock.sh flagged 56 fixed sleeps and real clocks in the tests. Six were real flake sources, each waiting for something that must happen within a bound a stalled runner can outlast. They now take waitUntil's 30 s, which only catches a hang (a passing test never waits it out): - ProtocolTests.relayCancelledTakesResultBack polled 1 s for the result; it now waits with `until`. - MemoryLeakTests.expectNoLeak gave a winding-down task 1 s to deallocate. - SimulatorFaultTests.next gave each event 3 s (the suite's one-minute limit still bounds the whole run). - waitForMicStart gave the fixture's mic 5 s, and fell through silently. - CommandFixtureApp.state(until:) gave the live fixture 2 s. - ReadyViewUITests gave the cross-process pasteboard write 5 s. Every remaining wait says why with `// wall-clock-ok: <reason>`: a poll's own tick, a fake that hangs until released or cancelled, a delay a test asks a fake for, the production clock where timers aren't the subject, real time being measured, a live-device or UI suite, and twelve absence checks (sleep, then assert nothing happened), which a slow runner can only make pass. With none left unmarked, the ratchet's baseline is gone: check-test-clock.sh now fails any unmarked wait, and the marker may sit on the line above where a trailing comment would pass 120 columns. The pattern reaches awk through the environment, so BSD and GNU awk read its backslashes alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DS5B1VCs8R8Y7JjnpdVdsa
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 25, 2026
alexkroman
pushed a commit
that referenced
this pull request
Nov 25, 2026
Two conflicts: - check.yml's required check job: #405 added mac-static, ios-audits and ios-static; this adds live-tests. It now needs and asserts all of them. - CommandFixtureApp: #404 raised state(until:)'s bound from 2 s to 30 s for every caller, which covers the fixture's slow first launch, so the within: parameter this branch added is dropped and the launch uses the plain call. The menu-bar wait gets #404's wall-clock-ok note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DS5B1TXn83VM7ihZ3iFgU5
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.
What & why
A review of the multi-commit PRs in #350–#401 found two causes behind most follow-up CI runs. Both can be checked without a macOS toolchain.
SwiftLint's size limits. #358, #363, #364, #368, #378 and #380 each spent a ~37-minute run only to split a file or test suite. Twice it happened because two PRs that each fit merged into one that didn't (#363 + #357, #378 + #365).
scripts/check-swift-size.shchecks SwiftLint's 400-linefile_lengthlimit exactly and estimates its 250-linetype_body_lengthlimit, skipping braces in strings and comments.Tests that wait on real time. These caused the flakes behind #353, #357, #370, #379, #380, #396 and #399–#401, which mostly failed other PRs.
scripts/check-test-clock.shfails any fixed sleep or real clock in a test without a// wall-clock-ok: <reason>marker.Test fixes. Of the 56 existing waits, 6 waited for something that must happen within a limit a stalled runner can outlast. They now get
waitUntil's 30-second limit, which only catches a hang:ProtocolTests.relayCancelledTakesResultBack(now usesuntil)MemoryLeakTests.expectNoLeakSimulatorFaultTests.nextwaitForMicStartCommandFixtureApp.state(until:)ReadyViewUITestspasteboard checkThe other 48 are marked with their reason. Twelve of them are checks that sleep and then assert nothing happened. A slow runner can't make those fail, but it can let them pass without catching anything; making them deterministic is left for a change that can run the tests.
Also in this PR:
check.shchecks that the Mac pbxproj's repo-root folder is namedblurt. Enable every SwiftLint opt-in rule and fix every violation #392 hit drift after regenerating the project in a worktree.PostToolUsehook,.claude/hooks/swift-budgets.sh, runs both scripts on the edited file. It needs no toolchain, so it works in the web sandbox.AGENTS.mdadds Enable every SwiftLint opt-in rule and fix every violation #392's advice on trimming imports when splitting a file.CLAUDE.mdand thecheckskill describe the new checks.How it was tested
scripts/check.sh --portablepasses in a Linux sandbox, including both new scripts' self-tests.The size check passes on today's tree, and I tested the hook on a file pushed over 400 lines, a new unmarked sleep and a non-Swift file. The pbxproj check fails on a worktree-named folder.
Not built or tested: the Swift changes are all in test targets and need CI on macOS.
scripts/check.shpasses (or CI will, if I'm not on a Mac)I read AGENTS.md and this doesn't reintroduce anything deliberately removed
Docs updated if behavior changed
Generated by Claude Code