feat(tooling): audit_metrics.py — size, complexity, gate weight and a speed baseline

This commit is contained in:
2026-10-04 20:09:58 +02:00
parent 11d35910fd
commit c2bf8fb7f6
7 changed files with 399 additions and 4 deletions
+13 -3
View File
@@ -16,10 +16,10 @@ next. A gate that is green on a major you do not ship is green about nothing.
## Run it locally
The whole stack (Postgres + API + worker) comes up from the localdev compose file:
The whole stack (Postgres + API + worker) comes up from the base compose file plus the localdev override:
```bash
docker compose -f docker-compose.localdev.yml up --build
docker compose -f docker-compose.yml -f docker-compose.localdev.yml up --build
```
Browse at **http://localhost:8080** (Google login works — the OAuth redirect is
@@ -43,9 +43,19 @@ A change is done when this is green, from the repo root:
```bash
bash scripts/check.sh # every lane
bash scripts/check.sh lint # the static lanes only (no tests, build or audits) — the quick loop
bash scripts/check.sh --brief # either mode: one line per lane, output only for a red one
bash scripts/lint-changed.sh # ruff + eslint + prettier on the uncommitted files only
```
It runs every lane even after one fails and names each red one at the end. What it runs, and why
It runs every lane even after one fails and names each red one at the end. `lint-changed.sh` is a
convenience, not the gate; with `--hook` it doubles as a Claude Code Stop hook (silent when clean,
the findings handed back otherwise).
The codebase's health numbers — size, complexity, test ratio, gate weight, comment noise — come from
`python scripts/audit_metrics.py` (seconds; it reports, it never fails). `--speed` adds the speed
baseline (`frontend/e2e/speed.measure.ts`: the feed's first card and a shared `/watch` link's
time-to-play against the :8080 stack, with `E2E_PASSWORD` set). An epic that changes structure
compares its before and after. What it runs, and why
each lane runs where it does, is in the script's comments; `frontend/src/lib/gates.contract.test.ts`
holds its lines, so a lane dropped or narrowed there fails a test. What each gate deliberately does
NOT check — and why — is the [gate register](gates.md). There is no CI: the gate runs here, and a