Commit graph

2 commits

Author SHA1 Message Date
Stephen Dennis
6ef95166d3 Make pre-commit hook bash 3.2 compatible
The hook used `declare -A` (associative array, bash 4+ only).  On
macOS where /bin/bash is still 3.2, the declaration silently failed
and the loop iterated zero entries — so the hook printed a parse
error to stderr but skipped its actual check, defeating the
protection against committing generated files without their source.

Rewrite with parallel arrays (GENERATED_GENS / GENERATED_SRCS
indexed in lockstep), which work on bash 3.2 onward.  Verified the
hook executes cleanly under /bin/bash 3.2.57.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 19:51:41 -06:00
Stephen Dennis
8ca903e019 Add generated-file safeguards: pre-commit hook, read-only Ragel output, docs
Prevent accidental edits to machine-generated files (Ragel scanners, Unicode
tables, autoconf, protobuf, SQLite amalgamation) with three enforcement layers:

- hooks/pre-commit: blocks commits of generated output without its source
- Makefile chmod a-w: Ragel outputs made read-only after generation
- make hooks: auto-installs hook via core.hooksPath on first build

docs/generated-files.md is the shared reference for all agents and developers.
CLAUDE.md and AGENTS.md both point to it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 18:18:19 -06:00