Bug: stale setup-token.sock remains after owner enrollment #51

Closed
opened 2026-10-07 07:13:02 +00:00 by kayg · 18 comments
Owner

Small bug: after owner enrollment, the private setup-token.sock file stays in the data dir. On monitor01 it is still there with timestamp 05:13, after the owner enrolled and after a restart at 07:12. The server stops serving tokens, but the stale socket file suggests to an operator that setup is still open. Fix: unlink the socket when enrollment consumes the token, and on start when an owner exists. Test both.

Small bug: after owner enrollment, the private `setup-token.sock` file stays in the data dir. On monitor01 it is still there with timestamp 05:13, after the owner enrolled and after a restart at 07:12. The server stops serving tokens, but the stale socket file suggests to an operator that setup is still open. Fix: unlink the socket when enrollment consumes the token, and on start when an owner exists. Test both.
Author
Owner

Start: branch fix-socket from dev ac03b1913b. Read #51 and parent #5 comments; investigating setup-token socket lifecycle.

Start: branch fix-socket from dev ac03b1913bfb6dd9b978477fc23ee5c88e276f67. Read #51 and parent #5 comments; investigating setup-token socket lifecycle.
Author
Owner

Finding: binds the private socket only when bootstrap returns a token (); it does not retire the stale path when an owner already exists. The listener has no enrollment lifecycle hook, while setup authority is consumed in . Added separate regression tests for both cases; first pre-fix test run is still compiling.

Finding: binds the private socket only when bootstrap returns a token (); it does not retire the stale path when an owner already exists. The listener has no enrollment lifecycle hook, while setup authority is consumed in . Added separate regression tests for both cases; first pre-fix test run is still compiling.
Author
Owner

Finding details: crates/infraternal-server/src/runtime.rs lines 184-186 bind only when bootstrap returns a token and leave the socket path alone when it does not. The listener at runtime.rs lines 293-318 has no enrollment lifecycle hook; setup authority is consumed in auth/webauthn.rs lines 107-149. Two regression tests cover both cases; pre-fix compilation is still running.

Finding details: crates/infraternal-server/src/runtime.rs lines 184-186 bind only when bootstrap returns a token and leave the socket path alone when it does not. The listener at runtime.rs lines 293-318 has no enrollment lifecycle hook; setup authority is consumed in auth/webauthn.rs lines 107-149. Two regression tests cover both cases; pre-fix compilation is still running.
Author
Owner

Pre-fix evidence: isolated Rust tests owner_enrollment_unlinks_setup_token_socket and startup_with_owner_unlinks_stale_setup_token_socket each fail 0 passed / 1 failed at the expected socket-absence assertion in crates/infraternal-server/src/runtime.rs. Implementing lifecycle notification and type-checked unlink now.

Pre-fix evidence: isolated Rust tests owner_enrollment_unlinks_setup_token_socket and startup_with_owner_unlinks_stale_setup_token_socket each fail 0 passed / 1 failed at the expected socket-absence assertion in crates/infraternal-server/src/runtime.rs. Implementing lifecycle notification and type-checked unlink now.
Author
Owner

Verification finding: the scratch-backed fixture path fixed agent_review, and the full server suite passed both new socket cases. One unrelated test failed under the parallel workspace run: auth::tests::review3_tests::review3_backend_reply_has_a_deadline panicked at crates/infraternal-server/src/auth/tests.rs:1505 with server closed websocket unexpectedly; suite result was 74 passed, 1 failed, 6 ignored in 146.25s. I will rerun it in isolation after the current fast gate.

Verification finding: the scratch-backed fixture path fixed agent_review, and the full server suite passed both new socket cases. One unrelated test failed under the parallel workspace run: auth::tests::review3_tests::review3_backend_reply_has_a_deadline panicked at crates/infraternal-server/src/auth/tests.rs:1505 with server closed websocket unexpectedly; suite result was 74 passed, 1 failed, 6 ignored in 146.25s. I will rerun it in isolation after the current fast gate.
Author
Owner

Finding: the existing unrelated auth deadline test still fails in isolation. cargo test -p infraternal-server --lib review3_backend_reply_has_a_deadline -- --nocapture failed after 28.83s at review3_tests.rs:619: the received frame was not the expected failed Result for call 78. That file and websocket path are unchanged by this patch; investigating gate impact before final verification.

Finding: the existing unrelated auth deadline test still fails in isolation. cargo test -p infraternal-server --lib review3_backend_reply_has_a_deadline -- --nocapture failed after 28.83s at review3_tests.rs:619: the received frame was not the expected failed Result for call 78. That file and websocket path are unchanged by this patch; investigating gate impact before final verification.
Author
Owner

Finding: I repeated review3_backend_reply_has_a_deadline with the three patch files stashed (HEAD ac03b19). It failed identically at review3_tests.rs:619 after 31.85s, so this deadline-test failure predates the socket change. Restored the issue 51 patch.

Finding: I repeated review3_backend_reply_has_a_deadline with the three patch files stashed (HEAD ac03b19). It failed identically at review3_tests.rs:619 after 31.85s, so this deadline-test failure predates the socket change. Restored the issue 51 patch.
Author
Owner

Finding: full scripts/verify fast exited 1 because the unchanged base test auth::tests::review3_tests::review3_backend_reply_has_a_deadline failed at review3_tests.rs:619; 74 server tests passed, 1 failed, 6 ignored (114.15s). The same failure reproduced with patch files stashed at HEAD ac03b19. Both requested socket lifecycle tests and the symlink/regular-file preservation test passed in this run. cargo-deny and static builds passed; TypeScript checks did not run after the Rust gate failure.

+---------------------------+--------------+
| Rust gate | Result |
+---------------------------+--------------+
| fmt | PASS |
| VT native fmt | PASS |
| clippy | PASS |
| test | FAIL (101) |
| cargo-deny | PASS |
| static builds | PASS |
+---------------------------+--------------+

Static sizes: x86_64 16156720 bytes; aarch64 13571944 bytes; PT_INTERP absent for both.

Finding: full scripts/verify fast exited 1 because the unchanged base test auth::tests::review3_tests::review3_backend_reply_has_a_deadline failed at review3_tests.rs:619; 74 server tests passed, 1 failed, 6 ignored (114.15s). The same failure reproduced with patch files stashed at HEAD ac03b19. Both requested socket lifecycle tests and the symlink/regular-file preservation test passed in this run. cargo-deny and static builds passed; TypeScript checks did not run after the Rust gate failure. +---------------------------+--------------+ | Rust gate | Result | +---------------------------+--------------+ | fmt | PASS | | VT native fmt | PASS | | clippy | PASS | | test | FAIL (101) | | cargo-deny | PASS | | static builds | PASS | +---------------------------+--------------+ Static sizes: x86_64 16156720 bytes; aarch64 13571944 bytes; PT_INTERP absent for both.
Author
Owner

Blocked: scripts/verify fast cannot pass while the unchanged review3_backend_reply_has_a_deadline test fails; it also failed with patch files stashed at base ac03b19. Gate runs recorded 22–25 load average on this 8-core host. The issue patch remains uncommitted at this point because docs/PROCESS.md §2 requires every commit to pass the fast gate. Next needed from kayg: a quieter slot/runner to retry, or a decision to include a separate repair for that existing test.

Blocked: scripts/verify fast cannot pass while the unchanged review3_backend_reply_has_a_deadline test fails; it also failed with patch files stashed at base ac03b19. Gate runs recorded 22–25 load average on this 8-core host. The issue patch remains uncommitted at this point because docs/PROCESS.md §2 requires every commit to pass the fast gate. Next needed from kayg: a quieter slot/runner to retry, or a decision to include a separate repair for that existing test.
Author
Owner

Run 2 start: continuing branch fix-socket from base ac03b1913b. Read all #51 and parent #5 comments. Orchestrator directed a separate #65 flaky-test repair before the socket commit; I am measuring the four named regressions before changes.

Run 2 start: continuing branch fix-socket from base ac03b1913bfb6dd9b978477fc23ee5c88e276f67. Read all #51 and parent #5 comments. Orchestrator directed a separate #65 flaky-test repair before the socket commit; I am measuring the four named regressions before changes.
Author
Owner

The required separate flaky-test prerequisite is underway on #65. Base-load evidence so far: review3_backend_reply_has_a_deadline 10/20 failed, review3_busy_expiry 13/20 failed, and the shim detached-producer test 20/20 failed during child startup (ENOENT, no socket within 10 s); load ranged about 20–25. The #51 socket regression evidence and patch remain intact.

The required separate flaky-test prerequisite is underway on #65. Base-load evidence so far: review3_backend_reply_has_a_deadline 10/20 failed, review3_busy_expiry 13/20 failed, and the shim detached-producer test 20/20 failed during child startup (ENOENT, no socket within 10 s); load ranged about 20–25. The #51 socket regression evidence and patch remain intact.
Author
Owner

Additional #65 baseline evidence: review4_ten_second_open_preserves_authority, run with its exact test path, passed 5/20 and failed 15/20 with 'server closed websocket unexpectedly' under load 38.28/32.71/25.38; successful runs took a median 15.11 s because of two fixed 10 s waits. CPUWeight and post-change runs remain.

Additional #65 baseline evidence: review4_ten_second_open_preserves_authority, run with its exact test path, passed 5/20 and failed 15/20 with 'server closed websocket unexpectedly' under load 38.28/32.71/25.38; successful runs took a median 15.11 s because of two fixed 10 s waits. CPUWeight and post-change runs remain.
Author
Owner

Correction to my prior #65 update: direct shim-binary runs from the workspace root had the wrong CWD for the fixture's ../../target path. Discard the reported 20/20 shim startup failures; I stopped the run and am repeating from crates/infraternal. Server-test baseline results are unaffected.

Correction to my prior #65 update: direct shim-binary runs from the workspace root had the wrong CWD for the fixture's ../../target path. Discard the reported 20/20 shim startup failures; I stopped the run and am repeating from crates/infraternal. Server-test baseline results are unaffected.
Author
Owner

The flaky-test prerequisite has valid before measurements in #65: under load, backend 10/20, busy expiry 7/20, review4 open 5/20, detached producer 7/20; under the requested CPUWeight scope, 19/20, 20/20, 19/20 and 20/20. Review4 passing runs took median 15.11 s due to fixed waits; shim load failures hit the 2 s detached-output assertion. I am building the test-only deadline and state-synchronization changes now.

The flaky-test prerequisite has valid before measurements in #65: under load, backend 10/20, busy expiry 7/20, review4 open 5/20, detached producer 7/20; under the requested CPUWeight scope, 19/20, 20/20, 19/20 and 20/20. Review4 passing runs took median 15.11 s due to fixed waits; shim load failures hit the 2 s detached-output assertion. I am building the test-only deadline and state-synchronization changes now.
Author
Owner

Finished at HEAD fbe257906a. The flaky-test repair is the preceding commit c5af3d1; the #51 fix is fbe2579. Enrollment cleanup, existing-owner startup cleanup and private socket tests passed 3/3; the symlink and regular-file preservation test passed 1/1. The tests-first failures are recorded above.

The combined final tree passed scripts/verify fast, run as systemd-run --user --scope --quiet --property=CPUWeight=10000 -- scripts/verify fast (exit 0). Verbatim gate summary:

METRIC name=network_rtt_selftest configured_rtt_ms=300 jitter_ms=30 loss=unsupported transport=tcp-stream n=3 p50_ms=303.56 p99_ms=306.60 result=PASS
+---------------------------+--------------+
| Rust gate                 | Result       |
+---------------------------+--------------+
| fmt                       | PASS         |
| VT native fmt             | PASS         |
| clippy                    | PASS         |
| test                      | PASS         |
| cargo-deny                | PASS         |
| static builds             | PASS         |
+---------------------------+--------------+
JavaScript transfer: identity=800596 gzip=243302/307200 brotli=199731/256000 bytes
stream differential: 134 streams, 11439 schedules, zero divergences
7 pass
0 fail
Finished at HEAD fbe257906a75b5013ba932e86a14bb4905332aac. The flaky-test repair is the preceding commit c5af3d1; the #51 fix is fbe2579. Enrollment cleanup, existing-owner startup cleanup and private socket tests passed 3/3; the symlink and regular-file preservation test passed 1/1. The tests-first failures are recorded above. The combined final tree passed `scripts/verify fast`, run as `systemd-run --user --scope --quiet --property=CPUWeight=10000 -- scripts/verify fast` (exit 0). Verbatim gate summary: ```text METRIC name=network_rtt_selftest configured_rtt_ms=300 jitter_ms=30 loss=unsupported transport=tcp-stream n=3 p50_ms=303.56 p99_ms=306.60 result=PASS +---------------------------+--------------+ | Rust gate | Result | +---------------------------+--------------+ | fmt | PASS | | VT native fmt | PASS | | clippy | PASS | | test | PASS | | cargo-deny | PASS | | static builds | PASS | +---------------------------+--------------+ JavaScript transfer: identity=800596 gzip=243302/307200 brotli=199731/256000 bytes stream differential: 134 streams, 11439 schedules, zero divergences 7 pass 0 fail ```
Author
Owner

Self-review complete: enrollment publishes cleanup only after commit; cleanup targets only the fixed name and verifies the pathname itself is a socket with symlink_metadata; remove_file does not follow a replacement symlink. Cleanup logs contain only a static operation label. Production deadlines and dependencies are unchanged.

Self-review complete: enrollment publishes cleanup only after commit; cleanup targets only the fixed name and verifies the pathname itself is a socket with symlink_metadata; remove_file does not follow a replacement symlink. Cleanup logs contain only a static operation label. Production deadlines and dependencies are unchanged.
Author
Owner

Deployed dev 9e09924 to monitor01 (root, 2026-10-07 ~17:20): retire the setup-token socket (#51, verified: socket absent after start with an owner present), local lossless terminal themes (#75), test stabilisation (#65), binary size budget (#57). Gate before deploy: scripts/verify fast exit 0 (6/6 Rust PASS, static size 16,160,816 B within 16,404,816 B, TS 7/7, browser 2/2, RTT smoke PASS). Previous binary kept at /usr/local/bin/infraternal.prev and web at web.prev for rollback.

Deployed dev 9e09924 to monitor01 (root, 2026-10-07 ~17:20): retire the setup-token socket (#51, verified: socket absent after start with an owner present), local lossless terminal themes (#75), test stabilisation (#65), binary size budget (#57). Gate before deploy: scripts/verify fast exit 0 (6/6 Rust PASS, static size 16,160,816 B within 16,404,816 B, TS 7/7, browser 2/2, RTT smoke PASS). Previous binary kept at /usr/local/bin/infraternal.prev and web at web.prev for rollback.
Author
Owner

Closed by the orchestrator during the 2026-10-28 handover (#254), on the owner's request to close finished issues. Evidence: Setup-token socket retired; merged as b5e677956, deployed to monitor01 and verified socket absent after start with an owner present; b5e677956 is in dev and prod. Reopen if anything is still missing.

Closed by the orchestrator during the 2026-10-28 handover (#254), on the owner's request to close finished issues. Evidence: Setup-token socket retired; merged as b5e677956, deployed to monitor01 and verified socket absent after start with an owner present; b5e677956 is in dev and prod. Reopen if anything is still missing.
kayg closed this issue 2026-10-28 17:52:28 +00:00
Sign in to join this conversation.
No labels
launch-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/infraternal#51
No description provided.