Repository navigation
chore(hooks): fast fmt+lint pre-commit gates; full validation moves to CI - #428
Closed
codeaholicguy wants to merge 1 commit into
Closed
codeaholicguy wants to merge 1 commit into
codeaholicguy wants to merge 1 commit into
Conversation
Replace the full fmt:check + lint + test pre-commit suite with fast pre-commit formatting (oxfmt check) and lightweight lint (oxlint over packages/*/src, ~1s). The nx lint/test/build gates move to CI, which already runs fmt:check, lint, build, and test on every pull request (.github/workflows/ci.yml) plus the e2e matrix (e2e.yml). This removes the ~80s per-commit cost and, more importantly, keeps the known test-suite git-index corruption (GIT_DIR/GIT_INDEX_FILE leaking into test-spawned git commands) out of the commit path entirely — the exposure window shrinks to zero for local commits. Note: committed with HUSKY=0; the new hook itself was exercised directly (sh -n, manual run) and fmt:check + npm run lint were run manually and are green. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
codeaholicguy
force-pushed
the
chore/hooks-skip-metadata-only
branch
from
November 9, 2026 18:12
7628aab to
5ee3cb5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The husky
pre-commithook ranfmt:check+lint+test(nx run-manyacross all 8 projects, ~80s) for every commit. Per review direction, this replaces the heavy local gates with fast ones and relies on CI for full validation:Retained in pre-commit (every commit, ~3s total):
npm run fmt:check— repo-wide oxfmt check +cargo fmt --check(~1-3s)npx oxlint packages/*/src --ignore-pattern "**/ui/**"— lightweight lint over the samesrctreesnpm run lintcovers, minus clippy (~0.6s, warnings only)Removed from pre-commit (now CI-only):
npm run lint(full nx lint incl.cargo clippy -D warnings)npm run test(nx run-many test, all 8 projects)npm run buildwas never in the hook; unchangedCI coverage confirmed —
.github/workflows/ci.ymlruns onpull_request→main:fmt:check,lint,build, Rust toolchain +devkitdbuild,test, plus a separate Rust job (fmt + clippy + test)..github/workflows/e2e.ymladds the e2e matrix on PRs.Evidence — hook behavior, real commits (isolated worktree)
docs/hook-test-docs.md)packages/cli/src/util/text.ts)Both commits contain exactly the staged file — no empty-commit corruption, because the test suite no longer runs inside the hook.
CI / branch-protection status (read-only inspection)
ci.yml+e2e.ymltrigger on every PR tomain— full fmt/lint/build/test/e2e coverage exists.mainhas no branch protection (API 404), and the single rulesetmain(id 12999697) isenforcement: disabledand contains onlydeletion+non_fast_forwardrules — no required status checks. CI will run and report on PRs, but nothing technically blocks merging a red PR. Flagging per instructions; no repo settings were modified. If merge-gating is desired, a ruleset with required checks (Test (Node 20),Rust (fmt + clippy), E2E jobs) needs to be enabled — that requires owner action.Validation
sh -n .husky/pre-commit— cleannpm run fmt:check— passnpm run lint— pass (8 projects; same warnings as before, pre-existing)npm run test— pass earlier on this branch base (8 projects; hook change does not touch tested code)npx oxlint packages/*/src --ignore-pattern "**/ui/**"— 0.56s, rc=0, warnings only;src/ui/**exclusions matchmemory-dashboard's lint scriptgit show --statverified on branch commit and both hook test commits;git ls-tree -rcount identical toorigin/main(1638)Notes / risks
GIT_DIR/GIT_INDEX_FILE; test-spawned git commands can inherit them and mutate the real index (observed producing empty commits). Moving tests out of the hook removes the exposure for commits, but the leak still exists for any other git-hook context that runs tests — recommended follow-up: scrubGIT_*invitest.setup.ts.pi-session-trackerhas nosrc/dir and no lint target; thepackages/*/srcglob simply skips it, matching nx lint coverage exactly (7 JS projects + rust clippy, the latter CI-only now).HUSKY=0after manual gate runs, per the corruption finding above.lefthook.ymlin the main checkout is an unmodified upstream example; the active hook is husky (.husky/pre-commit).Generated with Devin