feat(api): add throwIfAborted helper and completePrompt options regression tests - #1288
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe provider API now includes abort-signal guards, detection, and error creation utilities. Tests cover abort behavior, abort error variants, and valid ChangesProvider API updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This PR adds abort-handling helpers and regression coverage without any identified current-head correctness or production-impact risk; it is merge-ready after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ssion tests Add a fast-fail throwIfAborted guard to the shared abort-signal utilities and regression tests for the CompletePromptOptions interface (added by Zoo-Code-Org#901).
f3e807a to
e61feb1
Compare
|
Series follow-up flag: adopt This PR currently builds its abort/timeout request options directly with Status: series foundation - nothing to migrate here. This PR ships the abort-signal utilities (including |
Round 1 — final status: all checks green, changed-line coverage verifiedPart of the abort-signal series addressing #404 (builds on #674, #901, #1008). Foundation PR — canonical abort-signal utilities + Final verified 2026-08-20: all CI checks green on this head (0 pending / 0 failed), CodeRabbit review clean, and zero new bot findings after this commit.
|
…o abort-signal utils The OpenAI-family provider PRs (Zoo-Code-Org#1309, Zoo-Code-Org#1311) carry per-provider copies of the same abort-detection helper (isRequestAborted) and the same abort-error constructor (createAbortError); only the provider name in the message differs. Per the CodeRabbit maintainability finding on Zoo-Code-Org#1309 (extract the shared abort helpers into utils/abort-signal.ts), these are now shared in the foundation utility: - isRequestAborted(error, signal?) - true when the caller signal fired, a native AbortError / OpenAI SDK APIUserAbortError was raised, or the message is exactly "Request was aborted." (exact match; a substring match would misclassify unrelated errors that merely mention aborting) - createAbortError(providerName) - fresh error with name === "AbortError" and message "The <providerName> request was aborted", satisfying the Task.ts abort contract - exported OpenAiRequestOptions type 7 new tests (isRequestAborted 4, createAbortError 3).
…tudio and qwen-code The per-provider copies of isRequestAborted / createAbortError / OpenAiRequestOptions were extracted into src/api/providers/utils/abort-signal.ts by foundation PR Zoo-Code-Org#1288 (commit a0117fb) following the CodeRabbit maintainability finding on this PR; the providers now import the shared helpers. createAbortError takes the provider name as a parameter; provider behavior and abort messages are unchanged.
Add the missing
throwIfAbortedfast-fail guard and the shared abort-detection / abort-error helpers to the abort-signal utilities (#1008 merged the merge helpers but not this guard), plus regression tests for theCompletePromptOptionsinterface added by #901.src/api/providers/utils/abort-signal.ts:throwIfAborted(signal?)— throwsErrorwithname = "AbortError"when the signal is already abortedisRequestAborted(error, signal?)— true when the caller signal fired, a nativeAbortError/ OpenAI SDKAPIUserAbortErrorwas raised, or the message is exactly"Request was aborted."createAbortError(providerName)— freshAbortErrorwith a provider-specific message ending in "aborted", satisfying the Task.ts abort contractOpenAiRequestOptionstypesrc/api/providers/utils/__tests__/abort-signal.spec.ts: 3throwIfAbortedtests (undefined / not aborted / aborted) + 7 new tests for the shared helperssrc/api/providers/__tests__/complete-prompt-options.spec.ts: new regression spec (4 tests) for the interface surfacePart of the abort-signal series (round 1). Builds on #674, #901, #1008. Addresses #404.
Summary by CodeRabbit
New Features
Bug Fixes
Tests