Repository navigation
feat(timeout): bound every external request with one shared default timeout - #671
Open
aladuru001 wants to merge 1 commit into
Open
aladuru001 wants to merge 1 commit into
aladuru001 wants to merge 1 commit into
Conversation
SDK, keeper, appraisal and Drand clients each had their own (or no) request timeout, so a hung peer could stall a component indefinitely. Add DEFAULT_REQUEST_TIMEOUT_MS (10s), resolveRequestTimeoutMs (integer, 100-300000ms; invalid values throw rather than disabling the bound), RequestTimeoutError and fetchWithTimeout to @sub-rosa/time, and use them: - SubRosaClient passes the timeout to every rpc.Server (new rpcTimeoutMs) - mainnet-readiness RPC servers use the default - StatusClient default now references the shared constant - createPaidFetch bounds the probe and paid retry (new requestTimeoutMs) - drand-tools quicknet requests are bounded Documented in docs/INTEGRATION.md and the keeper README. Closes Sub-Rosa-Issue#534 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@aladuru001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
SDK, keeper, appraisal and Drand clients each had their own timeout or none, so a hung peer could stall a component indefinitely. This adds one shared default and applies it.
@sub-rosa/timenow exportsDEFAULT_REQUEST_TIMEOUT_MS(10 000 ms),resolveRequestTimeoutMs,RequestTimeoutErrorandfetchWithTimeout. Overrides must be integers in 100–300 000 ms;0,NaNand out-of-range values throw instead of silently disabling the bound.SubRosaClientpasses the timeout to everyrpc.Serverit builds (newrpcTimeoutMs). The keeper reaches RPC through the SDK, so it inherits this.mainnet-readinessRPC servers use the default;StatusClientnow references the shared constant (same 10 s value).createPaidFetchbounds both the probe and the paid retry (newrequestTimeoutMs).drand-toolsquicknet requests are bounded. This adds@sub-rosa/timeas a workspace dependency (lockfile updated;pnpm install --frozen-lockfilepasses).docs/INTEGRATION.md("External request timeouts") and the keeper README.The timer covers connecting and receiving response headers. It does not bound a body that stalls after headers;
confirmTimeoutremains a separate bound on finality polling.Closes #534
Supply-chain review
services/drand-toolsgains the in-repo workspace dependency@sub-rosa/time(workspace:*, no external package), andpackages/timetestscript lists the new test file. No install or lifecycle scripts added..vscode/, workflow, or other editor/config file changes.pnpm-lock.yamlhas only the matching 3-linedrand-tools→link:../../packages/timeentry; verified withpnpm install --frozen-lockfile.preinstall/postinstall) was added.Tests
packages/time/src/request-timeout.test.ts(8 tests, fake scheduler): default is 10 s, invalid overrides rejected, a hung request fails withRequestTimeoutErrorexactly at the deadline, per-call override, timer cleared on success and on failure, caller abort preserved, already-aborted signal, URL never in the error.packages/sdk/src/errors.test.ts:rpcTimeoutMsvalidation.services/appraisal-api/src/client.test.ts: a hung probe request times out; invalidrequestTimeoutMsrejected.Verification notes
I ran these on Windows with Node 20 (repo wants ≥22). The new tests pass. Existing failures are identical on an unmodified
upstream/maincheckout: inpackages/sdk,src/client.test.ts(fails to load, 45 pre-existingtscerrors),ROUND_CONTRACT_ERRORS mapping coverageandKeeperStatusClient readiness("errors never include keeper URL userinfo"). The unfilteredservices/appraisal-api/src/client.test.tstimes out locally onupstream/maintoo, so I ran only my two new tests there. Please rely on CI for the rest.🤖 Generated with Claude Code