Add rspec-time-guard to catch hanging specs - #33
Draft
apiology wants to merge 3 commits into
Draft
Conversation
Sets a 60s global time limit on specs via the rspec-time-guard gem. Extracted from castwide#1006 (Improve pin caching) as a standalone piece: this is dev/test tooling only, no runtime behavior change, and useful independently of the rest of that PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
apiology
marked this pull request as draft
August 2, 2026 15:52
CI showed the new 60s global time limit tripping on 5 specs that are legitimately slow (gem/bundle resolution, YAML/Thor lookups) rather than hung: ApiMap#get_method_stack's YAML/Thor cases, ApiMap#returns core methods, Host#opens a file outside of prepared libraries, Protocol#handles $/solargraph/documentGems, and Gemspecs#fetch_dependencies's external-bundle cases. Tag each with the same per-example time_limit_seconds override the original PR (castwide#1006) settled on, so this PR doesn't regress CI on its own before the rest of that PR's stacked branches land. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The YAML/Psych stdlib resolution spec timed out at 240.33s against a 240s limit in CI - a genuine near-miss (0.14% over), not contention from running multiple PRs' CI concurrently (each job gets its own runner, so concurrent jobs affect queue time, not execution time). Widen that limit and the other 120s limits proportionally to give real headroom against normal run-to-run variance on GitHub Actions' shared runners, rather than re-running and hoping. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 tasks
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.
Problem:
A spec that hangs — on a network call, an infinite loop, an unresponsive external process — blocks the whole CI run indefinitely instead of failing with a clear timeout, since nothing in the suite currently enforces a time limit.
Solution:
Adds the
rspec-time-guardgem with a 60s global default (spec_helper.rb), plus longer explicittime_limit_seconds:overrides on the handful of specs that legitimately run longer — pure dev/test tooling, no runtime behavior change.Each non-default limit reflects a real, CI-observed duration: stdlib/gem resolution and YAML/Thor lookups are legitimately slow, not hung, and the YAML/Psych spec timed out in CI at 240.33s against its first 240s limit — a 0.14% margin.