Repository navigation
test(e2e): prove network probe budget and resolved-address fetch (HACK-1428) - #484
Merged
Merged
Conversation
…K-1428) The peer probe charges name resolution against one per-URL budget and fetches the address it just resolved, but no test failed when either behavior was removed. Two tests now run the probe with a stubbed Bun.dns.lookup: one resolves RFC 6761 .invalid names to 127.0.0.1 and checks both requests reached that address, and one delays resolution and checks the HTTP phase only gets the remaining budget. The create shim oracle flake (Expected 71, Received 128) was bun test's 5 s default timeout firing on a loaded host: bun test SIGTERMs the running shim and the runner mapped the signaled exit to a bare 128. The fixture test file now sets a 60 s default, and the runner reports a signaled command as 128 plus its signal number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-ups after #470 (e08f971). Test and fixture-harness changes only; no product code changes.
Root cause
127.0.0.1orlocalhosttakes about 0 ms, and the hung-probe bound (< 2000 ms for a 300 ms budget) was loose. SoMath.max(1,${timeout}-d)→${timeout}still passed.target.hostname = …x.addressstill passed.Expected: 71, Received: 128). The test makes nine shim invocations in sequence, and each one starts one or two Bun processes. On a loaded host this took longer than bun test's 5 s default timeout. When the timeout fires, bun test SIGTERMs the still-running shim ("killed 1 dangling process"). The runner mapped the signaled exit (code === null) to a bare128. The timed-out test then keeps running while later tests run, and itsexpect(…).toBe(71)fails. Bun reports that as "Unhandled error between tests", so the visible failure isExpected 71 / Received 128and not the timeout. A minimal repro outside the repo showed the same thing: a test whose child outlives the timeout getsexit code=null signal=SIGTERM, thenExpected: 71 Received: 128as an unhandled error between tests. The same mechanism also hitprobe scripts exit with a closed code…(Received: 143, fromBun.spawn's 128+15).Fix
tests/native-networks-fixture.test.tspeer probe fetches the address it just resolved: replacesBun.dns.lookupin the probe child with a stub that resolves RFC 6761.invalidnames to 127.0.0.1. The probe must pass, and the server must seeHost: 127.0.0.1:<port>on both requests. A second, real resolution of a.invalidname cannot succeed.peer probe charges resolution time against the shared per-URL budget: the stub delays resolution by 1200 ms with a 2000 ms budget against a hung endpoint. It assertsdnsMs ≥ 1150,elapsedMs ≥ 1950, andelapsedMs < 2600(a fresh full budget ends near 3200). It also checks that a 500 ms budget with a 1200 ms resolution exitsdnsTimeout(31) withphase: dnsat 450–1200 ms.capture reports a signaled command as 128 plus its signal number(SIGTERM → 143, SIGKILL → 137).setDefaultTimeout(60_000)for this file, followingtests/native-compose-ownership.test.ts. Every fixture command and probe keeps its own, tighter timeout.tests/e2e/native-config-networks-acceptance.ts:runNativeNetworkFixtureCommandreports a signaled command as128 + signal number, as a shell does, so a future kill names its signal. The timeout and oversize paths still throw before any exit code is returned. Nothing compared the exit code with128.Evidence (local, macOS, Bun 1.4.2; host load average 45–110 from other work)
Mutations (each reverted afterwards):
-t probe)Math.max(1,${timeout}-d)→${timeout}Expected: < 2600, Received: 3211target.hostname=…x.address;(keeplet ok=false;)code 26, not 0); budget test fails (Expected 27, Received 26)code ?? 128(signal ignored)Expected: 143, Received: 128Flake loops (
bun test tests/native-networks-fixture.test.ts, privateHOME/HACK_HOME/DOCKER_CONFIG,HACK_SECRETS_DISABLE_KEYCHAIN_FALLBACK=1, no Docker):-t "strict argv oracle"), 40 runsExpected: 98, Received: 128plus the closed-code probe test withReceived: 143Gates:
bun run check(includesprivacy:check) passes,bun run --cwd packages/cli typecheckreports 0 errors (it includestests/), commitlint passes, and gitleaks 8.30.1 finds no leaks overorigin/next..HEAD. The CLI surface and agent guidance did not change. Hosted CI at the PR head is the full-suite evidence.Gaps
testand docker-e2e shards at this head are the full-suite proof; Docker e2e was not run locally.afterAllgit statustimed out at 5 s under load (tests/helpers/checkout-write-guard.ts). That is outside this unit and is reported separately.[${x.address}]) still has no test.bun test) left one BunSIGABRTcrash report from an orphaned child. The loops that ran to completion added none.Refs HACK-1428
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.