fix(lab): preserve CL-03 live transport failure classes - #1710
Conversation
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe pinned HTTP client now separates first-byte and inactivity timeouts, emits typed timeout and output-limit errors, and preserves legacy idle-timeout fallback. The live sender maps these errors to transport results. Loopback tests verify the new classifications. ChangesPinned HTTP timeout handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The PR correctly classifies live transport failures, but response timeout cleanup may leave stale timeout behavior on reused connections. The change is mergeable with explicit owner follow-up to reset and remove the timeout on all terminal paths. Sequence Diagram(s)sequenceDiagram
participant LabLivePinnedSender
participant pinnedHttpPost
participant LoopbackHTTPServer
LabLivePinnedSender->>pinnedHttpPost: Send request with separate timeout limits
pinnedHttpPost->>LoopbackHTTPServer: Establish pinned HTTP request
LoopbackHTTPServer-->>pinnedHttpPost: Send headers or response body bytes
pinnedHttpPost-->>LabLivePinnedSender: Return response or typed timeout/output-limit error
LabLivePinnedSender-->>LabLivePinnedSender: Map PinnedHttpError to TransportError
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
idleTimeoutMsrequest/response timeout path for existing pinned HTTP consumers.Root cause
The pinned HTTP layer emitted generic
Errorobjects for first-byte stalls, response inactivity, and output-cap overruns. The Lab sender only translated the connect-timeout error, and it readresponse.text()outside that translation block.As a result,
runLiveScenario()treated realistic provider stalls and oversized responses asharness_failure/execution_error, instead of the timeout and resource-limit blockers defined by the CL-03 live authority.Body failures also need to cross the already-resolved
Responseboundary. The pinned transport now errors the response body stream before tearing down the request, so inactivity and byte-limit failures remain observable byresponse.text()and retain their typed classification.Compatibility
Existing image transport callers still rely on
idleTimeoutMsbeing installed throughClientRequest.setTimeout()andIncomingMessage.setTimeout(). The new split deadlines are only used whenfirstByteTimeoutMsorinactivityTimeoutMsis supplied, so legacy callers keep their existing timeout behaviour.Impact
Live-route evidence could record the wrong failure class for normal provider or network stalls and oversized responses. That makes an environmental or bounded-resource failure look like a Lab infrastructure fault.
Validation
Added
tests/lab-live-pinned-timeouts.test.tscovering:first_byte_timeoutinactivity_timeoutoutput_byte_limitThe existing
tests/images/pinned-https-get.test.tssuite also exercises the legacyidleTimeoutMsrequest/response timeout contract. CI exposed that compatibility path had been dropped in the first commit, so the follow-up commit restores it without changing the new Lab-specific deadline path.A second CI run exposed that post-header body failures were being sent through the pre-header promise rejection helper after the
Responsehad already resolved. The latest commit separates body-stream failure state and signals the stream error before transport teardown.The branch starts from current
dev, is three commits ahead, and has no unrelated file changes.Local Bun execution is not available in this ChatGPT environment, so GitHub CI is the executable validation source for this PR.
Follow-up to #1352.
Summary by CodeRabbit
Bug Fixes
Improvements