fix(doctor): exit nonzero on failed checks#23
Open
NianJiuZst wants to merge 4 commits into
Open
Conversation
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.
What Problem This Solves
bsk doctorrendered individual checks asok,FAIL, orN/A, but the top-level command discarded those results with.map(|_| ()). As long as collecting and printing the report itself did not encounter an I/O/serialization error, the process returned exit code 0—even when one or more checks explicitly reportedFAIL.That makes the command unreliable for every non-interactive consumer. Shell scripts using
set -e, installers validating a setup, CI smoke tests, and monitoring tools all interpreted an unhealthy BrowserSkill installation as healthy unless they separately parsed human text or JSON fields.How This Fix Works
has_failuresverdict helper that treats onlyCheckStatus::Failas unsuccessful.NotApplicableremains informational and does not fail the command.CliError::RenderedExitpath for commands that have already emitted their full result but need a command-specific status code. This avoids printing a duplicate error and avoids misclassifying a failed health check as a daemon/RPC protocol error.okorN/A.User Impact
bsk doctoris now safe to use as a health gate:Users still receive the complete diagnostic table or JSON array, including all repair hints. The only behavior change is that an actual
FAILnow produces exit code 1, whileN/Aalone does not.CI Baseline Compatibility
This branch also contains the one-line Biome 2.4 formatting update required by the current lockfile.
upstream/maincurrently fails its own Frontend CI job on this pre-existingvitest.config.tsformatting mismatch; including the minimal formatter output allows this PR's workflow to pass lint and reach the remaining checks.Validation
cargo fmt --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo test --workspace --lockedstatus_cmdsuite verifies exit code 1 while preserving valid human/JSON doctor output.FAILchanges the verdict,N/Adoes not, and the rendered-only exit path has no fabricated protocol code.node --test scripts/*.test.mjspnpm lintpnpm --filter @browser-skill/extension compilepnpm ext:test(35 files, 373 tests)pnpm ext:buildCI Reliability Follow-up
GitHub Actions exposed a pre-existing test-only port allocation race: integration helpers probed an ephemeral port, released it, and then asked the daemon to bind the same number, allowing another process to claim it in between. The resulting
Address already in usefailure was unrelated to the functional changes. The PR now lets each daemon bind port0directly and reads the assigned address from its handle, removing the TOCTOU window across all affected integration helpers.