Skip to content

fix(repo bootstrap): report a distinct failed state per repository - #51

Merged
Th3Mouk merged 1 commit into
mainfrom
fix/bootstrap-report-repository-failure-state
Sep 3, 2026
Merged

fix(repo bootstrap): report a distinct failed state per repository#51
Th3Mouk merged 1 commit into
mainfrom
fix/bootstrap-report-repository-failure-state

Conversation

@Th3Mouk

@Th3Mouk Th3Mouk commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #50.

repo bootstrap always reported a non-skipped repository as executed — 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-text issues[] 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.status still resolves to warning (not error) for a per-repository command failure, and the process still exits 0. That behavior is an existing, documented, and consistently-applied CLI-wide convention — see the "Exit codes" section of docs/cli/commands.md and the 0.2.0 changelog entry that deliberately normalized warning to exit 0 "to match all other commands" (it already applies identically to repo git checkout|pull|sync and worktree 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 a state of "executed" | "skipped" | "failed" instead of a skipped boolean — mirroring the pattern WorktreeRemoveReport already uses for the same kind of per-repository outcome.
  • executeBootstrapPlan now returns which repository names failed (not just a flat issues[] array), so the report can mark the corresponding row failed after execution instead of only ever reflecting the pre-execution plan.
  • The human renderer paints failed in red (matching worktree remove's existing tone convention) instead of a misleading green executed, and the summary line now breaks out executed / skipped / failed counts separately.
  • Docs: repo bootstrap section now documents the state field 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.
  • Changelog: flagged as BREAKING for JSON consumers reading .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:

repo bootstrap: warning (1 executed, 0 skipped, 1 issues)
│ demo │ executed │ sh -c 'echo BOOTSTRAP_RAN; exit 3' │
EXIT=0

After:

repo bootstrap: warning (0 executed, 0 skipped, 1 failed, 1 issues)
│ demo │ failed   │ sh -c 'echo BOOTSTRAP_RAN; exit 3' │
EXIT=0

Test plan

  • pnpm build
  • pnpm typecheck
  • pnpm lint / pnpm format:check
  • pnpm test (190/190, including new/updated coverage in bootstrap-execution.test.ts, execution-service.test.ts, and human-renderer.test.ts)
  • Manual repro of the exact scenario from repo bootstrap exits 0 when a bootstrap command fails #50, before and after
  • pnpm test:audit-prod currently fails on main too (pre-existing shell-quote advisory, unrelated to this change — not touched here)

🤖 Generated with Claude Code

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>
@Th3Mouk
Th3Mouk merged commit d38faed into main Sep 3, 2026
5 of 7 checks passed
@Th3Mouk
Th3Mouk deleted the fix/bootstrap-report-repository-failure-state branch September 3, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repo bootstrap exits 0 when a bootstrap command fails

1 participant