Skip to content

test: answer a stray GET in every stand-in server that parses a JSON body - #225

Merged
bompus merged 1 commit into
mainfrom
stray-get-guard-20261030
Oct 30, 2026
Merged

bompus merged 1 commit into
mainfrom
stray-get-guard-20261030

Conversation

@bompus

@bompus bompus commented Oct 30, 2026

Copy link
Copy Markdown
Owner

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) sends GET / 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 in test/register-hook.test.ts after 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 to test/fixtures/stray-request.ts and answers anything but a POST with a 404. register-hook.test.ts imports 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.ts scans test/*.test.ts and fails when a handler calls req.json() or request.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 check passes; 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.

…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.
@bompus bompus added the author:anthropic Changes authored with an Anthropic model; select an independent reviewer label Oct 30, 2026
@bompus

bompus commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Sol, xhigh reasoning): 0 finding(s).

@bompus
bompus merged commit 712a0c3 into main Oct 30, 2026
2 checks passed
@bompus
bompus deleted the stray-get-guard-20261030 branch October 30, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:anthropic Changes authored with an Anthropic model; select an independent reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant