Skip to content

fix(#44): harden remaining fixture blocks against silent setup failure - #63

Merged
jsirish merged 3 commits into
mainfrom
fix/44-fixture-setup-guard
Aug 26, 2026
Merged

fix(#44): harden remaining fixture blocks against silent setup failure#63
jsirish merged 3 commits into
mainfrom
fix/44-fixture-setup-guard

Conversation

@jsirish

@jsirish jsirish commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a fixture_repo() helper (tests/run.sh) that runs git init + an initial commit in a throwaway dir and, on failure, reports via bad() naming the dir - instead of the bare ( ... ) 2>/dev/null a setup failure could silently vanish into.
  • Replaces the 14 remaining unguarded git init && git commit fixture blocks (the project-root fixture plus FRESH_A..FRESH_N) with calls to the new helper.
  • The 3 worktree-specific chains already hardened in fix: shell hook test suite passes with no ambient git identity #43 (wt-linked, wt-old-linked, wt-ign-linked) are left as-is - they chain an additional git worktree add beyond what this helper covers, and already have their own || bad ... guard.

Follow-up from #42/#43 review (two independent PR review agents flagged this same structural pattern on the remaining fixture blocks).

Test plan

  • sh tests/run.sh - all 167 assertions pass
  • shellcheck -s sh tests/run.sh - clean
  • Manually verified the failure path: called fixture_repo against a nonexistent directory in isolation and confirmed it reports via bad() (FAIL=1) instead of silently succeeding
  • /local-ci --strict - all checks pass

Closes #44

🤖 Generated with Claude Code

https://claude.ai/code/session_011s2om7vED2R8ZohhkN11qe

jsirish and others added 3 commits August 25, 2026 23:04
Adds a fixture_repo() helper that runs git init + an initial commit in a
throwaway dir and, on failure, reports via bad() naming the dir - instead
of the bare ( ... ) 2>/dev/null a setup failure could silently vanish
into, surfacing downstream as a bogus assertion failure against
hooks/_lib.sh rather than "the fixture didn't build".

Replaces the 14 remaining unguarded git-init-and-commit fixture blocks
(the project-root fixture plus FRESH_A..N). The 3 worktree-specific
chains already hardened in #43 are left as-is; they run additional
commands (git worktree add) beyond what this helper covers.

Closes #44

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011s2om7vED2R8ZohhkN11qe
Extends the hardening to FRESH_G/G2/G3, which stage and commit a
pre-written .gitignore rather than an empty commit and so didn't fit
fixture_repo() verbatim - adds fixture_repo_gitignore() for that shape.
These three back the gitignore-nudge tests (12g/12g2/12g3), the exact
class of assertion #42 documented as misreporting a silent fixture
failure as a hooks/_lib.sh bug.

Also hardens fixture_repo() itself against its own worst failure mode:
under POSIX sh, `cd ""` is a no-op rather than an error, so an empty or
missing $1 would silently git-init the caller's own cwd instead of
reporting via bad(). Not reachable from any current call site (every
caller passes a non-empty, freshly-mkdir'd path), but a helper whose
entire purpose is turning silent failure loud should not have a silent
failure mode of its own.

Both gaps found by /review-pr on PR #63; verified live (empty-arg fired
bad() with no cwd side effect; a stray probe commit created during
verification was cleanly reset before this commit).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011s2om7vED2R8ZohhkN11qe
CI's apt-installed shellcheck flags the &&/|| guard added in fafc06e
(SC2015: not if-then-else, the else branch can run when the first check
is true) even though local shellcheck 0.11.0 (homebrew) doesn't. Rather
than chase version skew, switch both guards to an explicit if/then -
unambiguous either way and closer to this file's existing style (see
present()/dir_present()/absent() above).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011s2om7vED2R8ZohhkN11qe
@jsirish
jsirish merged commit 6a4e530 into main Aug 26, 2026
2 checks passed
@jsirish
jsirish deleted the fix/44-fixture-setup-guard branch August 26, 2026 04:13
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.

tests/run.sh: ~18 remaining fixture blocks still swallow setup failures silently

1 participant