From 81d4abc3cf729c1b9d45d317052c9f404be30255 Mon Sep 17 00:00:00 2001 From: Khalid Al-Mutawa Date: Fri, 22 May 2026 03:41:26 +0700 Subject: [PATCH] docs: add CI/CD enforcement gate and stale cache warnings to CLAUDE.md STU-164: 5 open PRs had failing CI due to missing pre-push verification. Add gate rule requiring tsc, build, and validate to pass locally before push. Add stale cache and lint-staged hazard warnings. Co-Authored-By: Claude Opus 4.7 --- CLAUDE.md | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index ef409f2..08fffea 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,13 +41,39 @@ Do not commit directly to `main`. Every change goes through a PR. 1. Create a feature branch from `main` 2. Commit changes with conventional commit messages -3. Push the branch to `origin` -4. Create a PR with a clear title and description -5. Request review from at least one team member -6. Merge only after approval and passing checks +3. **Run the pre-push gate BEFORE pushing** (see CI/CD Enforcement below) +4. Push the branch to `origin` +5. Create a PR with a clear title and description +6. Request review from at least one team member +7. Merge only after approval and passing checks PR titles follow: `[STU-N] Short description of change` +## CI/CD Enforcement (CRITICAL — read before pushing) + +**Every branch pushed to origin must pass the full CI pipeline.** Pushing code that fails CI wastes reviewer time and blocks the board. These checks run on every PR and must be verified locally before pushing: + +```bash +# 1. TypeScript — zero errors required +npx tsc --noEmit + +# 2. Build — must compile cleanly +npm run build + +# 3. Validation — requires dev server on port 3000 +npm run dev & # start dev server, then: +npm run test:validate + +# Or run all three together: +npm run test:all +``` + +**Gate rule:** If any of `tsc --noEmit`, `npm run build`, or `npm run test:validate` fails locally, do NOT push. Fix the failures first. Only push when all three pass. + +**Stale cache warning:** When switching branches, always run `rm -rf .next && npx prisma generate` before type-checking. Stale `.next` caches and outdated Prisma clients cause false errors that masquerade as real bugs. + +**Lint-staged hazard:** The pre-commit hook stashes working changes. Switching branches while lint-staged is running can corrupt files with cross-branch artifacts. Verify working tree is clean before switching branches. + ## TypeScript & Code Quality - Run `npm run test:types` before committing — zero type errors required