Fix vacuous drift test assertions and normalize proxy relay status codes#169
Open
Fix vacuous drift test assertions and normalize proxy relay status codes#169
Conversation
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.
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shouldFailguard 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 assertionsTest plan