Skip to content

Prepare worker socket permissions before announcing readiness - #142

Merged
bitomule merged 1 commit into
mainfrom
worktree-t-mav-worker-socket-readiness
Nov 13, 2026
Merged

bitomule merged 1 commit into
mainfrom
worktree-t-mav-worker-socket-readiness

Conversation

@bitomule

Copy link
Copy Markdown
Owner

Worker startup currently treats a socket pathname as available before its permissions are configured. The existing lifecycle test can observe that intermediate state. Prepare the socket with bind → chmod(0600) → listen, then announce readiness after worker initialization. Keep the process umask unchanged.

The tests now synchronize with startup explicitly and still check the exact 0600 mode, ping, stop, and removal. Channel barriers verify that connections and readiness are unavailable before chmod. Failure tests cover chmod errors, retry, and replacement sockets. Cleanup retains the identity captured at bind instead of adopting a replacement's inode.

Validation:

  • Fresh origin/main at bcce929: the original test passed 100 runs. A temporary barrier before chmod reproduced socket mode=755 want 600 deterministically.
  • Six focused startup/lifecycle tests pass with -race -count=10 and inherited umasks 000, 002, and 077 in separate processes.
  • go test ./... and go vet ./... pass.
  • macOS arm64 and amd64 builds pass. Linux amd64 test compilation passes; Linux execution was not performed.
  • Independent static review completed.

Regression checks used temporary Go overlays, leaving the fixed source unchanged. Each variant failed its targeted test:

listen before chmod: socket accepted a connection before chmod
early readiness: worker announced readiness before chmod
missing chmod: socket mode=755 want 600
missing failure cleanup: socket remains after chmod failure

The fixed source passes all four checks. Timeouts only bound failures; the new startup tests use no sleeps or permission polling.

@bitomule
bitomule merged commit 0f6cf50 into main Nov 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant