Files
yellowjacket/lefthook.yml
T
yonlu 61d549a9d5
CI / check (push) Skipped
CI / e2e (push) Skipped
CI / check (pull_request) Successful in 2m30s
CI / e2e (pull_request) Successful in 6m23s
ci: run the pre-push hooks sequentially
`go test -race ./...` saturates every core for ~47s, and the UI tier
it was sharing them with is a real Chromium with wall-clock timeouts.
So the browser lost, at random: setup took 106s inside the hook
against 63s standalone, and a different suite failed on each run --
three failing to fetch setup.ts from Vitest's own dev server once, a
15s "did not mount itself" the next time -- against a suite that
passes 898/898 five times running on its own.

That reads as "your branch broke the frontend" when nothing is wrong,
which is the most expensive kind of false negative: the next person
bisects a change that was never at fault. It cost two pushes here
before the summary line gave it away.

Sequential costs about 15s.

Closes #128
2026-08-19 09:16:43 -04:00

90 lines
3.0 KiB
YAML

# lefthook.yml — local git hooks for yellowjacket
# Install with: lefthook install
# Docs: https://github.com/evilmartians/lefthook
# Conventional Commits. CI runs the same script over every commit in a
# push, so skipping this locally only defers the failure.
commit-msg:
commands:
commit-check:
run: ./scripts/commit-check.sh {1}
pre-commit:
parallel: true
commands:
go-vet:
glob: "*.go"
run: go vet ./...
golangci-lint:
glob: "*.go"
run: go tool golangci-lint run --timeout 5m ./...
codegen-check:
glob: "*.{go,sql,templ}"
run: |
go generate ./...
if [ -n "$(git diff --name-only)" ]; then
echo "Generated code is out of date. Run 'make generate' and stage the changes."
# --no-pager, or this blocks forever on `less` waiting for a
# keypress that a hook run without a tty will never get: the
# commit hangs at exactly the moment it is trying to tell you
# why it failed.
git --no-pager diff --stat
exit 1
fi
# frontend/bindings is generated by `wails3`, not `go generate`, so
# the check above does not cover it. ~3.5s warm, ~20s on a cold
# build cache: v3's generator is a static analyser over the whole
# package graph, where v2's built the app with a `bindings` tag and
# ran it.
bindings-check:
glob: "*.go"
run: ./scripts/bindings-check.sh
# .pi/ documents make targets; a stale one sends an agent off a
# cliff with total confidence. Instant.
skill-check:
glob: "{Makefile,.pi/**/*.md}"
run: ./scripts/skill-check.sh
frontend-typecheck:
glob: "frontend/**/*.{ts,tsx}"
root: "frontend/"
run: ./node_modules/.bin/tsc --noEmit
# A backtick in a comment inside a css`` literal ends the literal.
# tsc does catch it, as "Class static side incorrectly extends base
# class static side" pointing at a line of prose; this says what
# actually happened. Instant.
css-literals:
glob: "frontend/**/*.ts"
root: "frontend/"
run: node scripts/check-css-literals.mjs
# Deliberately sequential, unlike pre-commit. `go test -race`
# saturates every core for the better part of a minute and the UI tier
# is a real browser with wall-clock timeouts, so run together the
# browser loses: setup took 106s inside the hook against 63s
# standalone, and a different suite failed each time -- three suites
# failing to fetch setup.ts from Vitest's own dev server on one run, a
# 15s "did not mount itself" on the next, against a suite that passes
# 898/898 on its own. A gate that fails at random is not a gate. The
# ~15s saved is not worth it.
pre-push:
parallel: false
commands:
go-test:
glob: "*.go"
run: go test -race -count=1 -timeout 120s ./...
go-mod-verify:
run: go mod verify
# The component and store tier: a real browser, no app. ~2s.
ui-test:
glob: "frontend/**/*.ts"
root: "frontend/"
run: ./node_modules/.bin/vitest run