Skip to content

Give the relay test a longer hang guard and catch the qualified and wrapped never leeway (851-4477) - #1491

Merged
pondorasti merged 3 commits into
mainfrom
alexandru/851-4477-relay-test-guard-and-lint
Nov 26, 2026
Merged

pondorasti merged 3 commits into
mainfrom
alexandru/851-4477-relay-test-guard-and-lint

Conversation

@pondorasti

@pondorasti pondorasti commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Part of 851-4477 (benchmark only; follow-up to #1489 from its review. The ticket stays open for the product PR.)

What changes

  • Relay test: its wait for the packet goes from 2 s to 30 s. The wait only bounds a hang, and 2 s can run out on a loaded machine (the shared minis, or a pre-push under load) while the relay delivers correctly. The wait now keeps one deadline, so interrupted polls can't stretch it.
  • Lint rule timer_leeway_never: stays a tripwire for the literal spelling only. It matches a leeway: argument that is .never, with or without a type or module name in front, across whitespace and newlines (so the wrapped form is caught).
  • README: says plainly that the rule is a tripwire and that the relay test is the real guard.

What the rule does not do, on purpose

  • It doesn't follow a value into a leeway (a constant, a ternary, a function's result). An earlier version of this PR tried; it missed the wrapped form and rejected a guard that removes .never, so it is gone.
  • A real relay regression now takes up to 30 s per direction to fail instead of 2 s.

Tests

  • scripts/swift-lint.test.mjs: 4 spellings that must fail (plain, type-qualified, module-qualified, wrapped onto the next line) and 3 that must pass (.nanoseconds(0), repeating: .never, a comparison with .never inside a leeway argument).
  • LoopbackRelayTests passes locally (7 ms). The longer wait has no test of its own; it only matters when the relay is broken or the machine is stalled.
  • Lint on the whole repo is clean.

🤖 Generated with Claude Code

pondorasti and others added 3 commits November 25, 2026 21:44
… and catch every spelling of a never leeway (851-4477)

The relay test waited 2 s for its packet, which only bounds a hang but can
run out on a loaded machine with the relay delivering correctly: 30 s now.
The lint rule also catches the module-qualified spelling and a
DispatchTimeInterval constant set to .never, and the README says what the
rule can't see.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…nd ternaries (851-4477)

Review fixes: the widened rule flagged repeating: DispatchTimeInterval.never
and comparisons, and missed optionals, ternaries and parentheses. The relay
test's wait keeps one deadline across interrupted polls.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Review: a regex can't follow a value into a leeway, and the wider patterns
missed the wrapped form and rejected a guard that removes .never. The rule
matches only the literal argument again, across whitespace and newlines and
with an optional type or module name; the README names the relay test as
the real guard.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@pondorasti pondorasti changed the title Give the relay test a longer hang guard and widen the never-leeway lint rule (851-4477) Give the relay test a longer hang guard and catch the qualified and wrapped never leeway (851-4477) Nov 26, 2026
@pondorasti

Copy link
Copy Markdown
Member Author

Review applied at bcb9c96d0: the lint rule is back to a tripwire for the literal argument (leeway:\s*(?:[\w.]*\.)?never\b, so the wrapped form is caught and a comparison inside a leeway argument passes), the declaration and whole-argument matching are gone, the README names LoopbackRelayTests as the real guard, and the lint test keeps a short accepted/rejected list with both of those cases. The relay test change is untouched. The gate is rerunning on this head.

@pondorasti
pondorasti merged commit 1360904 into main Nov 26, 2026
11 checks passed
@pondorasti
pondorasti deleted the alexandru/851-4477-relay-test-guard-and-lint branch November 26, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant