Repository navigation
Wait for the polling loop to fault instead of sleeping in exception tests - #74
Merged
Merged
Conversation
…ests RethrowExceptionsThrowsException slept 30 ms and then expected the action's exception. The exception only reaches PollingTask after three hops: a tick starts the action on the thread pool, the action throws, and a later tick (at least one 10 ms polling interval on) sees the faulted task and throws out of the loop. A slow macOS runner took longer than 30 ms, so RethrowExceptions found nothing to throw. The four tests that expect a fault now await PollingTask itself, with a 10 second timeout that fails the test rather than hanging. The assertions are unchanged. The library is not changed: capturing the fault on the next tick is its documented behaviour, not a race. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RTMFFSY8FY5CpAhf6ikNH1
|
This was referenced Sep 29, 2026
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.



Before:
RethrowExceptionsThrowsExceptionfailed on the macOS runner with "expected InvalidOperationException but none was thrown". The test slept 30 ms, then calledRethrowExceptions(). On a slow runner the polling loop had not faulted yet, so there was nothing to throw.After: the four tests that expect the action's exception (
RethrowExceptionsThrowsException,RethrowExceptionsKeepsTheActionStackTrace,RestartResumesPollingAfterActionThrows,RestartDoesNotRethrowTheStaleActionException) wait onPollingTaskitself. A 10 second timeout makes a hang fail the test. The assertions are unchanged.How: the exception reaches
PollingTaskin three steps. First, a tick starts the action on the thread pool. Second, the action throws. Third, a later tick (at least one 10 ms polling interval later) sees the faultedActionTaskand throws out of the loop, which faultsPollingTask. That takes one polling interval plus two thread pool dispatches, and no fixed sleep can guarantee that fits. The newWaitForPollingToFaultAsynchelper awaits the task directly, so the wait is exact. The library is unchanged: surfacing the fault on the next tick is how it is designed to work, not a capture race.🤖 Generated with Claude Code
https://claude.ai/code/session_01RTMFFSY8FY5CpAhf6ikNH1
Generated by Claude Code