Skip to content

wsb clean ups#26

Merged
afq984 merged 6 commits into
google:mainfrom
afq984:push-uwuozqxuowsw
Apr 13, 2026
Merged

wsb clean ups#26
afq984 merged 6 commits into
google:mainfrom
afq984:push-uwuozqxuowsw

Conversation

@afq984
Copy link
Copy Markdown
Collaborator

@afq984 afq984 commented Apr 13, 2026

No description provided.

afq984 added 6 commits April 13, 2026 22:26
Replace Result<T, String> with anyhow::Result<T> throughout. This
gives errors that implement std::error::Error, enables the ? operator
with .context()/.with_context() for chained error messages, and
removes manual format!() error construction.

StartArgs::run() now returns Result<u8> instead of ExitCode, with
main() handling the error-to-exit-code conversion and printing.
Test determinism (same path produces same ID), output format (16 hex
chars), and uniqueness (different paths produce different IDs).

Add wsb_unit_test target that compiles main.rs as a test binary.
Test socket path length rejection (>107 bytes), workspace.toml content
and directory creation, XDG_DATA_HOME override, and HOME fallback.

Add env_inherit for HOME to the unit test target. Use a mutex to
serialize tests that mutate environment variables.
Test three scenarios: dead process PID file is cleaned up along with
stale socket, live process PID is rejected with error, and no PID file
succeeds silently.
Test that wsb start rejects a file (not directory) as workspace path.
Verify that the PID file after startup contains the sandbox child PID,
not the launcher's own PID, and that it refers to a live process.
Send SIGTERM to the wsb process group and verify that both the socket
and PID file are removed after the launcher exits. This tests the
SIG_IGN + pre_exec SIG_DFL signal handling that allows wsb to survive
the signal and run cleanup.
@afq984 afq984 merged commit c026da8 into google:main Apr 13, 2026
3 checks passed
@afq984 afq984 deleted the push-uwuozqxuowsw branch April 13, 2026 22:25
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