Skip to content

chore: pre-commit is the single git-hook entry point, bump hedron pin - #183

Closed
helly25 wants to merge 1 commit into
mainfrom
chore/20260518_single_entry_point
Closed

chore: pre-commit is the single git-hook entry point, bump hedron pin#183
helly25 wants to merge 1 commit into
mainfrom
chore/20260518_single_entry_point

Conversation

@helly25

@helly25 helly25 commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

Two related cleanups from the #182 retrospective.

1. Single git-hook entry point

Today both pre-commit install and trunk actions install write to .git/hooks/pre-commit and .git/hooks/pre-pushlast installer wins, silently. Devs running both end up with one tool's hook disabled at random.

Resolution:

  • Move trunk's trunk-fmt-pre-commit and trunk-check-pre-push from actions.enabled to actions.disabled in .trunk/trunk.yaml.
  • Add a single trunk fmt delegate as a local hook in .pre-commit-config.yaml.
  • pre-commit owns the git hook; devs run pre-commit install once and trunk's formatters fire on every commit through the delegate.
  • CI's two jobs (pre-commit + trunk) are unchanged; both still run independently.

README's dev-setup paragraph updated to match.

2. Bump hedron_compile_commands pin

bazelmod/dev.MODULE.bazel was pinned at 6f0f6e4f (Apr 2024). Bump to abb61a68 (Aug 2025), which is current upstream main HEAD. The two intervening commits are pre-commit autoupdate merges only — no behavior change — but the pin should not drift further.

Test plan

  • CI green
  • After this lands, run pre-commit install once locally; git commit triggers trunk fmt via the new local hook without any trunk actions install step.

🤖 Generated with Claude Code

Two related cleanups from the #182 retrospective.

1) Single git-hook entry point.

Today both `pre-commit install` and `trunk actions install` write to
`.git/hooks/pre-commit` and `.git/hooks/pre-push` — last installer
wins, silently. Devs running both end up with one tool's hook
disabled at random.

Move trunk's `trunk-fmt-pre-commit` and `trunk-check-pre-push` from
`actions.enabled` to `actions.disabled` in .trunk/trunk.yaml, and
add a single `trunk fmt` delegate as a local hook in
.pre-commit-config.yaml. pre-commit owns the git hook; devs run
`pre-commit install` once and trunk's formatters fire on every
commit through the delegate. CI's two jobs (`pre-commit` + `trunk`)
are unchanged; both still run independently.

README's dev-setup paragraph updated to match.

2) Bump hedron_compile_commands pin.

`bazelmod/dev.MODULE.bazel` was pinned at `6f0f6e4f` (Apr 2024).
Bump to `abb61a68` (Aug 2025) which is upstream main HEAD. The two
intervening commits are pre-commit autoupdate merges only — no
behavior change — but the pin should not drift further.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
helly25 added a commit that referenced this pull request Aug 9, 2026
The dev-setup paragraph claimed the repo "enables `trunk-fmt-pre-commit`
and `trunk-check-pre-push` so the hooks run automatically once
installed". That has been false for some time: both actions are disabled
in .trunk/trunk.yaml, and main.yml's "Trunk must not own git hooks" step
fails the build if either is re-enabled. A dev following the README would
never run `pre-commit install` and would end up with no git hooks at all.

Describe what is actually there: pre-commit owns the git hook and
delegates `trunk fmt` to trunk, trunk's own hook actions stay disabled so
the two cannot fight over .git/hooks, and CI runs pre-commit, trunk check
and clang-tidy as separate jobs. clang-tidy is one of the pre-commit
hooks too - it moved there from trunk, which pinned a version too old to
parse this code - opt-in for now and automatic once the finding sweep
lands. STYLE_CPP.md has the details.

The paragraph is taken from #183, which proposed it before the CI guard
and the clang-tidy job existed; the rest of that PR is superseded.

Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
helly25 added a commit that referenced this pull request Aug 9, 2026
The dev-setup paragraph claimed the repo "enables `trunk-fmt-pre-commit`
and `trunk-check-pre-push` so the hooks run automatically once
installed". That has been false for some time: both actions are disabled
in .trunk/trunk.yaml, and main.yml's "Trunk must not own git hooks" step
fails the build if either is re-enabled. A dev following the README would
never run `pre-commit install` and would end up with no git hooks at all.

Describe what is actually there: pre-commit owns the git hook and
delegates `trunk fmt` to trunk, trunk's own hook actions stay disabled so
the two cannot fight over .git/hooks, and CI runs pre-commit, trunk check
and clang-tidy as separate jobs. clang-tidy is one of the pre-commit
hooks too - it moved there from trunk, which pinned a version too old to
parse this code - opt-in for now and automatic once the finding sweep
lands. STYLE_CPP.md has the details.

The paragraph is taken from #183, which proposed it before the CI guard
and the clang-tidy job existed; the rest of that PR is superseded.

Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
@helly25

helly25 commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Superseded — both halves are obsolete, and the one surviving piece has moved to #279.

1. Single git-hook entry point — already done, and more thoroughly than proposed here. main disables trunk-fmt-pre-commit, trunk-check-pre-push (and trunk-announce) in .trunk/trunk.yaml, has the trunk-fmt delegate as a local pre-commit hook, and additionally has a CI step — "Trunk must not own git hooks" — that fails the build if any trunk git-hook action is re-enabled. This PR predates that guard.

2. Extractor pin bump — now actively wrong. This bumps hedron_compile_commands to upstream hedronvision abb61a68. mbo has since migrated to the helly25 fork at 6eb3ff1d (upstream has had no non-CI commit since June 2024). Merging that hunk would drag the pin backwards off the fork and undo --bcce-prefer-target-config.

3. The README paragraph was still valuable — it was the only part describing reality, since the old text still claimed the trunk hooks are enabled. It has been lifted into #279, extended to mention the clang-tidy job and that clang-tidy is now a pre-commit hook rather than a trunk linter.

Thanks — the hook-ownership analysis here is what the current design ended up implementing.

@helly25 helly25 closed this Aug 9, 2026
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