From 0b0fa1c915e960d78b875fe519d36c5c961b45ed Mon Sep 17 00:00:00 2001 From: Logan Nguyen Date: Sat, 18 Jul 2026 21:58:38 -0500 Subject: [PATCH] docs: retier post-change validation to per-change/per-milestone cadence Signed-off-by: Logan Nguyen --- CLAUDE.md | 25 ++++++++++++++++++++----- package.json | 3 ++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 8c8eaf81..1fffb91c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -33,6 +33,7 @@ bun run test:backend:coverage # Cargo test + llvm-cov, enforces 100% line covera bun run test:all # Both Vitest and Cargo test bun run validate-build # All gates: lint + format + typecheck + build +bun run validate-build:fast # Per-change tier: lint + format + typecheck + debug backend build (no bundle/sign) ``` ## Testing @@ -41,7 +42,7 @@ Tests use **Vitest** for the frontend (React/TypeScript with React Testing Libra **100% code coverage is mandatory.** Any new or modified code — frontend or backend — must maintain 100% coverage across lines, functions, branches, and statements. PRs that drop below 100% coverage will not be merged. -**Always run `bun run test:all:coverage` (never the bare `bun run test` / `bun run test:all`).** This single command runs both Vitest with coverage and the cargo llvm-cov gate that CI enforces. If it does not exit cleanly, the task is not done. Functions excluded from coverage with `#[cfg_attr(coverage_nightly, coverage(off))]` must be thin wrappers (Tauri commands, filesystem I/O) whose logic is tested through the functions they delegate to. +**At milestone/PR time, always run `bun run test:all:coverage` (never the bare `bun run test` / `bun run test:all`).** This single command runs both Vitest with coverage and the cargo llvm-cov gate that CI enforces; see "Post-Change Validation" below for the full per-change vs per-milestone cadence. If it does not exit cleanly, the feature is not done. Functions excluded from coverage with `#[cfg_attr(coverage_nightly, coverage(off))]` must be thin wrappers (Tauri commands, filesystem I/O) whose logic is tested through the functions they delegate to. ## Since v0.15 @@ -166,12 +167,26 @@ Structure: ## Post-Change Validation -After making any code changes and before ending your response, you must: +Validation runs on two tiers: fast checks after every code change, full gates once per feature/PR. This is a change in cadence only, not a lowered bar: CI still runs the full gates on every PR, and the 100% coverage requirement at merge time is unchanged. -1. Run `bun run test:all:coverage` — frontend + backend tests must pass AND 100% coverage gate must hold -2. Run `bun run validate-build` — must complete with **zero warnings and zero errors** +### Per-change (every edit, fast) -Do not consider the task done if either step produces any warnings or errors. Fix all issues first. +After each code change and before ending your response, run the checks scoped to what you touched: + +- Backend: `cd src-tauri && cargo test --lib ::` for the touched module(s), plus `cargo clippy -- -D warnings` and `cargo fmt --check` +- Frontend: `bunx eslint ` and `bun run typecheck` (`tsc --noEmit`) +- Or, as a single convenience command covering lint + format + typecheck + a debug backend build: `bun run validate-build:fast` + +Do **not** run `test:all:coverage` or `validate-build` at this tier: no llvm-cov, no release build/bundle/sign. Fix anything this tier surfaces before moving on. + +### Per-milestone (once per feature, PR, or session end) + +Before declaring a FEATURE or PR done, run the full gates once and fix regressions in one batch: + +1. `bun run test:all:coverage`, frontend + backend tests must pass AND the 100% coverage gate must hold +2. `bun run validate-build`, must complete with **zero warnings and zero errors** + +Do not consider the feature done if either step produces any warnings or errors. This full pass is what "done" means; the per-change tier above only stops you from re-paying its cost on every intermediate edit. ## Superpowers Artifacts diff --git a/package.json b/package.json index 2dc9b396..0c8f4882 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "test:backend:coverage": "cd src-tauri && cargo +nightly-2026-03-30 llvm-cov --ignore-filename-regex \"(lib|main)\\.rs\" --fail-under-lines 100", "test:all": "vitest run && cd src-tauri && cargo test", "test:all:coverage": "vitest run --coverage && cd src-tauri && cargo +nightly-2026-03-30 llvm-cov --ignore-filename-regex \"(lib|main)\\.rs\" --fail-under-lines 100", - "validate-build": "bun run lint && bun run format:check && bun run typecheck && bun run build:all" + "validate-build": "bun run lint && bun run format:check && bun run typecheck && bun run build:all", + "validate-build:fast": "bun run lint && bun run format:check && bun run typecheck && cd src-tauri && cargo build" }, "dependencies": { "@fontsource/nunito": "^5.2.7",