Skip to content

Tests for Responses path & reasoning fidelity #22

@HXYerror

Description

@HXYerror

Part of #1. Final-mile work to make sure the new path is regression-safe.

Goal

Add unit and integration-style tests covering the new /v1/responses route, the Anthropic→Responses adapter, reasoning round-trip, and streaming event translation.

Current state

tests/ contains:

  • anthropic-request.test.ts
  • anthropic-response.test.ts
  • create-chat-completions.test.ts

No tests touch responses, gpt-5, reasoning, codex, or encrypted_content.

Tasks

  • tests/responses-request.test.ts — Anthropic Messages → Responses input items
  • tests/responses-response.test.ts — Responses output → both OpenAI and Anthropic
    • reasoning → thinking block with signature
    • message → text block
    • function_call → tool_use
    • encrypted_content preserved byte-exact
  • tests/responses-stream.test.ts — SSE event sequencing
    • Reasoning-then-text
    • Text-then-tool-then-text
    • Tool-then-text-then-reasoning (out-of-order index handling)
    • Stream error mid-flight produces a clean message_stop
  • tests/model-routing.test.ts — verify /v1/chat/completions for gpt-5.3-codex either bridges or returns a clear 400 (per the policy in Add upstream Responses API service client #4)
  • Add a fixture file under tests/fixtures/responses/ with realistic upstream SSE traces (capture once with --show-token --verbose and scrub)

Acceptance criteria

  • bun test passes locally
  • Coverage for the new src/routes/responses/, src/routes/messages/responses-*translation.ts, and src/services/copilot/create-responses.ts modules is ≥ 80%
  • Existing tests remain green

File pointers

  • tests/anthropic-request.test.ts — reference style
  • tests/anthropic-response.test.ts — reference style
  • AGENTS.md — test conventions

Metadata

Metadata

Assignees

No one assigned

    Labels

    reasoningReasoning / thinking / encrypted_contentresponses-apiOpenAI /v1/responses API supporttestTests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions