From 0826ecf383806745507917f596a664bc3621c100 Mon Sep 17 00:00:00 2001 From: bchanot Date: Sun, 25 Oct 2026 23:47:49 +0100 Subject: [PATCH] chore(memory): BDR-076, LRN-082, EVAL-038, V1-1.3 journal, TODO, gate contract --- .claude/memory/decisions.md | 6 ++ .claude/memory/evals.md | 7 +++ .claude/memory/journal.md | 5 ++ .claude/memory/learnings.md | 5 ++ .claude/tasks/TODO.md | 15 ++++- .../2026-10-25-v1-1-3-ui-foundations.md | 57 +++++++++++++++++++ 6 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 .claude/tasks/contracts/2026-10-25-v1-1-3-ui-foundations.md diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 47ea417f..c8a05a68 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -558,3 +558,9 @@ M2 as built (`20261025110000_clients.sql`): budget = owner's transactional count Measured: search 20k clients p95 21 ms (no trigram index); held budget row delays only its workspace. Alt: count audit rows per workspace (needs index on metadata, count+insert race without extra lock); rolling windows (owner chose UTC windows); accept divergent replay as replay (silent divergence). Status: active. M1+M2 not on DEV. + +## BDR-076 | 2026-10-25 | V1-1.2 validated; V1-1.3 UI foundations: native modal dialog, Playwright + axe on sandbox + +Decision (owner brief « Validation V1-1.2 et autorisation V1-1.3 Socle UI »): V1-1.2 accepted (M1+M2 on isolated stack, budget 1000/h 5000/day UTC fixed windows, not to reopen without defect). D13 built on platform `` + `showModal()` (`components/ui/ModalDialog.tsx`): no a11y primitive in deps, browser modal = proven one, no hand-written trap. Never self-closes: Escape keydown cancelled → onClose, cancel → onClose, forced close reported. First tabbable focused explicitly. Restore after commit (microtask) to opener else first control of nearest surviving container. Tab past last control → browser UI one step (platform; kept). Dialog: aria-labelledby + optional description. Drawer on same primitive, closes at lg. D14: Playwright 1.64.1 + axe 4.14.0 exact dev deps. Owner choices this run: e2e backend = sandbox (not DEV), `pnpm e2e:ui` + `pnpm e2e:shell`, drawer aligned, check:all runs e2e:ui if Chromium present else SKIPPED. D11: no tab bar in V1-1.3, three-way comparison in contract §11.6, decision before V1-1.6. +Alt: `inert` + custom Tab loop (artisanal, contract's first wording); focus-trap / Radix (new dep); e2e on DEV (writes sessions to existing accounts); route-stubbed backend (not real GoTrue). +Status: active. Contract §11.6, BROWSER_TESTS.md. diff --git a/.claude/memory/evals.md b/.claude/memory/evals.md index ae3995f5..420fa7b5 100644 --- a/.claude/memory/evals.md +++ b/.claude/memory/evals.md @@ -268,3 +268,10 @@ Result: security PASS (MEDIUM: secrets on argv in db-sandbox.sh, fixture passwor Fixes applied: secrets via env files + PGPASSWORD name only, password-free --db-url, load_secrets refuses incomplete file, state dir refused in repo. Accepted: fixture password literal (sandbox only), uncapped cursor (bounded by name_key compare), read rate limit (deploy notes RR-5). Anomalies: Write tool turned `
/
` escapes into raw chars (broke a JS regex) → check new files for raw line separators; prettier over tests/ touched 3 unrelated files → restored; real image adds GRANT hint to table denials. Action: write Unicode escapes via shell/python when exact bytes matter. + +## EVAL-038 | 2026-10-25 | V1-1.3 UI foundations + db:sandbox final check + +Method: sandbox scripted check (fresh, upgrade, types, argv scan of /proc cmdlines, negative args/secrets/state dir, DEV fingerprint before/after); 6 mutations on dialog/drawer/avatar; fresh verifier (contract 2026-10-25-v1-1-3-ui-foundations.md) + fresh security auditor. +Result: sandbox 40/42 first pass → defect `up` bad mode/version started 4 containers + secrets before refusing → fixed 57922e0, 15/15 rerun, upgrade rerun green, DEV unchanged. Mutations: 5/6 caught at once; M5 (confirmation closed before removal) missed until RPC slowed. Verifier CONFORME 8/8. Security PASS (MEDIUM pre-existing fixture password literal; LOW seed SQL interpolation of generated values, env breadth to webServer, refused URLs unmasked → fixed). check:all green 23:41:29; e2e:ui 26, e2e:shell 6, vitest app 458. +Anomalies: axe pre-existing serious findings (switcher, top-bar link label-in-name, dashboard dl) → KNOWN list + RR-7; the shell suite found a real focus defect in AvatarSection. +Action: keep mutation pass for browser tests; slow async backends in focus tests. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 230d0371..1d89ac34 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -409,3 +409,8 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp ## 2026-10-25 (V1-1.2 clients, branch feature/v1-1-clients-animals) - Owner validated V1-1.1, authorised V1-1.2 + kept sandbox. M1 closure: official `gen types` against sandbox = 0 diff; `scripts/db-sandbox.sh` committed (08abe42), DEV procedure rehearsed incl. backup/restore (5ed1f01); LRN-080/081. - M2 clients (4adbfcb): RPCs, search, budget counter, N9 filter; pgTAP 013 (130), parity test, sandbox suite 28; real image adds a GRANT hint on table denials (PGlite not) → tests compare state+message there. Prettier over tests/ reformatted 3 unrelated files → restored before commit. + +## 2026-10-25 (V1-1.3 UI foundations, branch feature/v1-1-clients-animals) +- Owner validated V1-1.2, authorised V1-1.3. db:sandbox final check: defect bad `up` args → fixed 57922e0; fresh + upgrade + types + argv + DEV fingerprint green. +- Built ModalDialog (native dialog), Dialog/drawer on it, Playwright + axe suites (e2e:ui 26, e2e:shell 6 on sandbox), check:all stage; shell suite found AvatarSection focus loss → fixed 8371aa0. D11 compared, no tab bar. BDR-076, LRN-082, EVAL-038. +- Verifier CONFORME, security PASS, check:all green. STOP at checkpoint, no V1-1.4, no merge. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index caf2d7bb..9300fdc7 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -584,3 +584,8 @@ Apply: `scripts/db-sandbox.sh` (`pnpm db:sandbox`) for every migration step; DEV CLI 2.120 against the sandbox PostgreSQL (127.0.0.1:57432, image 17.11.0.004, no TLS configured): without the option → `DbConnectError … tls error (The server does not support SSL connections)` and the error JSON lands on stdout (piping it to prettier gives a confusing syntax error). With `?sslmode=disable` the output matched the committed `database.types.ts` byte for byte for the pre-existing schema (same generator as `--local`). Same URL works for `migration up`, `test db`. Not checked: other CLI versions, TLS-enabled targets (keep TLS there). Apply: any `--db-url` to a local non-TLS Postgres; never pipe generator output without checking the exit code. + +## LRN-082 | 2026-10-25 | Native modal `` in Chromium: three traps, one test blind spot + +Shown on Chromium 156 (Playwright 1.64.1): (1) Escape cancelled only via `cancel` event → second Escape without user activation closes anyway (close-watcher anti-abuse); `preventDefault` on keydown Escape stops the close request entirely. (2) Initial focus = scrollable panel when content long, first button otherwise → focus first tabbable explicitly. (3) Tab past last control → `document.hasFocus()` false one step (browser UI), then back to first; page never reached. happy-dom: showModal only sets `open` (no inert, no focus) → unit tests prove wiring only. Exit animation (motion, 180 ms) masked async focus loss: a fast sandbox RPC settled before unmount, test green with defect → slow the RPC via `page.route` + `route.fallback()` to discriminate. axe color-contrast false positives while entrance animation runs → wait `document.getAnimations()` settled. +Apply: any modal or async confirmation test; mutation-check browser tests. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 8a57122c..fb6e249d 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -416,7 +416,18 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet - Acceptance: gates green; e2e green on the local stack; measurement written in the contract - Security: constraint and parse errors caught inside RPCs; text parameters parsed in the body; search through POST; definer census - Stop if: `unaccent` cannot load on PGlite or the CLI stack; the measurement is above 100 ms p95 (index decision for the owner); a CHECK cannot be mirrored in TypeScript - - [ ] V1-1.3 UI foundations + - [ ] V1-1.3 UI foundations (owner brief 2026-10-25 « Validation V1-1.2 et autorisation V1-1.3 Socle UI »; no M3, no client/animal screen, DEV untouched, stop at checkpoint) + - [x] V1-1.2 closure: db:sandbox final check (fresh, upgrade, types, argv scan, negative cases, DEV fingerprint); defect `up` bad args started containers → fixed 57922e0, rerun green + - [x] owner choices 2026-10-25: e2e backend = isolated stack (Playwright routes Supabase calls to `pnpm db:sandbox`); scripts `pnpm e2e:ui` (no backend) + `pnpm e2e:shell` (sandbox); MobileDrawer on the same modal mechanism; check:all runs e2e:ui when the pinned Chromium is installed, else an explicit SKIPPED line + - [x] `ModalDialog` primitive on native `` + `showModal()` (platform inertness, Escape via keydown/cancel → onClose, consumer decides, opener restore + nearest-container fallback, scroll lock CSS); `Dialog` on it (aria-labelledby title, optional `description` → aria-describedby); confirmation consumers pass their message as description; `MobileDrawer` on it (closes at lg) + - [x] unit tests (happy-dom: wiring only): Escape/cancel/close/backdrop → onClose, never self-close, name + description, restore + fallback; existing suites green + - [x] Playwright + axe dev deps pinned (license, transitive census), Chromium download (no sudo); configs `e2e/playwright.{ui,shell}.config.ts`, Vite on 127.0.0.1 dedicated ports, request allowlist (anything else aborted and fails the test) + - [x] e2e:ui: harness page `e2e/harness/dialog.html` (dev server only, not in the build): open, initial focus, Tab/Shift+Tab, containment, Escape allowed/refused (twice), close button, restore, opener gone, background inert + no scroll, name/description, long content, 375 px, no horizontal overflow, axe FR/EN; local tool dialogs (disclaimer, edit infos) desktop + 375 + - [x] e2e:shell: fictitious account through the sandbox admin API, clean avatar seeded; login → dashboard, drawer at 375 (containment, Escape, restore), avatar remove dialog (name, description, Escape, confirm → opener gone → fallback), FR/EN, axe, request URLs free of fixture values + - [x] defect found by the shell suite: the photo confirmation closed before the removal, focus fell on the page once the button vanished → confirmation open until settled, deferred restore, sr-only file input out of the tab order (8371aa0); mutation-checked with a slowed RPC + - Deviation: contract §12.5 said DEV origin; suites run on loopback servers against the isolated stack (owner choice); TODO line "users through the admin API, DEV origin, service key from env" superseded + - [x] check:all stage; docs (contract D13/D14 final + D11 note, TEST_STRATEGY, browser tests doc, SUPABASE §5.1 e2e-shell, CLAUDE.md map + commands); D11 three-way comparison + - [x] gates: typecheck, test:run, lint, e2e:ui, e2e:shell, rust:check, check:all; fresh verifier + security audit; commits pushed; checkpoint report (verifier CONFORME 8/8, security PASS, check:all green 23:41:29; refused URLs masked after audit LOW) - Objective: real-browser harness and accessible dialogs before the first screens - Depends: D13, D14 approved - Files: `apps/app/package.json` + `pnpm-lock.yaml` (`@playwright/test`, `@axe-core/playwright`, dev only); `apps/app/playwright.config.ts` (Chromium desktop + 375×667); `apps/app/e2e/` (fixtures: users through the admin API, DEV origin, service key from env never committed); `apps/app/src/components/ui/Dialog.tsx` (`inert` + restore to opener) + tests; root script (name to confirm) @@ -462,7 +473,7 @@ Inventory: `.claude/audits/2026-10-25-functional-inventory.md`. Each item: treat - [ ] RR-4 API trust boundaries: direct export API trusted for what it declares (RUST.md §11.22), `export_from_envelope` L6, RPC surface review (authenticated 17, service_role 9, anon 0), worker service key readable by the docker group (DEPLOY.md) - [ ] RR-5 production configuration: CSP example in DEPLOY.md lacks `'wasm-unsafe-eval'` and the Supabase `connect-src`; compose publishes 8080 on all interfaces while DEPLOY says 127.0.0.1 (rootful Docker bypasses UFW); stale no-backend DEPLOY sections; Q2 hosting; production SMTP, FR auth email templates, captcha, OAuth ids; DEV hardening (demo keys, 54321 on LAN) - [ ] RR-6 dependencies and images: base images by tag only (pin digests), cosign, workflow actions by tag, CI never run (BDR-047), release-images never executed -- [ ] RR-7 accessibility: WCAG target to set; dialog focus trap/restore, close button 24 px, canvas zones keyboard-unreachable, no axe test, D2/D5 Context7 items (RUST.md §10.14) +- [ ] RR-7 accessibility: WCAG target to set; dialog focus trap/restore (done V1-1.3, native modal dialog), close button 24 px, canvas zones keyboard-unreachable, axe test (done V1-1.3: e2e:ui, e2e:shell), D2/D5 Context7 items (RUST.md §10.14). Pre-existing serious axe findings let through by exact node in `apps/app/e2e/support/browser.ts` KNOWN_VIOLATIONS: LanguageSwitcher label-in-name (« FR » shown, « Passer en français » announced), top bar account link label-in-name (display name shown, « Mon compte » announced), DashboardRoute `dl` with a status row lacking dt/dd. Seen outside the scanned states: ObservationCard header `nested-interactive` + label-in-name (editor with an observation); moderate: duplicate `main` landmarks (App + routes), no h1 on Home - [ ] RR-8 mobile and end-to-end: real-browser e2e for sign-up, login, account, avatar, full editor flow, export, locale, mobile drawer (TEST_STRATEGY §1 `apps/app/e2e`); per-check device results (J1/J2 recorded as a whole) - [ ] RR-9 release 0.2.0 fate (Steps 3–6 on TS engines, 341 commits behind develop): ship, supersede, or rebase; sheet bundle default `none` - [ ] RR-10 census tools maintenance (LOW `#[ignore]` positions) and controlled oracle evolution on a new anatomical changeset diff --git a/.claude/tasks/contracts/2026-10-25-v1-1-3-ui-foundations.md b/.claude/tasks/contracts/2026-10-25-v1-1-3-ui-foundations.md new file mode 100644 index 00000000..2617e3cc --- /dev/null +++ b/.claude/tasks/contracts/2026-10-25-v1-1-3-ui-foundations.md @@ -0,0 +1,57 @@ +# CONTRACT: V1-1.3 UI foundations + V1-1.2 closure, owner brief 2026-10-25 « Validation V1-1.2 et autorisation V1-1.3 Socle UI » + +- branch `feature/v1-1-clients-animals`, base 5bc6631 (V1-1.2 validated); commits 57922e0 (sandbox fix), 6f885ec (dialog), + 72ee9f9 (Playwright UI suite), 8371aa0 (photo confirmation focus), e3a2b3e (shell suite), 9b2a4bc (check:all), 9cd33f1 (docs) +- diff under review: `git diff 5bc6631..9cd33f1 -- apps scripts package.json pnpm-lock.yaml .gitignore docs CLAUDE.md` +- functional contract `docs/development/V1-1_OWNERS_ANIMALS.md` §11.5, §11.6 (as built), §12.5, §13.3; `docs/development/BROWSER_TESTS.md` +- owner choices of 2026-10-25 (asked during the run): e2e backend = isolated stack (not DEV); public commands `pnpm e2e:ui` + + `pnpm e2e:shell`; MobileDrawer on the same modal mechanism; check:all runs e2e:ui when the pinned Chromium is installed, else SKIPPED +- isolated stack: `pnpm db:sandbox` is UP (fresh). Allowed: `pnpm db:sandbox test-db`, `pnpm db:sandbox types --check`, + `pnpm db:sandbox test`, `pnpm e2e:shell`, `echo "" | pnpm db:sandbox sql`. `pnpm check:all` may be running in the + background and owns port 5191 while it does: do not run `pnpm e2e:ui` unless `ss -ltn | grep 5191` is empty. The DEV stack + (`supabase_*_faunosteo`) must not be touched except `pnpm supabase migration list --local` (read-only). Never `pnpm dev`. + +## Clauses + +C1. **Scope.** No migration, no M3 object, no client or animal screen or route, no change under `crates/`, `supabase/migrations`, +`supabase/tests`; no V1-1.4 work; no tab bar; mockups under `docs/design/` unchanged; no new runtime dependency (only dev +dependencies of `apps/app`); no merge, `main` / `develop` / `release/0.2.0` untouched. + +C2. **Sandbox final check (V1-1.2 closure).** `scripts/db-sandbox.sh`: an unknown `up` mode, a missing or malformed upgrade +version (not 14 digits) is refused before any container or secret exists; the new `e2e-shell` command and the refactored `test` +command pass the endpoints and keys through the environment (no secret on any argv), call `load_secrets` first (missing or +incomplete secrets refused), and reach only sandbox URLs; ports stay on 127.0.0.1; no volume; cleanup by literal names unchanged. + +C3. **ModalDialog (D13).** `apps/app/src/components/ui/ModalDialog.tsx` uses the native `` + `showModal()` (no focus-trap +library, no hand-written Tab loop); never closes itself: Escape keydown cancelled (`preventDefault`) and turned into `onClose`, +`cancel` cancelled and turned into `onClose`, a platform-forced `close` reported to `onClose` only when the dialog is really closed; +initial focus on the first tabbable control; focus restored after the commit to the opener, else to the first tabbable control of +the opener's nearest surviving container; StrictMode remount does not steal focus or close the dialog; IME composition ignored. + +C4. **Consumers.** `Dialog` named by `aria-labelledby` (its h2), optional `description` → `aria-describedby`; visual output of the +existing dialogs unchanged (same classes, same spacing); the four confirmations (AvatarSection, ReplaceSessionDialog, +HeldSessionPanel, DisclaimerDialog) pass their message as description; MobileDrawer on ModalDialog, named « Navigation principale », +closes at the `lg` breakpoint; AvatarSection keeps its confirmation open while the removal is in flight (Escape, Cancel, backdrop +refused) and closes when it settles; its sr-only file input is out of the tab order; the page does not scroll behind a modal +(`html:has(dialog:modal)` in `styles/index.css`). + +C5. **Dependencies (D14).** `@playwright/test` 1.64.1 and `@axe-core/playwright` 4.14.0 exact, devDependencies of `apps/app` +only; lockfile adds exactly @playwright/test, playwright, playwright-core, @axe-core/playwright, axe-core (licenses Apache-2.0 / +MPL-2.0); no install script added to the repo; no `sudo`, no `--with-deps`. + +C6. **Browser suites.** `apps/app/e2e`: two configs, dev servers on 127.0.0.1:5191 / 5192 with `--strictPort` and +`reuseExistingServer: false`; the UI server has an empty Supabase connection; the shell server uses the `.invalid` fake origin and +the sandbox anon key; an automatic request guard aborts every request outside the allowlist and fails the test; fixture values +checked against request URLs and masked in reports; the shell suite keeps no trace; the test page `e2e/harness/dialog.html` is not +part of the production build (`vite build` input is `index.html` only); accounts fictitious, random, sandbox only. + +C7. **Tests prove the brief §9 list in Chromium.** Open, initial focus, Tab and Shift+Tab, containment (never the page; one browser +UI step at the wrap is the platform's), Escape allowed, Escape refused twice, close button, restore, vanished opener (test page and +real shell with a slow removal), background inert (focus, click, scroll), name and description, long content, 375 px, no horizontal +overflow, axe zero serious/critical outside the three listed pre-existing nodes, FR and EN, a representative test in the real +`/app` shell. Vitest suites green; existing suites unchanged in behaviour. + +C8. **Gates and docs.** `pnpm typecheck`, `pnpm test:run`, `pnpm lint`, `pnpm e2e:ui`, `pnpm e2e:shell`, `pnpm check:all` green +(check:all includes rust-check.sh); docs updated: contract §11.6 (D13 final, D14 as built, D11 three-way comparison with +consequences for Clients and Animaux), §12.5 deviation, BROWSER_TESTS.md (prerequisites, commands, limits incl. WebKit/Safari), +TEST_STRATEGY, SUPABASE §5.1, CLAUDE.md. Pre-existing axe findings named in TODO RR-7.