Skip to content

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

Open
jmcte wants to merge 1 commit into
mainfrom
codex/fix-empty-precommit-hook
Open

fix: handle empty staged files in pre-commit hook#95
jmcte wants to merge 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

No governing issue is linked: this is a narrow hook reliability fix requested directly by Pheidon.

Validation

  • npm test -- --run tests/smoke.test.ts tests/render.test.ts (30 tests passed)
  • npm run typecheck
  • git diff --check
  • Agent-authored changes passed autoreview with no accepted or actionable findings.
  • Required PR checks are expected to satisfy CI Gate.

Bootstrap Governance

  • Changes are scoped to Bootstrap's generated hook and its regression coverage.
  • Contributor guidance and managed-repository policy are not changed.
  • No secrets, credentials, or machine-local state are introduced.

Material change: no

Merge Automation

  • Auto-merge is not safe to arm before the required independent review is available.

Notes

The current hook dereferences an empty Bash array with set -u, which blocks a metadata-only amend such as adding a DCO trailer. The generated hook now expands the array zero-safely and skips the fallback empty entry.

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

Signed-off-by: Your Name <you@example.com>
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:athena Athena review governance requested. status:needs-review PR is ready for Athena review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants