Skip to content

chore(devex): install a make check pre-push hook via make setup (backend#1606) - #657

Merged
LukasWodka merged 5 commits into
developfrom
chore/1606-pre-push-hook
Aug 11, 2026
Merged

chore(devex): install a make check pre-push hook via make setup (backend#1606)#657
LukasWodka merged 5 commits into
developfrom
chore/1606-pre-push-hook

Conversation

@LukasWodka

@LukasWodka LukasWodka commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What

Step 4 of #1606, fanned out to client. make setup now installs a git pre-push hook that runs make check; factored into a standalone install-hooks target. Mirrors the merged reference e2e-test-agent#46.

Design (honest by construction)

  • Catches forgetting, not defiance: git push --no-verify always skips it.
  • Won't clobber a foreign pre-push hook — it declines and says so.
  • Worktree/submodule-safe via git rev-parse --git-path hooks.

Test plan

Mirrors #46 (verified end-to-end there). Here: make -n install-hooks and make help parse cleanly.

Parent epic: #1680.


Note

Low Risk
Makefile-only developer workflow change; no runtime, auth, or deployment behavior is affected.

Overview
make setup now installs a git pre-push hook that runs make check, so fast lint/drift/helm checks run before pushes without relying on contributor memory.

A new install-hooks target writes the hook (also invoked from setup). The hook is worktree/submodule-safe via git rev-parse --git-path hooks, refuses to overwrite an existing non-tracebloc pre-push hook, and unsets GIT_* env vars in the hook so nested git (e.g. Go buildvcs) does not fail in linked worktrees. help and header comments document install-hooks and git push --no-verify as the escape hatch.

Reviewed by Cursor Bugbot for commit ce2dbbd. Bugbot is set up for automated code reviews on this repo. Configure here.

…end#1606)

Step 4 of backend#1606, fanned out to client. `make setup` now installs a
git pre-push hook that runs `make check`, factored into a standalone,
independently runnable `install-hooks` target. Mirrors the merged reference
e2e-test-agent#46.

Honest by construction: the hook catches forgetting, not defiance
(`git push --no-verify` always skips it); it declines to clobber a foreign
pre-push hook rather than stomping it; and it resolves the hooks dir via
`git rev-parse --git-path hooks` so it is worktree/submodule-safe.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka LukasWodka self-assigned this Aug 10, 2026
@LukasWodka
LukasWodka requested a review from saadqbal August 10, 2026 19:05
LukasWodka and others added 3 commits August 10, 2026 21:10
…(backend#1606)

The copied block said 'need not rebuild the (minutes-long) venv', which is false for cli (Go) and client (tool-check only) and loose elsewhere. Generalise to 'need not rerun the full make setup' — true in every repo.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…urvives worktrees (backend#1606)

Git exports GIT_DIR/GIT_WORK_TREE/etc into hook processes; a nested git (e.g. Go buildvcs under go test) then fails with 'exit status 128' in a linked worktree. The generated hook now unsets those before exec make check. Uniform with the fix on cli#482 (the Go repo where it actually bites); harmless in normal clones.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eport false success (backend#1606)

Bugbot (Low) on cli#482: the install steps were ';'-chained, so a failed printf or chmod still exited 0 and printed 'installed'. Git skips a non-executable hook, so make setup could look green while no hook runs. Chain with '&&' so any failure fails the recipe. Uniform across the fleet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@aptracebloc aptracebloc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LukasWodkaApproved. Verified the hook behavior end-to-end on GNU Make 3.81 / macOS (the portability floor).

  • make install-hooks writes an executable .git/hooks/pre-push running make check; make setup wires it in.
  • Clobber-safe: with a foreign pre-push hook present, the target declines and leaves it byte-for-byte untouched (marker-based detection); idempotent over its own hook.
  • Degrades gracefully outside a checkout (exit 0); --no-verify escape hatch documented in the hook, setup, help, and header.
  • Failure propagates: forced an unwritable hooks dir → make Error, no false "installed" (the earlier ;&& Bugbot fix, confirmed working). No unresolved Bugbot findings; root Makefile isn't code-owned.

Two Low nits only (marker substring-match could false-positive a hook literally containing the marker text; hook assumes make on PATH at push time) — neither worth changing.

🤖 Generated with Claude Code

LukasWodka added a commit that referenced this pull request Aug 11, 2026
… PR trigger (backend#1681) (#665)

`Source-of-truth drift` is a REQUIRED status check on develop and on main, but
`drift-checks.yaml` only fires on PRs touching scripts/, client/ or itself. A PR
outside those paths therefore never produces the check, GitHub leaves it at
"Expected - waiting for status to be reported", and the PR is unmergeable with no
failing check to point at.

Measured on 2026-08-11 this was blocking three open PRs at once - client#651
(org-standards sync), #657 (Makefile) and #660 (docs) - none of which touch the
filtered paths. Two of the three had already been approved.

`pull_request` loses its paths filter so the required check always reports. The
job is ~10s (measured across its last three runs), which is nothing next to a
permanently stuck PR. `push` keeps its filter: pushes are not gated by required
checks, so path-scoping there is free and correct.

The repo already documents this hazard in standard-checks.yml's header; this is
the same rule applied to the workflow that broke it.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka
LukasWodka merged commit 41fad41 into develop Aug 11, 2026
12 checks passed
@LukasWodka
LukasWodka deleted the chore/1606-pre-push-hook branch August 11, 2026 11:07
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.

2 participants