Skip to content

ci: add a pre-push hook that runs just ci - #21

Merged
kixelated merged 2 commits into
mainfrom
ci/pre-push-hook
Nov 28, 2026
Merged

kixelated merged 2 commits into
mainfrom
ci/pre-push-hook

Conversation

@kixelated

@kixelated kixelated commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Every repository lands through the kixel.quest merge queue (decision). Until its queue is live, a push should run the repository's checks locally. vaapi has a ci recipe but no pre-push hook to run it. CI's Check job runs nix develop --command just ci.

Approach

Adds .githooks/pre-push, the short POSIX script already landed in moq-dev/carla#4, which runs just ci inside nix develop because the repository has a flake. The ci recipe is unchanged: it already runs what CI runs, so it needs no new tools and no new dev shell.

Once kixel-ai/dotfiles#396 lands, dotfiles points core.hooksPath at a hook of its own, which runs this file as committed on the default branch (never a branch's copy), then Git LFS's pre-push, so the hook takes effect once this PR merges. It checks the working tree, not the pushed commits. It skips a push that only deletes refs, and a branch whose justfile has no ci recipe yet, saying so. It does not call git lfs, since dotfiles' wrapper does. Unlike carla's, it also unsets the variables git rev-parse --local-env-vars lists before running CI: a push from a linked worktree hands the hook that worktree's GIT_DIR, and tests that create scratch repositories then ran git add and git commit against the worktree's own index and branch (reproduced on kixel-ai/swole: the branch gained a base commit and core.bare flipped to true). The same hook already on carla, hang.live and kixel.us lacks the fix, which is a follow-up there. The hook says to delete it once this repository's queue is live.

Impact

None: a hook file; no public API, wire, or CI change.

Alternatives

None; the maintainer's decisions on carla#4 apply: a working-tree hook, no dev shell added for it, and no LFS call in it.

Follow-ups

The hooks already landed on moq-dev/carla, moq-dev/hang.live and kixel-ai/kixel.us need the same GIT_DIR fix. Once the queue is live here, delete the hook and drop check.yml's pull_request trigger, per dotfiles#396's landing order.

Validation

From a plain login shell (env -i HOME=$HOME bash -lc, with just, nix, and the login profile's mbx cargo shim on PATH, and no shellcheck, bun, or other repository tools), the committed hook with a pushed ref on stdin ran nix develop --command just ci and passed in 30 seconds, Nix and mbx caches warm. After the GIT_DIR fix, the real path, git -c core.hooksPath=.githooks push --dry-run from this linked worktree, passed in 8 seconds and left HEAD, the index, and core.bare unchanged; before the fix the same command failed on swole as described above. A delete-only push and a checkout with no ci recipe each exit 0 with a message. Git LFS: no.

Review

quest review at 861db36: Codex gpt-6.2-sol xhigh, round 2, score 10, no findings. Round 1 (score 4 or 5) raised, and round 2 settled: documenting core.hooksPath setup (refuted: dotfiles#396 sets it), a clean checkout per pushed ref (refuted: the working-tree hook is settled on carla#4 and kixel.us#9), and the GIT_DIR leak (fixed). A third round-1 note, Intel Mac dev shells, was refuted: the hook runs only from dotfiles' wrapper, which Intel Macs are outside of.

Models

Size: S
Implementer: Claude Code, claude-sonnet-5-5, unknown
Implementer: Claude Code, claude-sonnet-5-5, unknown (iterate, XS)

🤖 Generated with Claude Code

(Written by Sonnet 5.5)

kixelated and others added 2 commits November 28, 2026 09:37
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A push from a linked worktree gives the hook its GIT_DIR; tests creating scratch repositories then ran git against the worktree's own index and branch.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 28, 2026 18:49
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pre-push hook skips CI when a push contains only deleted refs. If the justfile has no ci recipe, the hook prints a warning and exits successfully. Otherwise, it clears Git’s local environment variables and runs just ci through nix develop when flake.nix exists, or directly when it does not.

Merge Risk: Minimal · up to 861db

This adds a local pre-push hook that runs the CI recipe before pushes. It skips delete-only pushes and checkouts without a ci recipe. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "ci: add a pre-push hook that runs just ci" names the main change: a new .githooks/pre-push hook that runs just ci. It matches the raw summary and the objectives, and it follows a conventi…
Description check Passed The description explains the problem (no merge queue yet, so pushes should run checks locally), the approach (adding .githooks/pre-push that runs just ci inside nix develop), the GIT_DIR unset fix…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "ci: add a pre-push hook that runs just ci" names the main change: a new .githooks/pre-push hook that runs just ci. It matches the raw summary and the objectives, and it follows a conventional-commit style.

Full details: Description check

Explanation

The description explains the problem (no merge queue yet, so pushes should run checks locally), the approach (adding .githooks/pre-push that runs just ci inside nix develop), the GIT_DIR unset fix, validation, and follow-ups. All of it relates directly to the changeset.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 375cdff9-e268-4a0f-a462-12680ab84055
Commits

Reviewing files that changed from the base of the PR and between 6f69fd1 and 861db36.

Files selected for processing: 1

  • .githooks/pre-push

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@kixelated
kixelated merged commit 137d4fe into main Nov 28, 2026
3 checks passed
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