wsb clean ups#26
Merged
Merged
Conversation
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.
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.
No description provided.