Skip to content

test: answer a stray GET in the register-hook stand-in servers - #224

Merged
bompus merged 1 commit into
mainfrom
register-hook-flake-20261030
Oct 30, 2026
Merged

bompus merged 1 commit into
mainfrom
register-hook-flake-20261030

Conversation

@bompus

@bompus bompus commented Oct 30, 2026

Copy link
Copy Markdown
Owner

The test "two concurrent first edits of one session register once" in test/register-hook.test.ts failed 3 of 10 isolated runs on this host with SyntaxError: Unexpected end of JSON input and Bun's GET - / failed. It passes 30 of 30 with this change, and the whole file passed 3 of 3 runs (37 pass, 0 fail).

Cause. The failure is not a race between the two registering processes. Another process on this host sends GET / to new loopback listeners (user agent node, with b3 and traceparent headers; I captured four such requests in 12 runs). The file's stand-in mail servers parsed every request as JSON, so that bodiless GET threw inside fetch, and Bun failed whichever test owned the server. CI runners do not have that process, which is why CI stayed green. The registry's lock and state reread are sound; a reviewer traced withLock and settle and found no ordinary interleaving that registers twice.

Change. A strayRequest helper answers anything but a POST with 404, applied at the top of all six stand-in servers in this file (the shared fakeMail and five inline ones). A new test sends GET / to fakeMail and checks for a 404 and no recorded call; it fails without the guard with the same SyntaxError.

Not changed. test/mcp-relay.test.ts and test/wake-auto-t3.test.ts (lines 83, 174 and others) use the same parse-first pattern and can fail on the same GET; test/bridge-bridge.test.ts already handles it. The wake-auto-t3 test that failed once under load in my earlier full run may be the same cause; I did not reproduce it.

"two concurrent first edits of one session register once" failed about 3 of 10 isolated
runs on this host with "Unexpected end of JSON input". Another process here (user agent
node, with b3 and traceparent headers) sends GET / to new loopback listeners, and the
stand-in servers parsed every request as JSON, so the throw failed whichever test owned the
server. They now answer anything but a POST with 404. A new test sends the GET directly,
and fails without the guard. The race test passed 30 of 30 isolated runs with it.
@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 d88a286 into main Oct 30, 2026
2 checks passed
@bompus
bompus deleted the register-hook-flake-20261030 branch October 30, 2026 20:51
bompus added a commit that referenced this pull request Oct 30, 2026
…body (#225)

#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.
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