From 15890d3fb027faab2cfd42f0dd48318034205bdd Mon Sep 17 00:00:00 2001 From: JJ Eaton <58495321+oldbettie@users.noreply.github.com> Date: Sat, 31 Oct 2026 21:54:57 +0700 Subject: [PATCH] fix(hooks): the pre-push hook and the docs never say how to skip it The hook's banner, make hooks' output, AGENTS.md and the github-prs skill told the reader how to skip make check-fast for a push. A failing check is fixed before the push; nothing explains how to bypass it. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/github-prs/SKILL.md | 4 ++-- .claude/skills/github-prs/SKILL.md | 4 ++-- AGENTS.md | 2 +- scripts/install-hooks.sh | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.agents/skills/github-prs/SKILL.md b/.agents/skills/github-prs/SKILL.md index c2c87523..a8149331 100644 --- a/.agents/skills/github-prs/SKILL.md +++ b/.agents/skills/github-prs/SKILL.md @@ -11,7 +11,7 @@ The rules on what may merge are in `AGENTS.md` ("Verifying", "Pull requests", "E ## 1. Before every commit -- **Never skip the hooks.** `make hooks` installs the pre-push hook (`make check-fast`); never push with `--no-verify` except in an emergency, and say so. +- **Never skip the hooks.** `make hooks` installs the pre-push hook (`make check-fast`); when it fails, fix what it found and push again; never skip it. - **Default: `make check-pr`.** It runs what the branch's changes need (the table is `docs/CI.md`, "What to run"), fails when the affected-package selection does not match the diff, and prints the `make ci-local RAN="…"` line to attest with. By hand: `make lint LINT_DIRS=` and `make test TEST_PKGS=` for the Go packages it can affect (`scripts/affected.sh` prints them; `make check-fast` is the seconds-long pass), `make check-generated` for sqlc, templ or mock inputs, `make check-migrations` for a migration, `make deploy-check` for `deploy/`, `make actionlint` for workflows, `make release-smoke` for a Dockerfile or what it builds, `make ci` for a change to the tooling. Tests only at the test boundaries (`AGENTS.md`, "Test boundaries"); never a test in `deploy/` or the UI. - A change adds no lint or format findings, warnings included. - Add the paths you changed; never `git add -A` in an old worktree. @@ -97,7 +97,7 @@ An unattested `main` is the top priority: both workflows fail and say why. Fix i | Staging deploys only an attested PR head or commit | `cilocal attest` in Deploy staging's plan, `verify.Attestation` and its test | | Merge every green PR at once; stacks survive | `make pr-merge` (no wait path, retargets children), `scripts/cilocal/verify/merge_test.go` | | A push workflow that fails on main is reported | `Post-merge report`; a verify test fails when a push-to-main workflow is missing from its list | -| No `--no-verify`, no reopen, no `pgrep -f` | this skill only; add a check if an agent repeats one | +| Never skip the pre-push hook, no reopen, no `pgrep -f` | this skill only; add a check if an agent repeats one | ## Done means diff --git a/.claude/skills/github-prs/SKILL.md b/.claude/skills/github-prs/SKILL.md index c2c87523..a8149331 100644 --- a/.claude/skills/github-prs/SKILL.md +++ b/.claude/skills/github-prs/SKILL.md @@ -11,7 +11,7 @@ The rules on what may merge are in `AGENTS.md` ("Verifying", "Pull requests", "E ## 1. Before every commit -- **Never skip the hooks.** `make hooks` installs the pre-push hook (`make check-fast`); never push with `--no-verify` except in an emergency, and say so. +- **Never skip the hooks.** `make hooks` installs the pre-push hook (`make check-fast`); when it fails, fix what it found and push again; never skip it. - **Default: `make check-pr`.** It runs what the branch's changes need (the table is `docs/CI.md`, "What to run"), fails when the affected-package selection does not match the diff, and prints the `make ci-local RAN="…"` line to attest with. By hand: `make lint LINT_DIRS=` and `make test TEST_PKGS=` for the Go packages it can affect (`scripts/affected.sh` prints them; `make check-fast` is the seconds-long pass), `make check-generated` for sqlc, templ or mock inputs, `make check-migrations` for a migration, `make deploy-check` for `deploy/`, `make actionlint` for workflows, `make release-smoke` for a Dockerfile or what it builds, `make ci` for a change to the tooling. Tests only at the test boundaries (`AGENTS.md`, "Test boundaries"); never a test in `deploy/` or the UI. - A change adds no lint or format findings, warnings included. - Add the paths you changed; never `git add -A` in an old worktree. @@ -97,7 +97,7 @@ An unattested `main` is the top priority: both workflows fail and say why. Fix i | Staging deploys only an attested PR head or commit | `cilocal attest` in Deploy staging's plan, `verify.Attestation` and its test | | Merge every green PR at once; stacks survive | `make pr-merge` (no wait path, retargets children), `scripts/cilocal/verify/merge_test.go` | | A push workflow that fails on main is reported | `Post-merge report`; a verify test fails when a push-to-main workflow is missing from its list | -| No `--no-verify`, no reopen, no `pgrep -f` | this skill only; add a check if an agent repeats one | +| Never skip the pre-push hook, no reopen, no `pgrep -f` | this skill only; add a check if an agent repeats one | ## Done means diff --git a/AGENTS.md b/AGENTS.md index 46ab639e..c489465c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -85,7 +85,7 @@ The most common defect is a change that works on the path you tested and is miss ## Verifying -- **`make check-fast` before every push (mandatory).** It runs gofmt, golangci-lint (whose `govet` runs `go vet`'s analyzers), the test-location check and plain `go test` (no `-race`) on only the packages your changes can affect, plus the generators whose inputs changed, the `deploy/` module (lint, names and `make deploy-vars`) when it, `.env.example` or the Makefile changed, the migration order when a migration changed (see "Migrations"), and `make vulncheck` when a `go.mod`, `go.sum`, `package.json` or `pnpm-lock.yaml` changed. Changes mean everything that differs from the merge base with origin/main: commits, staged, unstaged and untracked files, mapped to packages by `scripts/affected.sh` (`make affected` prints them), so a shared input (go.mod, tooling, lint config, migrations) checks everything. It takes seconds (a docs-only change: under a second; a full run: under 10 s warm), so it fits machines where a full `make ci` is not allowed. Database tests skip unless `TEST_DATABASE_URL` is set; `make test` runs them with `-race` against Postgres. `make hooks` installs a pre-push hook that runs it from every worktree of the clone (`make hooks-remove` undoes it; `git push --no-verify` skips it once, for emergencies only). Anything that runs git or go from a hook drops git's repository env first (`git rev-parse --local-env-vars`), as the hook and `scripts/check-fast.sh` do. +- **`make check-fast` before every push (mandatory).** It runs gofmt, golangci-lint (whose `govet` runs `go vet`'s analyzers), the test-location check and plain `go test` (no `-race`) on only the packages your changes can affect, plus the generators whose inputs changed, the `deploy/` module (lint, names and `make deploy-vars`) when it, `.env.example` or the Makefile changed, the migration order when a migration changed (see "Migrations"), and `make vulncheck` when a `go.mod`, `go.sum`, `package.json` or `pnpm-lock.yaml` changed. Changes mean everything that differs from the merge base with origin/main: commits, staged, unstaged and untracked files, mapped to packages by `scripts/affected.sh` (`make affected` prints them), so a shared input (go.mod, tooling, lint config, migrations) checks everything. It takes seconds (a docs-only change: under a second; a full run: under 10 s warm), so it fits machines where a full `make ci` is not allowed. Database tests skip unless `TEST_DATABASE_URL` is set; `make test` runs them with `-race` against Postgres. `make hooks` installs a pre-push hook that runs it from every worktree of the clone (`make hooks-remove` undoes it); a failing check is fixed before the push, never skipped. Anything that runs git or go from a hook drops git's repository env first (`git rev-parse --local-env-vars`), as the hook and `scripts/check-fast.sh` do. - **Release smoke** (`make release-smoke`; run it whenever a build input changes: a Dockerfile, or code a Dockerfile's binary is built from): builds every binary that has a Dockerfile with that Dockerfile's own build-stage `ENV` and `RUN` line (`scripts/dockerfile-builds.sh` reads them, so never copy build flags elsewhere) and fails on a dynamically linked one, runs `server migrate` and `admin migrate` on fresh databases, and boots web and admin with `APP_ENV=production` and only the config production requires until `/healthz` answers 200. It catches what tests cannot: an image that will not start on distroless (a dependency that links dynamically even with `CGO_ENABLED=0`), and a production config that refuses to boot without an optional integration. A new required production setting goes in its env list. - `make lint test` before every commit when you can run the full suite. `make ci` runs every check on the checkout as it is: build, generated-code diff (sqlc, mocks, templ), gofmt + golangci-lint, the test-location check, `go test -race` against a throwaway Postgres with per-boundary coverage floors, and the probes that prove the layering and test rules still bite (`make lint-layering lint-tests`). `make vulncheck` (also in `make ci`) fails on any known vulnerability in a dependency of any Go module or the mobile lockfile ([docs/CI.md](docs/CI.md#known-vulnerabilities)). - **A pull request is verified locally, on its exact head, then attested (mandatory; [docs/CI.md](docs/CI.md)).** Run what the change needs ("What to run" there): `make check-pr` runs it and prints the statement to attest with; by hand, for Go, `make lint test` scoped with `LINT_DIRS`/`TEST_PKGS` from `scripts/affected.sh`, plus `make check-generated`, `make check-migrations`, `make deploy-check`, `make actionlint` or `make release-smoke` for what you touched, `make ci` for a change to the tooling. Commit, push, then `make ci-local RAN=""` in the clean worktree. It runs nothing and takes seconds: it refuses a dirty, unpushed or already-failed head, posts the `local-ci` commit status and fills the PR body's "Local verification" section with your statement, which is never edited by hand. Every push or rebase needs a new attestation. Stack PRs and merge right away. diff --git a/scripts/install-hooks.sh b/scripts/install-hooks.sh index 3afddf9a..e505664b 100755 --- a/scripts/install-hooks.sh +++ b/scripts/install-hooks.sh @@ -4,7 +4,7 @@ # repository's shared git directory, so one install covers every linked # worktree; a checkout without scripts/check-fast.sh (an older branch) skips # the check. A pre-push hook that this script did not write is left alone. -# Skip the check for one push with `git push --no-verify`. +# A failing check is fixed before the push, never skipped. set -euo pipefail cd "$(dirname "$0")/.." @@ -29,7 +29,7 @@ cat >"$hook" <