Skip to content

Block fixup commits and check hooks on each build - #473

Merged
jserv merged 2 commits into
mainfrom
hook
Oct 24, 2026
Merged

jserv merged 2 commits into
mainfrom
hook

Conversation

@jserv

@jserv jserv commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Pull request #462 landed three fixup! commits because the commit-msg hook exempted autosquash subjects, and the pre-push hook and the CI commit-log step replay messages through that same script. The first commit refuses fixup!, squash! and amend! subjects in that script, so they are blocked at commit, at push and in CI alike, and CONTRIBUTING.md says so. It also completes the verb forms the first-word check already named ("Wires" is refused as "Wiring" was).

The second commit makes cargo build hold a checkout to its hooks. Cargo only notices a change by mtime, so chmod -x on a hook or a global core.hooksPath was invisible to the old build.rs, which also only warned. The check moves into scripts/hook-check, an empty workspace member whose build script reruns on every build, so only that crate recompiles and the server does not. A build whose hooks cannot be put in effect now fails with the installer's own instructions. CODETRIAL_SKIP_HOOKS=1 opts out, CI sets it, and release builds name -p codetrial. cargo test and commands that name their targets leave the check out, which docs/development.md lists.

Verified with scripts/test-git-hooks.sh (113 checks), a new BuildHooksTests in tests/test_test_gate.py (repairs a non-executable and a deleted hook, refuses a shared core.hooksPath, skips only on CODETRIAL_SKIP_HOOKS=1, installs only at the top of its own checkout), clippy with -D warnings, shellcheck, ruff and scripts/indent.sh --check. Removing the fixup rule, or the every-build rerun, fails the matching test. A no-op cargo build costs about 0.7s, roughly 0.5s of it Cargo rerunning an always-stale build script. The full scripts/test.sh gate did not finish green locally: browser tests timed out under machine load, a different set each run, and the ones I reran alone passed.

Anyone with a global core.hooksPath or a hook manager writing into .git/hooks now gets a failed build until they follow the printed instructions or set CODETRIAL_SKIP_HOOKS=1. #471 edits abs() in scripts/install-git-hooks.sh, a few lines from the lines this changes, so whichever merges second will need a small rebase. #462 still carries its three fixup! commits and needs git rebase -i --autosquash.

The commit-msg hook exempted fixup!, squash! and amend! subjects, and
the pre-push hook and CI replay messages through the same script, so
three fixup! commits reached pull request 462 unjudged. They are now
refused with the fold that fixes them, in all three places.

The first-word check also learns the remaining forms of the verbs it
named, so "Wires" is refused as "Wiring" already was.
A hook that lost its executable bit, or a global core.hooksPath, never
touched a file Cargo watches, so build.rs could not notice either and
only warned when it did. The check now lives in scripts/hook-check, a
workspace member whose build script reruns on every build, so only that
empty crate recompiles. A build whose hooks cannot be put in effect
fails with the installer's instructions; CODETRIAL_SKIP_HOOKS=1 opts
out, and CI sets it. cargo test and commands naming their targets leave
the check out.

The installer now asks git once and returns early when every hook is in
effect, and indent.sh covers the new crate.
@jserv
jserv merged commit e9d0184 into main Oct 24, 2026
11 checks passed
@jserv
jserv deleted the hook branch October 24, 2026 18:12
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.

1 participant