No pre-push hook: every gate in this repository runs only after the push has landed #32

Closed
opened 2026-08-05 15:53:12 -04:00 by tachikoma · 3 comments
Collaborator

This repository has no pre-push hook, and no hooks directory of any kind. Every gate it
has -- build, ctest, coverage, mutation -- runs only after a push has already reached the
forge, so the first thing that tells you a commit is broken is a red pipeline and a runner
cycle spent.

Filed separately from the cppcheck work because it is a gap in its own right, and because
the cppcheck issue's "wire it into the pre-push hook" step has nowhere to go until this
exists.

Why it matters here

libakstdlib already solved this. .githooks/pre-push there runs the default build with
-Werror plus ctest, the ASan/UBSan build plus ctest, and doxygen -- a few seconds all in
-- and puts the slow mutation harness behind AKSL_HOOK_MUTATION=1. It is worth reading
before writing this one; most of the decisions are already made and commented there:

  • Builds go under .git/, so the hook never disturbs the developer's own build/.
  • Each step runs quietly and dumps its log only on failure.
  • A push that only deletes refs, or has nothing to push, exits 0 immediately.
  • An optional tool that is missing is skipped with a warning, not failed on. A hook that
    fails closed on a missing optional tool only teaches everyone to pass --no-verify.
  • git push --no-verify remains the escape hatch, and the hook says so when it aborts.

What to build

  • .githooks/pre-push, modelled on libakstdlib's, installed with
    git config core.hooksPath .githooks.
  • Gates it should run, cheapest first: scripts/cppcheck.sh (2--6 s, once the cppcheck
    issue lands), the default build plus ctest, and the AKERR_USE_STDLIB=OFF build plus
    ctest -- that configuration is a CI job here and is exactly the kind of thing that
    breaks without anyone noticing locally.
  • Whatever is slow enough to be opt-in (the mutation harness) goes behind an environment
    variable, the way AKSL_HOOK_MUTATION does.
  • Document the one-time git config core.hooksPath line in README.md or AGENTS.md.
    A hook nobody installs is not a gate.

Known limit, worth stating up front

core.hooksPath is per-clone local configuration. Git cannot install a hook for you, so
this gate is advisory by construction and CI stays the hard gate. That is the accepted
tradeoff, not a defect in the design -- the hook exists to make the failure cheap, not to
make it impossible.

This repository has no pre-push hook, and no hooks directory of any kind. Every gate it has -- build, ctest, coverage, mutation -- runs only after a push has already reached the forge, so the first thing that tells you a commit is broken is a red pipeline and a runner cycle spent. Filed separately from the cppcheck work because it is a gap in its own right, and because the cppcheck issue's "wire it into the pre-push hook" step has nowhere to go until this exists. ## Why it matters here libakstdlib already solved this. `.githooks/pre-push` there runs the default build with `-Werror` plus ctest, the ASan/UBSan build plus ctest, and doxygen -- a few seconds all in -- and puts the slow mutation harness behind `AKSL_HOOK_MUTATION=1`. It is worth reading before writing this one; most of the decisions are already made and commented there: - Builds go under `.git/`, so the hook never disturbs the developer's own `build/`. - Each step runs quietly and dumps its log only on failure. - A push that only deletes refs, or has nothing to push, exits 0 immediately. - An optional tool that is missing is skipped with a warning, not failed on. A hook that fails closed on a missing optional tool only teaches everyone to pass `--no-verify`. - `git push --no-verify` remains the escape hatch, and the hook says so when it aborts. ## What to build - [ ] `.githooks/pre-push`, modelled on libakstdlib's, installed with `git config core.hooksPath .githooks`. - [ ] Gates it should run, cheapest first: `scripts/cppcheck.sh` (2--6 s, once the cppcheck issue lands), the default build plus ctest, and the `AKERR_USE_STDLIB=OFF` build plus ctest -- that configuration is a CI job here and is exactly the kind of thing that breaks without anyone noticing locally. - [ ] Whatever is slow enough to be opt-in (the mutation harness) goes behind an environment variable, the way `AKSL_HOOK_MUTATION` does. - [ ] Document the one-time `git config core.hooksPath` line in README.md or AGENTS.md. A hook nobody installs is not a gate. ## Known limit, worth stating up front `core.hooksPath` is per-clone local configuration. Git cannot install a hook for you, so this gate is advisory by construction and CI stays the hard gate. That is the accepted tradeoff, not a defect in the design -- the hook exists to make the failure cheap, not to make it impossible.
tachikoma added the test-coverageblast-radius:mediumstatus::ready labels 2026-08-05 15:53:12 -04:00
logikoma was assigned by andrew 2026-08-05 15:56:40 -04:00
andrew added a new dependency 2026-08-05 16:07:48 -04:00
Collaborator

Beginning work on issue #32.

Beginning work on issue #32.
Collaborator

Beginning work on the pre-push hook and installation documentation. I will model the gate ordering and failure behavior on libakstdlib, then verify the hook and repository tests.

Beginning work on the pre-push hook and installation documentation. I will model the gate ordering and failure behavior on libakstdlib, then verify the hook and repository tests.
logikoma added status::review and removed status::ready labels 2026-08-05 18:35:23 -04:00
Collaborator

Work is complete and ready for review.

Added the executable .githooks/pre-push gate, optional cppcheck handling, default and AKERR_USE_STDLIB=OFF build/test gates, opt-in mutation testing, isolated logs/builds, and README installation guidance. Verified shell syntax, delete-only behavior, and a simulated update push with both configurations passing.

Pull request: #34

Work is complete and ready for review. Added the executable .githooks/pre-push gate, optional cppcheck handling, default and AKERR_USE_STDLIB=OFF build/test gates, opt-in mutation testing, isolated logs/builds, and README installation guidance. Verified shell syntax, delete-only behavior, and a simulated update push with both configurations passing. Pull request: https://source.starfort.tech/andrew/libakerror/pulls/34
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Reference: andrew/libakerror#32