refactor: factor transport stream fixtures#106006
Conversation
|
Land-ready proof for head
Known gap: aggregate Update after hosted CI completed: repo-native |
* test: factor OpenAI transport fixtures * test: share dispatch config harness
Closes #105965
What Problem This Solves
Large OpenAI transport and dispatch test suites repeated thousands of lines of model, stream-chunk, dispatcher, and mock construction. That repetition made high-value regression coverage harder to review and maintain.
Why This Change Was Made
Adds typed model and completion-chunk factories, folds repeated reasoning cases into named tables, and moves the dispatch suite's common mock graph and dispatcher into its existing shared harness. Responses events remain inline because their event shapes are heterogeneous;
src/gateway/server-methods/agent.test.tsis intentionally untouched.The three touched files shrink by 2,390 lines overall (1,392 additions, 3,782 deletions), while preserving every collected test.
User Impact
No user-visible runtime change. Maintainers get smaller, more legible regression suites with one canonical fixture-construction path.
Evidence
tbx_01kxcs4fmk1t3z8f4zzc4napyecorepack pnpm test src/agents/openai-transport-stream.test.ts: 331 before, 331 aftercorepack pnpm test src/auto-reply/reply/dispatch-from-config.test.ts: 267 before, 267 aftercorepack pnpm tsgo:core:test: passedoxfmt --check: passedscripts/run-oxlint.mjs: 0 warnings, 0 errorspnpm check:changedreaches the repository-wide TypeScript LOC ratchet, then stops on stale baseline entries outside these touched filesAI-assisted refactor; reviewed and validated against exact before/after test counts.