Repository navigation
test: answer a stray GET in every stand-in server that parses a JSON body - #225
Merged
Merged
Conversation
…body #224 fixed this for the register-hook stand-ins. The same parse-first pattern was in mcp-relay, wake-auto-t3 (7 servers) and mail tests, and one more wake-auto-t3 proxy asserted the path before reading the request: T3 Code's server (t3 serve) sends GET / to new loopback listeners, that GET throws in the handler, and whichever test owns the server fails. strayRequest now lives in test/fixtures and each server calls it first. test/stray-request.test.ts scans the test files and fails for a handler that calls json() without answering a stray request first; it listed these 9 handlers before the change.
Owner
Author
|
@coderabbitai full review |
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.
Finishes what #224 started: ten more test stand-in servers throw on a bodiless
GET /and fail whichever test owns them.T3 Code's server (
t3 serve; on this host a systemd user service) sendsGET /to every new loopback listener. A stand-in that parses each request as JSON throws on it (Unexpected end of JSON input), so the test running at that moment fails. #224 fixed this intest/register-hook.test.tsafter the race test failed 3 of 10 isolated runs. CI runners have no such process, so CI does not see it.Change (tests only).
strayRequest(req)moves totest/fixtures/stray-request.tsand answers anything but a POST with a 404.register-hook.test.tsimports it instead of its own copy. Each stand-in now calls it first:test/mcp-relay.test.ts(1; before it records the protocol-version header, so a stray GET is not counted),test/wake-auto-t3.test.ts(7 JSON-parsing servers, plus one proxy that asserted the request path before reading it),test/mail.test.ts(1, not in the original list).test/stray-request.test.tsscanstest/*.test.tsand fails when a handler callsreq.json()orrequest.json()without answering a stray request first. Before the change it listed exactly those nine handlers. It is a source scan, not a proof: it does not see other parameter names or other body readers, and its comment says so.Checked.
bun run checkpasses; the full suite passed (1470 pass, 7 skip, 0 fail) before the last small edit, and the five affected files pass after it (74 pass, 0 fail). An independent review found no regression and no other JSON-reading stand-in, and flagged the proxy above, which is fixed here. The wake-auto-t3 tests failing from this cause is plausible from the code but not reproduced; one failed once under load in an earlier full run.