Skip to content

Refactor transport stream test fixtures and shared dispatch harness #105965

Description

@steipete

Summary

Factor repeated OpenAI transport-stream test fixtures and reconcile dispatch-from-config with its shared harness, without changing behavior coverage.

Problem

src/agents/openai-transport-stream.test.ts is 13,865 lines. Roughly 15-20% is repeated model/chunk fixture construction, and a reasoning replay cluster duplicates the same test body across model variants. src/auto-reply/reply/dispatch-from-config.test.ts also duplicates fixture and setup behavior already owned by its sibling shared harness.

The duplication makes regression-heavy tests harder to review and maintain. Many cases carry issue-linked coverage, so assertion or scenario loss is not acceptable.

Proposed work

  • Add typed completions/responses model factories and a completions chunk factory.
  • Replace hand-built fixture literals while preserving meaningful overrides.
  • Fold identical reasoning replay cases into named tables.
  • Fold standalone completions parameter cases into the adjacent tables.
  • Reuse the shared dispatch harness where semantics match; retain richer local setup with a boundary comment.
  • Leave src/gateway/server-methods/agent.test.ts untouched.

Acceptance evidence

  • Affected files pass on Blacksmith Testbox before and after.
  • Exact before/after test counts match.
  • Every existing assertion survives, modulo mechanical table/factory composition.
  • Diff reports the test LOC reduction and no production-code changes.

Metadata

Metadata

Assignees

Labels

maintainerMaintainer-authored PR

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions