Repository navigation
test(ui-server): join the journal's startup release before counting native sockets - #3552
Merged
Merged
Conversation
Owner
Author
schlessera
marked this pull request as ready for review
November 4, 2026 05:34
3 tasks
Owner
Author
This was referenced Nov 4, 2026
…ative sockets The dirty failed mount case counted a seventh native-manager socket when the turn journal's startup maintenance pass had committed its observation and handed the previous checkpoint to its background release (#2872) while the case's six ready() calls connected. Await the pass and releasesSettled() before counting, so the case observes only its own six sockets. Closes #3550 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
schlessera
force-pushed
the
test/3550-dirty-mount-seventh-socket
branch
from
November 4, 2026 12:06
00d204a to
953c459
Compare
schlessera
marked this pull request as draft
November 4, 2026 12:07
schlessera
marked this pull request as ready for review
November 4, 2026 12:07
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.
Closes #3550
What changed
The "dirty failed mount" case in
packages/ui-server/tests/http-supported-mounts.test.tsnow waits until the fresh app's turn journal has settled before it opens its sixnative.ready()calls and counts native-manager sockets. It awaits the journal'sready, then its startup maintenance pass (maintain()), thenreleasesSettled(). No assertion changed: the case still requires exactly six sockets, six re-armed idle deadlines and zero pending timers after native shutdown.Why this shape
The seventh socket's caller, captured from failing runs with an env-gated stack log on the native client's
calland on the observer'srelease(instrumentation not committed):The journal's startup idle pass (
turn-journal.ts:352,void maintain()oncereadysettles) commits an observation. The commit hands the previous root checkpoint to the observer's background release owner (#2872).maintain()settles when the observation commits, not when that release finishes, so the release's native request can still hold a socket while the case's six requests connect.Not a product leak. The journal owns the release, serializes it, joins it in
close()(native-journal-observer.tsclosedrainsreleasesSettled) and exposesreleasesSettled()as its completion barrier. Releasing outside the observation's hold is the deliberate #2872 design. The race was in the test: it counted before the app had settled.Why not
maintain()alone, as #3342's5e8939bcetried: it covers the pass but not the release that the pass defers (mutation A below). Why not count only the case's own sockets: afterreleasesSettled()resolves, the release's socket is free and gets reused, so the original oracle stays exact. Waiting on the completion barrier followsdocs/process/test-waits.md(await the operation's acknowledgement, no sleeps).Proof
Each loop below ran
bun test --timeout 30000 tests/http-supported-mounts.test.ts -t 'dirty failed mount'inpackages/ui-server, using a private TMPDIR.2fa67923d(before)Expected length: 6 / Received length: 735313bdfa(after)await journal!.releasesSettled(), keepmaintain()Received length: 7athttp-supported-mounts.test.ts:294(toHaveLength(6))finally { await fresh.t.close(); }instead of joining sockets incloseHttpMountFixtureHTTP_MOUNT_PENDING_TIMERS {"phase":"fresh-native-sockets-closed","pending":6,...}: six 5000 ms socket idle deadlines still pending after native shutdownBoth mutations were restored, and the tree was checked against the committed file.
NODE_OPTIONS=--max-old-space-size=8192 bunx tsc --noEmitat the root exited 0.http-supported-mounts.test.tsfile locally: 104 pass, 9 fail. All 9 aremounted supported handlercases (/api/brain/*,/api/schedules/proposals) failing withAgent worker boundary unavailable: unshare: write failed /proc/self/uid_map. This host has no unprivileged user namespaces, which the issue's Verification notes the rest of the file needs. The changed case passes there. The full ui-server suite was not completed locally on this host; the hostedunitjobs are the authoritative proof.Rebased onto main
5d461c516without conflicts (re-committed as953c4599c, same tree, because a GitHub outage dropped the first rebased push's PR synchronisation), after #3557 fixed the #3553 flake that failed the first candidate (run 41780062866). Collisions at the rebased head: a textual overlap with #3342; the rest are closure overlaps.check:prre-ran at the rebased head:{"version":1,"kind":"brain-check-pr-receipt","head":"953c4599c5cfd7b577c4261c5d7c3496f72c0fc9","base":"origin/main","mode":"focused","startedAt":"2026-11-04T12:06:17.502Z","finishedAt":"2026-11-04T12:06:42.250Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":11649.769231},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":129.55273399999714},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":101.35281699999905},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":16.226591000002372},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":12831.695647}]}Collisions:
bun scripts/collisions.ts --paths packages/ui-server/tests/http-supported-mounts.test.tsreports a path collision with #3342, the PR this unblocks. #3342 can drop its ownmaintain()await once this lands. All other reports are closure-level onui-server.Checklist
docs/reflect the change, or nothing documented moved.docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed.Anything left open
unitis the proof of record for it.🤖 Generated with Claude Code