From c6cc3eaac0e98d5b318aba4cb0fda5699c9fc848 Mon Sep 17 00:00:00 2001 From: Alexander Paolini <30964205+alexanderpaolini@users.noreply.github.com> Date: Thu, 13 Aug 2026 20:15:47 -0700 Subject: [PATCH 1/2] fix: remove pre-push hook Pre-push hook is redundant; changes must pass test before being merged. Pre-push hook primarily causes slowdowns where unnecessary. --- apps/blade/package.json | 4 +-- .../tests/events/event-detail-dialog.test.tsx | 9 ++++++- lefthook.yml | 27 ++++++------------- packages/api/package.json | 4 +-- packages/db/package.json | 4 +-- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/apps/blade/package.json b/apps/blade/package.json index 93c6ac54a..c9a060191 100644 --- a/apps/blade/package.json +++ b/apps/blade/package.json @@ -15,8 +15,8 @@ "with-env": "dotenv -e ../../.env --", "analyze:react": "tsx ../../scripts/analyze-react.ts src", "analyze:react:changed": "tsx ../../scripts/analyze-react-changed.ts", - "test": "pnpm with-env vitest run --passWithNoTests", - "test:watch": "pnpm with-env vitest --passWithNoTests", + "test": "NODE_ENV=test pnpm with-env vitest run --passWithNoTests", + "test:watch": "NODE_ENV=test pnpm with-env vitest --passWithNoTests", "e2e": "BLADE_E2E_AUTH=true NEXT_PUBLIC_BLADE_E2E_AUTH=true BLADE_E2E_DEFAULT_USER_ID=00000000-0000-4000-8000-000000000101 pnpm with-env playwright test --pass-with-no-tests" }, "dependencies": { diff --git a/apps/blade/src/tests/events/event-detail-dialog.test.tsx b/apps/blade/src/tests/events/event-detail-dialog.test.tsx index 502665f42..1bddb84a2 100644 --- a/apps/blade/src/tests/events/event-detail-dialog.test.tsx +++ b/apps/blade/src/tests/events/event-detail-dialog.test.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from "react"; import { createElement } from "react"; import { renderToStaticMarkup } from "react-dom/server"; -import { describe, expect, it, vi } from "vitest"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { EventDetailDialog } from "~/app/_components/admin/events/event-detail-dialog"; @@ -83,6 +83,13 @@ const detail = { }; describe("EventDetailDialog", () => { + beforeEach(() => { + vi.useFakeTimers(); + vi.setSystemTime(new Date("2026-08-12T23:00:00.000Z")); + }); + + afterEach(() => vi.useRealTimers()); + it("TC-007 TC-023 renders one sectioned read-only hierarchy", () => { const html = renderToStaticMarkup( createElement(EventDetailDialog, { diff --git a/lefthook.yml b/lefthook.yml index c593c47f3..5a4466a99 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,29 +1,18 @@ # Local quality gates. # -# These hooks mirror the CI jobs so contributors catch failures before pushing. +# Keep commit-time work quick and limited to staged files. Broader validation +# remains available through the package scripts and CI rather than a push hook. # -# The split matters: a pre-commit hook that runs the whole gate gets slow, people -# learn `--no-verify`, and the hook becomes decoration. Commit-time work is -# formatting only and touches staged files; the real gate runs once per push. -# -# Escape hatches: `git commit --no-verify`, or `LEFTHOOK=0 git push` to skip -# everything. Use them when you mean to, not by habit. +# Escape hatch: `git commit --no-verify`. Use it when you mean to, not by habit. pre-commit: - parallel: true + parallel: false jobs: - name: format staged files glob: "*.{ts,tsx,js,jsx,cjs,mjs,json,md,css,yml,yaml}" - run: npx prettier --write {staged_files} + run: pnpm exec prettier --write "{staged_files}" stage_fixed: true -pre-push: - parallel: false - jobs: - # The same commands as CI's format, lint, and typecheck jobs. - - name: verify - run: pnpm verify:push - - # CI runs this as its own job; keep the local push gate aligned with it. - - name: test - run: pnpm test + - name: lint staged files + glob: "*.{ts,tsx,js,jsx,cjs,mjs}" + run: pnpm exec eslint "{staged_files}" diff --git a/packages/api/package.json b/packages/api/package.json index ce24c8490..9439debb6 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -38,8 +38,8 @@ "format": "prettier --check . --ignore-path ../../.gitignore", "lint": "eslint", "typecheck": "tsc --noEmit --emitDeclarationOnly false", - "test": "pnpm with-env vitest run --passWithNoTests", - "test:watch": "pnpm with-env vitest --passWithNoTests", + "test": "NODE_ENV=test pnpm with-env vitest run --passWithNoTests", + "test:watch": "NODE_ENV=test pnpm with-env vitest --passWithNoTests", "with-env": "dotenv -e ../../.env --" }, "dependencies": { diff --git a/packages/db/package.json b/packages/db/package.json index 9425f7d47..606206ed3 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -38,8 +38,8 @@ "studio": "pnpm with-env drizzle-kit studio", "typecheck": "tsc --noEmit --emitDeclarationOnly false", "with-env": "dotenv -e ../../.env --", - "test": "pnpm with-env vitest run --passWithNoTests", - "test:watch": "pnpm with-env vitest --passWithNoTests" + "test": "NODE_ENV=test pnpm with-env vitest run --passWithNoTests", + "test:watch": "NODE_ENV=test pnpm with-env vitest --passWithNoTests" }, "dependencies": { "@forge/consts": "workspace:*", From 9452fe6c064a381fdbf52f4e4e9938f48aadfba7 Mon Sep 17 00:00:00 2001 From: Alexander Paolini <30964205+alexanderpaolini@users.noreply.github.com> Date: Fri, 14 Aug 2026 09:40:57 -0700 Subject: [PATCH 2/2] chore: add and test typecheck staged files --- lefthook.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lefthook.yml b/lefthook.yml index 5a4466a99..0d9ab257c 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -9,10 +9,23 @@ pre-commit: parallel: false jobs: - name: format staged files - glob: "*.{ts,tsx,js,jsx,cjs,mjs,json,md,css,yml,yaml}" + glob: "*.{ts,tsx,js,jsx,cjs,mjs,json,md,css,yml,yaml,md}" run: pnpm exec prettier --write "{staged_files}" stage_fixed: true - name: lint staged files glob: "*.{ts,tsx,js,jsx,cjs,mjs}" run: pnpm exec eslint "{staged_files}" + + - name: typecheck staged files + glob: "*.{ts,tsx,cts,mts}" + run: | + filters=$( + git diff --cached --name-only --diff-filter=ACMRD | + sed -nE 's#^((apps|packages|tooling)/[^/]+)/.*#--filter=./\1#p' | + sort -u + ) + + if [ -n "$filters" ]; then + pnpm exec turbo run typecheck $filters + fi