Skip to content

fix: handle empty staged files in pre-commit hook#95

Merged
jmcte merged 1 commit into
mainfrom
codex/fix-empty-precommit-hook
Jul 22, 2026
Merged

fix: handle empty staged files in pre-commit hook#95
jmcte merged 1 commit into
mainfrom
codex/fix-empty-precommit-hook

Conversation

@jmcte

@jmcte jmcte commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make the generated pre-commit hook safe when its staged-file list is empty under Bash set -u.
  • Add a smoke test that invokes the generated hook from a clean feature branch.

Governing Issue

Closes #109.

Validation

  • TMPDIR=/tmp npm run check (23 test files, 194 tests passed)
  • npm run build
  • bash scripts/ci/check-action-pins.sh (42 pins passed)
  • git diff --check origin/main...HEAD
  • Original exact-head autoreview reported no accepted/actionable findings; rebased patch retains stable patch-id e3edfd4aeee202498289c2bebca2054ac119432c.
  • Required PR checks are expected to satisfy CI Gate.

Bootstrap Governance

  • Changes remain scoped to Bootstrap's generated hook and its regression coverage.
  • Contributor guidance and managed-repository policy are unchanged.
  • No secrets, credentials, or machine-local state are introduced.
  • The placeholder commit identity was replaced with the repository maintainer's verified GitHub no-reply identity during rebase.

Material change: no

Merge Automation

  • Auto-merge is armed with squash merge for the current head.

Notes

Current head: 9ae56f973d32c49cf12f4f51c48c176fe039a678.

The previous head 0addaae10a44cce10fff99651631a882b774cf7f and rebased head carry the same stable patch-id. The rebase changes only ancestry and commit identity; behavior remains the previously reviewed two-file fix.

@athena-omt athena-omt added status:needs-review PR is ready for Athena review. review:athena Athena review governance requested. labels Jul 18, 2026

@athena-omt athena-omt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head 0addaae locally. The empty-array guard correctly preserves hook behavior, and the new clean-feature-branch regression covers the failure path. Targeted smoke test and typecheck passed. Branch is current with main and mergeable, but Claude and Cloudflare check suites remain queued; deferring approval until CI settles.

Keep strict-mode hook execution working for metadata-only commits with no staged paths.

Signed-off-by: John McChesney TenEyck Jr <59268465+jmcte@users.noreply.github.com>
@jmcte
jmcte force-pushed the codex/fix-empty-precommit-hook branch from 0addaae to 9ae56f9 Compare July 22, 2026 22:37
@jmcte
jmcte requested review from athena-omt and pheidon July 22, 2026 22:37
@jmcte
jmcte enabled auto-merge (squash) July 22, 2026 22:37
@jmcte

jmcte commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebase evidence for current head 9ae56f973d32c49cf12f4f51c48c176fe039a678:

  • Previous exact-head autoreview: clean at 0addaae10a44cce10fff99651631a882b774cf7f.
  • Previous and current stable patch-id: e3edfd4aeee202498289c2bebca2054ac119432c.
  • Rebased onto main b2a7732e2669e779deb2f1ac38d1eef245349420 without content conflicts.
  • TMPDIR=/tmp npm run check: 23 test files and 194 tests passed.
  • npm run build: passed.
  • bash scripts/ci/check-action-pins.sh: 42 pins passed.
  • git diff --check origin/main...HEAD: passed.

The commit identity and ancestry were corrected; the reviewed two-file patch is unchanged.

@athena-omt athena-omt added the state:waiting-checks Waiting for CI/check status to settle. label Jul 22, 2026

@athena-omt athena-omt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Reviewed current head 9ae56f9 locally. The generated pre-commit hook now safely handles an empty staged-file array under strict Bash mode, and the regression smoke test exercises the generated hook in a clean feature-branch repository. Local TypeScript check and smoke suite passed (12/12); latest CI Gate succeeded. No inline review threads were present.

@jmcte
jmcte merged commit b087126 into main Jul 22, 2026
24 of 40 checks passed
@jmcte
jmcte deleted the codex/fix-empty-precommit-hook branch July 22, 2026 23:00
@athena-omt athena-omt removed status:needs-review PR is ready for Athena review. review:athena Athena review governance requested. state:waiting-checks Waiting for CI/check status to settle. labels Jul 22, 2026
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.

Handle empty staged-file lists in generated hooks

2 participants