Skip to content

Fix vacuous drift test assertions and normalize proxy relay status codes#169

Open
jpr5 wants to merge 3 commits intomainfrom
blitz/aimock-fixes/integration
Open

Fix vacuous drift test assertions and normalize proxy relay status codes#169
jpr5 wants to merge 3 commits intomainfrom
blitz/aimock-fixes/integration

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented May 9, 2026

Summary

  • Remove vacuous shouldFail guard from all 21 drift test files (89 instances) — assertions now always run unconditionally, catching broken extraction logic and warning-level drift that previously passed silently with zero assertions
  • Normalize upstream HTTP status codes in 5 recorder proxy relay paths — 200 for success, 502 for errors — preventing provider implementation details (429, 503, 401, etc.) from leaking to aimock clients
  • Add 5 new status normalization tests with fixture preservation verification; fix test cleanup (awaited server.close in try/finally)

Test plan

  • All 2841 tests pass (79 files, 37 skipped)
  • TypeScript typecheck clean
  • Prettier + ESLint clean (pre-commit hooks pass)
  • 7-agent CR loop converged (R1: 2 bucket-a fixed, R2: 0 bucket-a, Procedure 3: 0 promotions)

jpr5 added 3 commits May 8, 2026 23:13
The shouldFail pattern silently passed with zero assertions when no
critical diffs were found — vitest does not fail on zero assertions
by default. This meant broken extraction logic or warning-level drift
went completely undetected.

Replace every `if (shouldFail(diffs)) { expect.soft(...) }` guard
with an unconditional `expect(diffs.filter(...)).toEqual([])` across
all 21 drift test files (89 instances). Remove the now-unused
shouldFail function from schema.ts.
Raw upstream HTTP status codes (429, 503, 401, etc.) were leaking
through to aimock clients in 5 recorder proxy relay paths, exposing
provider implementation details.

Normalize to 200 for success, 502 for errors — aimock is the gateway.
Fixture recording preserves the original upstream status for fidelity.

Paths fixed:
- recorder.ts non-SSE relay (writeHead with raw upstreamStatus)
- recorder.ts SSE streaming relay (res.statusCode passthrough)
- agui-recorder.ts success relay (exact 201/204 leak)
- agui-recorder.ts error relay (raw 401/429/503 passthrough)
- agui-recorder.ts timeout handler (implicit 200 instead of 502)
Add 5 tests verifying proxy relay status normalization (201→200,
429→502, 503→502, 401→502, SSE 429→502) with fixture preservation
assertions. Update 2 existing tests (500, 429) to expect normalized
502.

Fix test hygiene: wrap all raw server tests in try/finally with
awaited server.close() to prevent port leaks on assertion failure.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 9, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@169

commit: b0e3db2

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