test(args): regression coverage for BoolishValueParser on env bools#89
Merged
Mikola Lysenko (mikolalysenko) merged 1 commit intoMay 28, 2026
Merged
Conversation
Two new tests in cli_global_args.rs: - bool_env_vars_accept_one_and_yes: SOCKET_OFFLINE=1, SOCKET_GLOBAL=yes, SOCKET_JSON=on, etc. all parse as `true`. Pins the BoolishValueParser wiring we just added — without it clap fails with `error: invalid value '1' for '--offline'` (the bug that prompted the fix). - bool_env_vars_reject_zero_and_falsey: SOCKET_OFFLINE=0, SOCKET_DEBUG=false, SOCKET_TELEMETRY_DISABLED=no, SOCKET_JSON=off all parse as `false`. Guards against an over-eager parser flipping a bool on any non-empty string. Both new tests + the existing env_vars_populate_global_args are now `#[serial]` — env-var state is process-global, so parallel test runs race the cleanup. Without serialization the negative-case test flakes by inheriting `SOCKET_OFFLINE=1` from the positive case. Assisted-by: Claude Code:opus-4-7
Wenxin Jiang (Wenxin-Jiang)
approved these changes
May 28, 2026
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.
Summary
Follow-up to #82 (telemetry coverage + paid-tier fallback). PR #82 wired
clap::builder::BoolishValueParseronto every bool global with an env attribute soSOCKET_OFFLINE=1,SOCKET_DEBUG=1, etc. parse correctly — previously they crashed clap witherror: invalid value '1' for '--offline'.That commit shipped without paired regression tests; I added them on the same branch but they landed after the squash-merge cutoff. This PR is just those tests, rebased onto the current main.
Two
#[serial]tests incrates/socket-patch-cli/tests/cli_global_args.rs:bool_env_vars_accept_one_and_yes—SOCKET_OFFLINE=1,SOCKET_GLOBAL=yes,SOCKET_JSON=on,SOCKET_VERBOSE=1,SOCKET_SILENT=y,SOCKET_DRY_RUN=1,SOCKET_YES=yes,SOCKET_BREAK_LOCK=1,SOCKET_DEBUG=1,SOCKET_TELEMETRY_DISABLED=1all parse astrue.bool_env_vars_reject_zero_and_falsey—SOCKET_OFFLINE=0,SOCKET_DEBUG=false,SOCKET_TELEMETRY_DISABLED=no,SOCKET_JSON=offall parse asfalse. Guards against an over-eager parser flipping a bool on any non-empty string.The existing
env_vars_populate_global_argsis also marked#[serial]in this commit — env-var state is process-global, so without serialization the negative-case test flakes by inheritingSOCKET_OFFLINE=1from the positive case running concurrently.Test plan
cargo test -p socket-patch-cli --test cli_global_argsclean against current main (post-refactor in refactor: dedupe ecosystem dispatch, telemetry, API client, cleanup, get #88).Assisted-by: Claude Code:opus-4-7