docs(review): add REVIEW.md with review levels and calibration script #141

Merged
maximus merged 4 commits from issue-140-review-md into master 2026-10-20 01:00:23 +00:00
Owner

Fixes #140

Summary

  • REVIEW.md: review levels (Haut / Normal / Bas) computed from the files a PR touches, rules per zone with their source, verification commands, review pitfalls. Structure taken from simpl-resultat/REVIEW.md.
  • scripts/review-levels.py: replays the levels on merged PRs (Forgejo API, read-only); --check compares its patterns with the Haut table, without network.
  • CLAUDE.md: new « Documents de référence » section pointing to REVIEW.md.

No code change. Once merged, /pr-review judges every open PR with these levels, PR #139 included (it stays normal: an override floor raise, no package added or removed in the lock).

Calibration (47 merged PRs, #14 to #138)

#14	normal	
#17	normal	
#18	normal	
#20	normal	
#22	normal	
#24	normal	
#28	normal	
#30	normal	
#31	normal	
#33	normal	
#41	haut	src/db/migrations/0003_sharp_radioactive_man.sql; src/db/migrations/meta/0003_snapshot.json; src/db/migrations/meta/_journal.json; src/db/migrations/mi
#42	haut	web/.env.example (added at top level); web/.gitignore (added at top level); web/Dockerfile; web/Dockerfile (added at top level); web/drizzle.config.ts;
#43	haut	web/package-lock.json; web/package.json; web/src/app/api/logto/callback/route.ts; web/src/app/api/logto/sign-in/route.ts; web/src/app/api/logto/sign-ou
#44	haut	web/package.json; web/src/app/api/lists/[id]/route.ts; web/src/app/api/lists/[id]/tasks/route.ts; web/src/app/api/lists/reorder/route.ts; web/src/app/a
#45	haut	web/Dockerfile; web/package-lock.json; web/package.json; web/server.ts; web/server.ts (added at top level); web/src/app/api/health/route.ts; web/src/ap
#46	haut	web/package-lock.json; web/package.json
#47	haut	app/(tabs)/settings.tsx; app/_layout.tsx; src/db/migrations/0004_nosy_human_torch.sql; src/db/migrations/meta/0004_snapshot.json; src/db/migrations/met
#56	haut	web/.env.template; web/.env.template (renamed at top level)
#57	normal	
#58	haut	src/db/repository/outbox.ts; web/src/app/api/sync/route.ts
#64	haut	web/src/app/api/sync/route.ts; web/src/app/api/tasks/route.ts; web/src/db/seed.ts
#66	haut	src/services/syncClient.ts
#67	normal	
#73	normal	
#77	normal	
#78	normal	
#79	bas	
#80	normal	
#84	normal	
#88	haut	package-lock.json
#89	haut	web/src/lib/auth.ts
#91	haut	web/src/app/api/lists/[id]/tasks/route.ts
#93	normal	
#94	normal	
#100	haut	package-lock.json
#101	haut	src/components/FeedbackModal.tsx; src/hooks/useFeedback.ts; src/services/feedback.ts; src/services/feedback.ts (network call)
#105	normal	
#109	normal	
#111	normal	
#114	haut	package-lock.json
#116	normal	
#119	normal	
#122	normal	
#127	normal	
#131	normal	
#132	bas	
#138	normal	
47 PRs #14-#138: {'bas': 2, 'normal': 28, 'haut': 17} -> haut 36.2 %

36 % haut against a 20 % target. The gap comes from the April 2026 web companion milestone (#41 to #47: Logto, API, WebSocket, sync client): 10/40 (25 %) outside it. With the simpl-resultat rule « overrides changed = haut », the rate would be 31/47 (66 %).

--check

ok: 41 patterns, identical to the Haut table of REVIEW.md

Mutation: removing web/.env.template from the script, then sql-transformer.js from the table, each makes --check exit 1 and name the pattern; restored, it passes.

Verification commands, run in a clean worktree (2026-10-19)

Command Result
npm ci (root, postinstall patch applied) exit 0
npm test smoke OK, 11/11
npx tsc --noEmit (root) exit 0
npx expo export --platform android --no-bytecode --clear exit 0, 44 files
web/: npm ci, npx tsc --noEmit, npm run lint, npm run build all exit 0, next build needs no Logto variable

Choices for Max to confirm

  1. Version bumps stay normal, override floors included (your 2026-10-17 rule for simpl-resultat, carried over). The alternative makes 66 % of PRs high, almost all of them advisory floors.
  2. web/src/app/api/** always high, even a lint-only change (#91 is high for that reason). Every route is an account-isolation boundary, and the middleware lets any Bearer through.
  3. A package removed from the lock is high like a package added (#88, #100, #114). Removal is lower risk; making it normal would bring the rate to 14/47 (30 %).
  4. app/_layout.tsx and app/(tabs)/settings.tsx are high only on their sensitive parts (migrations, Logto, sync, update check), detected by keyword. A UI change in Settings stays normal.
  5. Never low: CLAUDE.md, web/CLAUDE.md, web/AGENTS.md, .claude/**, and REVIEW.md outside its « Niveaux » section.

Found while reading (not fixed here)

web/src/app/api/sync/route.ts copies the client's data into .set() for list, task and tag updates (data is z.record(z.unknown())): a signed-in client can overwrite userId and move its own rows into another account. The task-tag link checks ownership of neither side. REVIEW.md records it as a pitfall; it needs its own security issue.

🤖 Generated with Claude Code

Fixes #140 ## Summary - `REVIEW.md`: review levels (Haut / Normal / Bas) computed from the files a PR touches, rules per zone with their source, verification commands, review pitfalls. Structure taken from `simpl-resultat/REVIEW.md`. - `scripts/review-levels.py`: replays the levels on merged PRs (Forgejo API, read-only); `--check` compares its patterns with the Haut table, without network. - `CLAUDE.md`: new « Documents de référence » section pointing to `REVIEW.md`. No code change. Once merged, `/pr-review` judges every open PR with these levels, PR #139 included (it stays **normal**: an override floor raise, no package added or removed in the lock). ## Calibration (47 merged PRs, #14 to #138) ``` #14 normal #17 normal #18 normal #20 normal #22 normal #24 normal #28 normal #30 normal #31 normal #33 normal #41 haut src/db/migrations/0003_sharp_radioactive_man.sql; src/db/migrations/meta/0003_snapshot.json; src/db/migrations/meta/_journal.json; src/db/migrations/mi #42 haut web/.env.example (added at top level); web/.gitignore (added at top level); web/Dockerfile; web/Dockerfile (added at top level); web/drizzle.config.ts; #43 haut web/package-lock.json; web/package.json; web/src/app/api/logto/callback/route.ts; web/src/app/api/logto/sign-in/route.ts; web/src/app/api/logto/sign-ou #44 haut web/package.json; web/src/app/api/lists/[id]/route.ts; web/src/app/api/lists/[id]/tasks/route.ts; web/src/app/api/lists/reorder/route.ts; web/src/app/a #45 haut web/Dockerfile; web/package-lock.json; web/package.json; web/server.ts; web/server.ts (added at top level); web/src/app/api/health/route.ts; web/src/ap #46 haut web/package-lock.json; web/package.json #47 haut app/(tabs)/settings.tsx; app/_layout.tsx; src/db/migrations/0004_nosy_human_torch.sql; src/db/migrations/meta/0004_snapshot.json; src/db/migrations/met #56 haut web/.env.template; web/.env.template (renamed at top level) #57 normal #58 haut src/db/repository/outbox.ts; web/src/app/api/sync/route.ts #64 haut web/src/app/api/sync/route.ts; web/src/app/api/tasks/route.ts; web/src/db/seed.ts #66 haut src/services/syncClient.ts #67 normal #73 normal #77 normal #78 normal #79 bas #80 normal #84 normal #88 haut package-lock.json #89 haut web/src/lib/auth.ts #91 haut web/src/app/api/lists/[id]/tasks/route.ts #93 normal #94 normal #100 haut package-lock.json #101 haut src/components/FeedbackModal.tsx; src/hooks/useFeedback.ts; src/services/feedback.ts; src/services/feedback.ts (network call) #105 normal #109 normal #111 normal #114 haut package-lock.json #116 normal #119 normal #122 normal #127 normal #131 normal #132 bas #138 normal 47 PRs #14-#138: {'bas': 2, 'normal': 28, 'haut': 17} -> haut 36.2 % ``` 36 % haut against a 20 % target. The gap comes from the April 2026 web companion milestone (#41 to #47: Logto, API, WebSocket, sync client): 10/40 (25 %) outside it. With the simpl-resultat rule « `overrides` changed = haut », the rate would be 31/47 (66 %). ## `--check` ``` ok: 41 patterns, identical to the Haut table of REVIEW.md ``` Mutation: removing `web/.env.template` from the script, then `sql-transformer.js` from the table, each makes `--check` exit 1 and name the pattern; restored, it passes. ## Verification commands, run in a clean worktree (2026-10-19) | Command | Result | |---|---| | `npm ci` (root, postinstall patch applied) | exit 0 | | `npm test` | smoke OK, 11/11 | | `npx tsc --noEmit` (root) | exit 0 | | `npx expo export --platform android --no-bytecode --clear` | exit 0, 44 files | | `web/`: `npm ci`, `npx tsc --noEmit`, `npm run lint`, `npm run build` | all exit 0, `next build` needs no Logto variable | ## Choices for Max to confirm 1. **Version bumps stay normal**, override floors included (your 2026-10-17 rule for simpl-resultat, carried over). The alternative makes 66 % of PRs high, almost all of them advisory floors. 2. **`web/src/app/api/**` always high**, even a lint-only change (#91 is high for that reason). Every route is an account-isolation boundary, and the middleware lets any `Bearer` through. 3. **A package removed from the lock is high** like a package added (#88, #100, #114). Removal is lower risk; making it normal would bring the rate to 14/47 (30 %). 4. **`app/_layout.tsx` and `app/(tabs)/settings.tsx` are high only on their sensitive parts** (migrations, Logto, sync, update check), detected by keyword. A UI change in Settings stays normal. 5. **Never low**: `CLAUDE.md`, `web/CLAUDE.md`, `web/AGENTS.md`, `.claude/**`, and `REVIEW.md` outside its « Niveaux » section. ## Found while reading (not fixed here) `web/src/app/api/sync/route.ts` copies the client's `data` into `.set()` for list, task and tag updates (`data` is `z.record(z.unknown())`): a signed-in client can overwrite `userId` and move its own rows into another account. The task-tag link checks ownership of neither side. `REVIEW.md` records it as a pitfall; it needs its own security issue. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
REVIEW.md sets the review level of a PR from the files it touches (Haut,
Normal, Bas), lists the rules per zone with their source (authentication,
API and account isolation, sync, migrations, privacy, release and build,
dependencies, web deployment, i18n), the verification commands (no CI on
this repo: the review replays them) and known review pitfalls.

scripts/review-levels.py replays the levels on merged PRs through the
Forgejo API (read-only) and, with --check, compares its patterns with the
Haut table without network. Replayed on the 47 merged PRs #14-#138:
2 bas, 28 normal, 17 haut (36 %), 10/40 (25 %) outside the web companion
milestone (#41-#47).

CLAUDE.md points to REVIEW.md.

Fixes #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Max confirms the four calibration choices on 2026-10-19:

  1. Version bumps stay normal, override floors included.
  2. web/src/app/api/** is always high.
  3. A package removed from the lock is high, like a package added.
  4. app/_layout.tsx and app/(tabs)/settings.tsx are high only on their sensitive parts.

Recorded in REVIEW.md by commit 7b64557 (« Restent au moins normaux »). The sync-route vulnerability found while reading has its own issue.

Max confirms the four calibration choices on 2026-10-19: 1. Version bumps stay normal, override floors included. 2. `web/src/app/api/**` is always high. 3. A package removed from the lock is high, like a package added. 4. `app/_layout.tsx` and `app/(tabs)/settings.tsx` are high only on their sensitive parts. Recorded in `REVIEW.md` by commit `7b64557` (« Restent au moins normaux »). The sync-route vulnerability found while reading has its own issue.
Refs #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Niveau : normal (pas de REVIEW.md)

Verdict : APPROVE

Résumé : la PR ajoute REVIEW.md (niveaux, règles par zone, commandes, pièges), scripts/review-levels.py et un renvoi dans CLAUDE.md, sans toucher au code livré. Les faits cités sont exacts sur la tête aa50f98, et la calibration se reproduit à l'identique.

Ce qui a été vérifié (copie hors dépôt de aa50f98)

  • Calibration rejouée (API Forgejo, lecture seule) : 47 PRs #14-#138: {'bas': 2, 'normal': 28, 'haut': 17} -> haut 36.2 %, identique au corps de la PR.

  • --check : ok: 41 patterns, exit 0. Mutations :

    • retirer web/.env.template du script → REVIEW.md only: web/.env.template, exit 1 ;
    • retirer sql-transformer.js du tableau → script only: sql-transformer.js, exit 1 ;
    • ajouter app.json aux motifs « toujours » du script → exit 0 (voir suggestion 1) ;
    • passer la condition de eas.json à « jamais » dans le tableau → exit 0 (idem).

    Les deux fichiers ont été restaurés après chaque mutation (cmp OK).

  • review_level sondé hors ligne : .md seuls → bas ; CLAUDE.md, web/CLAUDE.md → normal ; fichier ajouté à la racine ou dans web/ → haut ; route web/src/app/api/** → haut ; changement d'interface dans settings.tsx → normal ; URL de releases/latest modifiée → haut ; fetch('https://…') sur une ligne → haut.

  • Faits cités : tous les chemins du tableau Haut existent, sauf .claude/settings.json et .mcp.json, des gardes posés d'avance. Ont aussi été contrôlés : le passage du Bearer dans le middleware, ws-ticket (30 s), la revalidation WS (15 min), les catégories de rateLimit, sl-mobile-native / simplliste://callback, process.exit(1), l'uid 1001, CONTEXT_KEYS / 2000, les quatre hôtes, l'Inbox …0001, l'absence d'updatedAt sur sl_tags et le .set(data) de la sync. L'issue #142 existe et elle est ouverte.

  • Fermeture : la timeline de #140 porte pull_ref #141 closes (Fixes #140 dans le premier commit et le corps). Les commits suivent le format conventionnel.

  • Rien n'est sensible dans le diff : ni secret ni .env, et le jeton est lu depuis l'environnement ou depuis ~/.forgejo-token.

Suggestions (non bloquantes)

  1. --check ne compare que les motifs, pas les conditions. Les mutations 3 et 4 restent vertes : un motif qui passe de « toujours » à conditionnel (ou l'inverse) d'un côté seulement n'est pas détecté. Le texte dit bien « ses motifs », donc rien de faux. Pour fermer l'écart : comparer aussi l'ensemble des motifs dont la condition vaut toujours… avec HIGH_ALWAYS.
  2. Un fetch( multiligne échappe au détecteur réseau du script. Un fetch( suivi de l'URL sur la ligne suivante (forme de app/(tabs)/settings.tsx:229-230) donne normal. C'est sans effet sur la revue, qui lit le niveau dans le tableau et non dans le script, mais la calibration peut sous-compter. Lire l'appel sur deux ou trois lignes suffirait.
  3. Les exceptions à « chaque route d'API appelle requireAuth() en premier » ne sont pas nommées (zone Authentification). /api/health et /api/logto/* sont exclues du middleware. /api/debug lit la session par getLogtoContext et passe le middleware avec un Bearer quelconque : il ne renvoie que la session du cookie de l'appelant, ce qui respecte la règle de la zone API. Les nommer évite un faux constat sur debug et le copier-coller de son modèle dans une route qui lit des données.

Actions faites

  • Copie de travail scratchpad/pr141 et sauvegardes rl.bak / rv.bak supprimées en fin de revue.
Niveau : normal (pas de REVIEW.md) **Verdict : APPROVE** **Résumé** : la PR ajoute `REVIEW.md` (niveaux, règles par zone, commandes, pièges), `scripts/review-levels.py` et un renvoi dans `CLAUDE.md`, sans toucher au code livré. Les faits cités sont exacts sur la tête `aa50f98`, et la calibration se reproduit à l'identique. ### Ce qui a été vérifié (copie hors dépôt de `aa50f98`) - **Calibration rejouée** (API Forgejo, lecture seule) : `47 PRs #14-#138: {'bas': 2, 'normal': 28, 'haut': 17} -> haut 36.2 %`, identique au corps de la PR. - **`--check`** : `ok: 41 patterns`, exit 0. Mutations : - retirer `web/.env.template` du script → `REVIEW.md only: web/.env.template`, exit 1 ; - retirer `sql-transformer.js` du tableau → `script only: sql-transformer.js`, exit 1 ; - ajouter `app.json` aux motifs « toujours » du script → **exit 0** (voir suggestion 1) ; - passer la condition de `eas.json` à « jamais » dans le tableau → **exit 0** (idem). Les deux fichiers ont été restaurés après chaque mutation (`cmp` OK). - **`review_level` sondé hors ligne** : `.md` seuls → bas ; `CLAUDE.md`, `web/CLAUDE.md` → normal ; fichier ajouté à la racine ou dans `web/` → haut ; route `web/src/app/api/**` → haut ; changement d'interface dans `settings.tsx` → normal ; URL de `releases/latest` modifiée → haut ; `fetch('https://…')` sur une ligne → haut. - **Faits cités** : tous les chemins du tableau Haut existent, sauf `.claude/settings.json` et `.mcp.json`, des gardes posés d'avance. Ont aussi été contrôlés : le passage du `Bearer` dans le middleware, `ws-ticket` (30 s), la revalidation WS (15 min), les catégories de `rateLimit`, `sl-mobile-native` / `simplliste://callback`, `process.exit(1)`, l'uid 1001, `CONTEXT_KEYS` / 2000, les quatre hôtes, l'Inbox `…0001`, l'absence d'`updatedAt` sur `sl_tags` et le `.set(data)` de la sync. L'issue #142 existe et elle est ouverte. - **Fermeture** : la timeline de #140 porte `pull_ref` #141 `closes` (`Fixes #140` dans le premier commit et le corps). Les commits suivent le format conventionnel. - Rien n'est sensible dans le diff : ni secret ni `.env`, et le jeton est lu depuis l'environnement ou depuis `~/.forgejo-token`. ### Suggestions (non bloquantes) 1. **`--check` ne compare que les motifs, pas les conditions.** Les mutations 3 et 4 restent vertes : un motif qui passe de « toujours » à conditionnel (ou l'inverse) d'un côté seulement n'est pas détecté. Le texte dit bien « ses motifs », donc rien de faux. Pour fermer l'écart : comparer aussi l'ensemble des motifs dont la condition vaut `toujours…` avec `HIGH_ALWAYS`. 2. **Un `fetch(` multiligne échappe au détecteur réseau du script.** Un `fetch(` suivi de l'URL sur la ligne suivante (forme de `app/(tabs)/settings.tsx:229-230`) donne normal. C'est sans effet sur la revue, qui lit le niveau dans le tableau et non dans le script, mais la calibration peut sous-compter. Lire l'appel sur deux ou trois lignes suffirait. 3. **Les exceptions à « chaque route d'API appelle `requireAuth()` en premier » ne sont pas nommées** (zone Authentification). `/api/health` et `/api/logto/*` sont exclues du middleware. `/api/debug` lit la session par `getLogtoContext` et passe le middleware avec un `Bearer` quelconque : il ne renvoie que la session du cookie de l'appelant, ce qui respecte la règle de la zone API. Les nommer évite un faux constat sur `debug` et le copier-coller de son modèle dans une route qui lit des données. ### Actions faites - Copie de travail `scratchpad/pr141` et sauvegardes `rl.bak` / `rv.bak` supprimées en fin de revue.
Addresses suggestion 3 of the review of PR #141.

Refs #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
maximus force-pushed issue-140-review-md from 36f6346012 to f8d42914e4 2026-10-20 01:00:15 +00:00 Compare
maximus merged commit f8d42914e4 into master 2026-10-20 01:00:23 +00:00
maximus deleted branch issue-140-review-md 2026-10-20 01:00:23 +00:00
Author
Owner

Merged by fast-forward on 2026-10-19, head f8d4291.

  • Rebased on master (6da669a, STATE.md sync after #136) before the merge: SHAs differ from the reviewed ones, content unchanged apart from the commit below.
  • f8d4291 (was 36f6346) was added after the review, not reviewed: doc only, it names in REVIEW.md the five API routes that skip requireAuth() on purpose (suggestion 3 of the review).
  • python3 scripts/review-levels.py --check passes on the merged tip (41 patterns).
  • Suggestions 1 (--check ignores conditions) and 2 (multi-line network call missed by the script) go to a follow-up issue.
Merged by fast-forward on 2026-10-19, head `f8d4291`. - Rebased on `master` (`6da669a`, STATE.md sync after #136) before the merge: SHAs differ from the reviewed ones, content unchanged apart from the commit below. - `f8d4291` (was `36f6346`) was added after the review, not reviewed: doc only, it names in `REVIEW.md` the five API routes that skip `requireAuth()` on purpose (suggestion 3 of the review). - `python3 scripts/review-levels.py --check` passes on the merged tip (41 patterns). - Suggestions 1 (`--check` ignores conditions) and 2 (multi-line network call missed by the script) go to a follow-up issue.
maximus referenced this pull request from a commit 2026-10-20 01:00:47 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
maximus/simpl-liste!141
No description provided.