f8f7392a
test: one birth is counted, not inferred from the session table
a73x 2026-08-26 14:26
Commit message
test/e2e.sh
| Old | New | ||
|---|---|---|---|
| @@ -8908,6 +8908,9 @@ wait_for "$OUT.wgh" "serving" 10 || { | |||
| 8908 | # before attaching, for mux.js's reason: a message sent while the hub is | 8908 | # before attaching, for mux.js's reason: a message sent while the hub is |
| 8909 | # still dialing is dropped, and an attach nobody read is a refusal that | 8909 | # still dialing is dropped, and an attach nobody read is a refusal that |
| 8910 | # never arrives. | 8910 | # never arrives. |
| 8911 | # Bracketing the script below is what makes "one birth" measurable at all | ||
| 8912 | # — see the delta assertion after it. | ||
| 8913 | WGATT_A=$(attaches_now "$SOCK67") | ||
| 8911 | set +e | 8914 | set +e |
| 8912 | timeout 60 "$WSCLIENT" --port "$WGPORT" --tile 0 --out "$OUT.wgws" --err "$OUT.wgws.err" <<'EOF' | 8915 | timeout 60 "$WSCLIENT" --port "$WGPORT" --tile 0 --out "$OUT.wgws" --err "$OUT.wgws.err" <<'EOF' |
| 8913 | expectstate up 25000 | 8916 | expectstate up 25000 |
| @@ -8924,6 +8927,17 @@ set -e | |||
| 8924 | [ "$RC" -eq 0 ] || { | 8927 | [ "$RC" -eq 0 ] || { |
| 8925 | echo "e2e FAIL: web-restore: the local tile's wsclient exited $RC" | 8928 | echo "e2e FAIL: web-restore: the local tile's wsclient exited $RC" |
| 8926 | cat -v "$OUT.wgws.err" 2>/dev/null; cat "$OUT.wgh"; exit 1; } | 8929 | cat -v "$OUT.wgws.err" 2>/dev/null; cat "$OUT.wgh"; exit 1; } |
| 8930 | WGATT_B=$(attaches_now "$SOCK67") | ||
| 8931 | |||
| 8932 | # ONE birth. Counting sessions cannot say this: `resolveSession` is | ||
| 8933 | # attach-or-create, so a second birth would find `wghost` and join, and | ||
| 8934 | # the table would read 2 whether the hub birthed once or twenty times. | ||
| 8935 | # `attaches` can, because a REFUSED attach deliberately does not move it: | ||
| 8936 | # the two counted here are the birth's own and the browser's second one | ||
| 8937 | # (the first was refused). A hub that re-birthed on every refused re-dial | ||
| 8938 | # lands one extra per turn. | ||
| 8939 | assert_attach_delta "$WGATT_A" "$WGATT_B" 2 \ | ||
| 8940 | "web-restore: the hub birthed once for one refused tile" | ||
| 8927 | 8941 | ||
| 8928 | # Tile 1, the REMOTE line: the refusal is forwarded untouched, and the | 8942 | # Tile 1, the REMOTE line: the refusal is forwarded untouched, and the |
| 8929 | # fixture tells it from a shell exiting exactly as the page does — an | 8943 | # fixture tells it from a shell exiting exactly as the page does — an |
| @@ -8981,10 +8995,11 @@ timeout 20 "$MUXA" status --sock "$SOCK67" --session wghost2 > "$OUT.wgghost" 2> | |||
| 8981 | echo "e2e FAIL: web-restore: a quic:// wall line created a session:" | 8995 | echo "e2e FAIL: web-restore: a quic:// wall line created a session:" |
| 8982 | cat "$OUT.wgghost"; exit 1; } | 8996 | cat "$OUT.wgghost"; exit 1; } |
| 8983 | 8997 | ||
| 8984 | # One birth, not two: a hub that re-birthed on every refused re-dial would | 8998 | # ...and nothing else was created behind either tile. Two, not one — |
| 8985 | # still pass every assertion above. Two, not one — `muxd run` makes the | 8999 | # `muxd run` makes the default session at startup, so the birth is the |
| 8986 | # default session at startup, so the birth is the SECOND. | 9000 | # SECOND. How MANY births happened is the attach delta's claim above; this |
| 8987 | wait_sessions "$SOCK67" 2 "web-restore: exactly one session was born" | 9001 | # one is that the table holds exactly the expected set. |
| 9002 | wait_sessions "$SOCK67" 2 "web-restore: the table holds the default session and wghost, nothing else" | ||
| 8988 | 9003 | ||
| 8989 | # ...and a shell the user ENDS stays ended. Every refusal closes the hub's | 9004 | # ...and a shell the user ENDS stays ended. Every refusal closes the hub's |
| 8990 | # connection (`server.dropObserver` closes the fd), so `exit` reaches the | 9005 | # connection (`server.dropObserver` closes the fd), so `exit` reaches the |