fix(cli): exit 0 from --help and --version; repair the post-publish check (0.5.1) - #16
Merged
Merged
Conversation
…heck 0.5.0 published correctly — provenance and all — but the release run went red at the final step, and chasing that surfaced two real defects plus one false claim of mine. **`--help` and `--version` exited 1.** The CLI uses commander's `.exitOverride()`, which throws instead of exiting, including on its success paths: both raise a CommanderError carrying `exitCode: 0`. The handler read that with `Number(error.exitCode) || 1`, and `0 || 1` is `1`. The output was always right; only the status was wrong, so it reported failure to every shell, script and CI job that checked it. Inherited from `agents-audit`, where the same expression sits and — that package being frozen at 0.4.4 — will remain. Regression tests assert the exit code for `--help`, `--version` and the `version` subcommand, plus a guard that an unknown option still exits non-zero. Watched red against the pre-fix source: 2 failed, "expected 1 to be +0", exactly the two success paths. **The post-publish check could never pass.** It ran `<bin> --help`, so the bug above meant a non-zero result no matter how healthy the release. I previously reported this verifier as passing end-to-end for agents-audit, including in PR #14's checklist. It did not. I read `${PIPESTATUS[0]}` after piping through `tail`, which reports tail's status, and took visible help output as success without checking for the `Verified registry install...` line. It now runs `version` — a normal action returning 0, and a better check besides: it executes the installed entry point and prints the version the artifact actually carries, rather than text commander emits before any package code runs. Confirmed exit 0 against the live 0.5.0. **The propagation window was too short.** Measured on 0.5.0: the version endpoint answered at once, but the aggregated packument — what `npm install` resolves against — took ~4m30s. The old window summed to 75s. Now linear backoff with a 60s ceiling, ~6m30s total. A first publish is the slow case; there is no existing packument to update. Cut as 0.5.1 through the changeset flow, which this exercises for the first time: changeset added, `pnpm changeset version` bumped the manifest and wrote the changelog together. Also dated 0.5.0, which was still labelled Unreleased. Verified: architecture guard, typecheck, 108 tests, release:verify-packs on both tarballs, and verify-published.mjs exiting 0 against the published 0.5.0.
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
@workspacejson/cli@0.5.0published successfully — signed provenance, SLSA attestation, installs and runs. The release run still went red at the final step, and chasing that turned up two real defects and one false claim of mine.1.
--helpand--versionexited1The CLI uses commander's
.exitOverride(), which throws instead of exiting — including on its success paths, where both raise aCommanderErrorcarryingexitCode: 0. The handler read it as:The output was always correct; only the status was wrong — so both commands reported failure to every shell, script and CI job that checked them.
Inherited from
agents-audit, where the same expression sits. That package is frozen at0.4.4, so its--helpkeeps the old exit code permanently.Regression tests cover
--help,--version, theversionsubcommand, and a guard that an unknown option still exits non-zero. Watched red against the pre-fix source — 2 failed withexpected 1 to be +0, exactly the two success paths, while the guards passed both ways.2. The post-publish check could never pass
It ran
<bin> --help, so defect 1 guaranteed a non-zero result regardless of how healthy the release was.I previously reported this verifier as passing end-to-end for
agents-audit, including in #14's checklist. It did not pass. I read${PIPESTATUS[0]}after piping throughtail— which reportstail's status, not the script's — and took the visible help output as success without confirming theVerified registry install...line. The check has never passed for either package.It now runs
version: a normal action returning 0, and a stronger check besides — it executes the installed entry point and prints the version the artifact actually carries, rather than text commander emits before any package code runs. Confirmed exit 0 against the live0.5.0.3. The propagation window was too short
Measured on the 0.5.0 release: the version endpoint answered immediately, but the aggregated packument — what
npm installresolves against — took ~4m30s:The old window summed to 75s, so it failed a release that had published correctly. Now linear backoff with a 60s ceiling, ~6m30s total. A first-ever publish is the slow case: there is no existing packument to update.
Release
Cut as 0.5.1 through the changeset flow — its first real exercise. Changeset added,
pnpm changeset versionbumped the manifest and wrote the changelog in one step. Also dated0.5.0, still labelled Unreleased.Verification
pnpm run check:architecturepnpm -r typecheckpnpm -r buildpnpm -r test— 108 tests (64 + 44), including 4 newpnpm run release:verify-packs—workspacejson-cli-0.5.1.tgz,agents-audit-0.4.4.tgzverify-published.mjs @workspacejson/cli— exit 0 against the live 0.5.0, the first time this check has ever passedbash migration/parity-agents-audit-runtime.sh— not run locally; CI runs it unconditionally. Noagents-auditruntime code changed.Notes
Release after merge:
git tag cli-v0.5.1 && git push --tags.0.5.0 stays published and working — this is a follow-up patch, not a repair of a broken release. Users on 0.5.0 get correct behaviour from everything except the
--help/--versionexit status.