Skip to content

Declare the fixing pre-commit hook and skip hk-test in it - #2389

Merged
david-driscoll merged 4 commits into
mainfrom
claude/lint-fix-mode
Nov 14, 2026
Merged

david-driscoll merged 4 commits into
mainfrom
claude/lint-fix-mode

Conversation

@david-driscoll

@david-driscoll david-driscoll commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

This PR changes only the local hooks in .config/hk.pkl. CI's lint workflow is unchanged: pull requests run hk fix and autofix.ci commits the fixes back, and the merge queue runs hk check.

  • On commit: pre-commit is now declared explicitly. It fixes, stages the fixes, and stashes unstaged edits first, so a fixer only rewrites what's being committed.
  • On push: there's no pre-push hook. The installed hk run pre-push hook exits 0 without running anything.
  • hk-test: it's skipped in pre-commit (step_condition = "false" on that hook's copy of the step). The top-level built-in step is unchanged, so hk check, hk fix and CI still run it.
    • Why: inside a git hook, git exports GIT_DIR and GIT_WORK_TREE, and hk test's scratch git init and git config ran against the real repository instead.
    • What it broke: committing from a worktree wrote core.worktree into the shared .git/config, which points the main checkout at the wrong folder. The tests also raced each other for the config lock.

Verified

  • hk run <hook> --plan: pre-commit shows ○ hk-test (step_condition evaluated to false), while check and fix show ✓ hk-test. All 16 steps are present in each.
  • Every commit went through the new pre-commit hook, and .git/config stayed clean.
  • hk check --from-ref origin/main --to-ref HEAD passes, including hk-test and pkl-format.

🤖 Generated with Claude Code

The merge queue ran hk check, where dotnet format fails on every analyzer
warning it has no code fix for (ZA0601, for one), even in lines a PR didn't
touch. It now runs hk fix like the PR run does; autofix.ci still pushes the
PR's fixes back, and steps with no fixer still fail.

Locally, the pre-commit hook is now declared: it fixes, stages the fixes and
stashes unstaged edits first. There's no pre-push hook.

hk-test now clears GIT_DIR, GIT_WORK_TREE and GIT_INDEX_FILE before running
hk test. Run from a worktree's pre-commit, the tests' scratch git commands
reached the real repository, wrote core.worktree into the shared .git/config
and raced each other for its lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v11.0.2 milestone Nov 14, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 4fb3c97. ± Comparison against base commit 59105e8.

♻️ This comment has been updated with latest results.

The merge queue's temporary branch can't take a push, so its lint run now
skips the hk step instead of running hk fix. Pull requests keep running hk fix,
with autofix.ci committing the fixes back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@david-driscoll david-driscoll changed the title Run the lint fixers in the merge queue and on local commits Run the lint fixers on pull requests and local commits Nov 14, 2026
Restores lint.yml to main's version: the merge queue runs hk check again, and
pull requests run hk fix with autofix.ci committing the fixes back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@david-driscoll david-driscoll changed the title Run the lint fixers on pull requests and local commits Declare the fixing pre-commit hook and keep hk-test out of the real repo Nov 14, 2026
Restores the built-in hk-test step, so hk check, hk fix and CI run it as
before, and turns it off only in pre-commit. Inside a git hook the
GIT_DIR / GIT_WORK_TREE git exports point hk test's scratch repositories at
the real one; not running it there avoids that without `env -u`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@david-driscoll david-driscoll changed the title Declare the fixing pre-commit hook and keep hk-test out of the real repo Declare the fixing pre-commit hook and skip hk-test in it Nov 14, 2026
@david-driscoll
david-driscoll added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 119ac2f Nov 14, 2026
9 checks passed
@david-driscoll
david-driscoll deleted the claude/lint-fix-mode branch November 14, 2026 20:17
@github-actions github-actions Bot added the ✨ mysterious We forgot to label this label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ mysterious We forgot to label this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant