fix(repo bootstrap): report a distinct failed state per repository - #51
Merged
Merged
Conversation
repo bootstrap always reported a non-skipped repository as "executed" in both the JSON and human table, even when its bootstrap command exited non-zero. The only signal that anything went wrong lived in the free-text issues[] list, with no structured link back to the repository row - readers (and scripts keying off repositories[]) saw a green "executed" next to a repository whose dependencies were never installed. BootstrapReport.repositories[] now carries a state of "executed", "skipped", or "failed" instead of a skipped boolean, mirroring the pattern WorktreeRemoveReport already uses for the same kind of per-repository outcome. The human table paints "failed" in red instead of a misleading green "executed". The report status still resolves to "warning" (not "error") for a per-repository command failure, and the process exit code is unchanged. That part is an intentional, documented, and already consistently-applied CLI-wide convention (see the "Exit codes" section of docs/cli/commands.md and the 0.2.0 changelog entry that normalized it across every command) - it is not the bug being fixed here. Fixes #50 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Closes #50.
repo bootstrapalways reported a non-skipped repository asexecuted— in both the human table and the JSON report — even when its bootstrap command exited non-zero. The only signal that anything went wrong lived in the free-textissues[]list, with no structured field on the repository row itself, so the table showed a green "executed" next to a repository whose dependencies were never installed.This PR is scoped to that specific gap. It intentionally does not change the exit code:
report.statusstill resolves towarning(noterror) for a per-repository command failure, and the process still exits0. That behavior is an existing, documented, and consistently-applied CLI-wide convention — see the "Exit codes" section ofdocs/cli/commands.mdand the0.2.0changelog entry that deliberately normalizedwarningto exit0"to match all other commands" (it already applies identically torepo git checkout|pull|syncandworktree remove). Changing that would be a separate, much larger discussion; this PR only fixes the report/table not telling the truth about what happened.Changes
BootstrapReport.repositories[]now carries astateof"executed" | "skipped" | "failed"instead of askippedboolean — mirroring the patternWorktreeRemoveReportalready uses for the same kind of per-repository outcome.executeBootstrapPlannow returns which repository names failed (not just a flatissues[]array), so the report can mark the corresponding rowfailedafter execution instead of only ever reflecting the pre-execution plan.failedin red (matchingworktree remove's existing tone convention) instead of a misleading greenexecuted, and the summary line now breaks outexecuted / skipped / failedcounts separately.repo bootstrapsection now documents thestatefield and reiterates that a per-repository failure does not affect the exit code, to head off the exact ambiguity reported in repo bootstrap exits 0 when a bootstrap command fails #50..data.repositories[].skipped(now.data.repositories[].state === "skipped").Reproduction
Verified against the exact repro from #50 (a local bare origin, a repository whose bootstrap command does
exit 3):Before:
After:
Test plan
pnpm buildpnpm typecheckpnpm lint/pnpm format:checkpnpm test(190/190, including new/updated coverage inbootstrap-execution.test.ts,execution-service.test.ts, andhuman-renderer.test.ts)pnpm test:audit-prodcurrently fails onmaintoo (pre-existingshell-quoteadvisory, unrelated to this change — not touched here)🤖 Generated with Claude Code