fix(worker): install the .githooks cache gate before pre-commit #2

Merged
riley merged 1 commit from fix/worker-hook-install-order into main 2026-11-07 23:12:48 +00:00
Owner

Live bug from PR #1: pre-commit install --install-hooks ran first and, in riley/spotlessbinco (default_install_hook_types: [pre-commit, post-commit]), wrote a generated .git/hooks/post-commit. install-pre-push-cache-gate.sh owns post-commit and pre-push from .githooks/ and refuses a differing hook, so every spotlessbinco code task was refused.

  • Run the cache-gate installer first.
  • Run pre-commit only for hook types .githooks/ does not own (--hook-type pre-commit, plus post-commit when declared and not owned).
  • Before the gate, remove a managed hook only when it is a stale pre-commit-generated copy (marker File generated by pre-commit); other custom hooks still make the gate refuse.
  • Without .githooks/pre-push, unchanged.

Validation (local): cargo fmt --check clean; cargo test -p codetether-worktree -p codetether-a2a-worker-core exit 0 (4 new install-order tests pass, existing pass). cargo clippy --no-deps -D warnings fails on pre-existing findings in untouched files only (6 empty_line_after_doc_comments in codetether-worktree; with that lint allowed, 8 findings in 3 untouched worker-core files); 0 findings in touched files.

Live bug from PR #1: `pre-commit install --install-hooks` ran first and, in riley/spotlessbinco (`default_install_hook_types: [pre-commit, post-commit]`), wrote a generated `.git/hooks/post-commit`. `install-pre-push-cache-gate.sh` owns `post-commit` and `pre-push` from `.githooks/` and refuses a differing hook, so every spotlessbinco code task was refused. - Run the cache-gate installer first. - Run pre-commit only for hook types `.githooks/` does not own (`--hook-type pre-commit`, plus `post-commit` when declared and not owned). - Before the gate, remove a managed hook only when it is a stale pre-commit-generated copy (marker `File generated by pre-commit`); other custom hooks still make the gate refuse. - Without `.githooks/pre-push`, unchanged. Validation (local): `cargo fmt --check` clean; `cargo test -p codetether-worktree -p codetether-a2a-worker-core` exit 0 (4 new install-order tests pass, existing pass). `cargo clippy --no-deps -D warnings` fails on pre-existing findings in untouched files only (6 empty_line_after_doc_comments in codetether-worktree; with that lint allowed, 8 findings in 3 untouched worker-core files); 0 findings in touched files.
install_declared_hooks ran 'pre-commit install --install-hooks' first. In
riley/spotlessbinco, default_install_hook_types includes post-commit, so
pre-commit wrote a generated .git/hooks/post-commit; the repository's
install-pre-push-cache-gate.sh, which owns post-commit and pre-push from
.githooks/, then refused to replace it and every code task was refused.

Run the cache-gate installer first and let pre-commit install only hook
types .githooks/ does not own (--hook-type pre-commit, plus post-commit when
declared and not owned). Before the gate runs, remove a managed hook that is
a stale pre-commit-generated copy (marker 'File generated by pre-commit');
any other custom hook still makes the installer refuse. Without
.githooks/pre-push, pre-commit runs as before.
riley merged commit eeb8e2b834 into main 2026-11-07 23:12:48 +00:00
Sign in to join this conversation.
No description provided.