Skip to content

test: add responses api more cases#99

Merged
bzp2010 merged 1 commit into
mainfrom
bzp/test-responses-more-cases
May 9, 2026
Merged

test: add responses api more cases#99
bzp2010 merged 1 commit into
mainfrom
bzp/test-responses-more-cases

Conversation

@bzp2010
Copy link
Copy Markdown
Collaborator

@bzp2010 bzp2010 commented May 9, 2026

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for response handling with additional scenarios covering event ordering, metadata persistence, replay behavior, input validation, streaming operations, and error handling.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd40fd3b-f188-43eb-892e-03290281d853

📥 Commits

Reviewing files that changed from the base of the PR and between cc43c0c and 1d6ab42.

📒 Files selected for processing (1)
  • tests/proxy/responses.test.ts

📝 Walkthrough

Walkthrough

This PR extends the /v1/responses proxy route test suite with comprehensive end-to-end assertions covering streaming behavior, response storage and replay via previous_response_id, input validation, mixed output types, and error handling during bridge failures. Two older generic tests are removed.

Changes

Proxy /v1/responses endpoint test suite

Layer / File(s) Summary
Baseline streaming and response transformation
tests/proxy/responses.test.ts
New test validates exact SSE event ordering for text responses, verifies response/output ID rewriting to aresp_ pattern, and confirms terminal usage token totals.
Input validation and early rejection
tests/proxy/responses.test.ts
New test rejects /v1/responses requests containing input_image entries with only file_id, returning invalid_request_error before upstream dispatch.
Storage and response replay behavior
tests/proxy/responses.test.ts
Two new tests verify that store: true persists metadata and enables previous_response_id replay with merged message history; store: false blocks replay with previous_response_not_found error.
Mixed output item streaming
tests/proxy/responses.test.ts
New test validates correct streaming of combined message and function-call outputs, verifies output_item.added events, and confirms function-call argument reconstruction.
Bridge failure and error streaming
tests/proxy/responses.test.ts
New test simulates mid-stream bridge failure, asserting error event emission, absence of response.completed, and error message containing choice index.
Test suite consolidation
tests/proxy/responses.test.ts
Removes two older generic tests for previous_response_id replay wiring and validation, consolidating their assertions into the new specific test cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
E2e Test Quality Review ⚠️ Warning JSON.parse calls (lines 224, 496, 497, 562) lack error handling. No try-catch blocks or validation. Violates requirement to check all return values for errors. Wrap JSON.parse in try-catch. Alternatively, validate event.data is defined and valid JSON before parsing. Add defensive assertions before type conversions.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test: add responses api more cases' is directly related to the changeset, which adds comprehensive test cases to the responses API test suite.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed Test-only file with mock services. All credentials are test values. No sensitive data logging. Authorization, validation and error handling properly tested. No security issues found.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bzp/test-responses-more-cases

Comment @coderabbitai help to get the list of available commands and usage tips.

@bzp2010 bzp2010 merged commit fce3c6f into main May 9, 2026
3 checks passed
@bzp2010 bzp2010 deleted the bzp/test-responses-more-cases branch May 9, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant