chore(memory): BDR-078, LRN-085/086, EVAL-040, V1-1.5 journal, TODO, gate contract

This commit is contained in:
bchanot committed 2026-10-26 02:31:53 +01:00
1 parent d8e86a4229
commit 3c2b503fc9
6 files changed
+115 -1

No files matched your search

+12 -1
View File
@@ -457,7 +457,18 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet
- Acceptance: gates green; e2e green; local tool and PDF unchanged
- Security: same whole error for every foreign id; FK proof independent of the RPC; animal-then-client lock order
- Stop if: N1, N4, N5 or N8 undecided; any change needed in report, sheet or editor code; the D9a guard blocks a flow the owner did not foresee
- [ ] V1-1.5 Clients UI
- [ ] V1-1.5 Clients UI (owner brief 2026-10-26 « Validation V1-1.4 et autorisation V1-1.5 Interface Clients »; isolated stack only; no animal screen; stop at checkpoint before V1-1.6)
- [x] V1-1.4 closure: owner validated (CONFORME 11/11, security PASS); species_filter + replay order accepted
- [x] owner choices 2026-10-26: U1 « Afficher plus » (keyset, page of 25 + 1 probe); U2 « Archivés » toggle; client page animals = read-only list (list_client_animals, no link, no add); « premier animal » section deferred to V1-1.6
- [x] access layer `packages/supabase/src/{workspaces,clients,species,records}.ts`: personal workspace read, client reads/RPCs with explicit columns, keyset cursors, closed RecordFailure kinds (contract §9.4 + network, session_expired), Zod-checked RPC results; unit tests + real-PostgREST sandbox test of the same functions
- [x] authStore: personal workspace state (loading / ready / inactive / unconfirmed / missing / error) loaded with the account; identity change clears profile, roles, avatar, workspace at once and drops late responses of a previous user
- [x] app: routes /app/clients, /new, /:clientId, /:clientId/edit behind a workspace gate (remount per workspace); list (debounced search, toggle, « Afficher plus », states); detail (contact links, archived read-only, animals read-only, archive dialog with preview, restore); form (D-R7 schema on field-limits, phone entry rule, ISO country list via Intl.DisplayNames, request id per intent, conflict shows saved values, archived refusal); leave guard (beforeunload + in-app link clicks in the shell + Cancel; browser back not interceptable, documented); nav entry after Tableau de bord (mockup order); FR/EN
- [x] unit tests (schema, phone rule, countries, access mapping, store identity change, routes states, archive dialog, conflict, guard) + Playwright `e2e/shell/clients.spec.ts` on the sandbox (journeys, two accounts, pagination, keyboard, FR/EN, 375, axe without inherited exceptions, conflict, retry idempotence, error states, URLs free of fixture values)
- [x] gates (typecheck, test:run, lint, build, e2e:ui, e2e:shell, db:sandbox test-db/test/types --check, import:equine --check, rust:check, check:all), impeccable detect, fresh verifier + security audit
- [x] docs: contract §11.7 as built, FRONTEND_ARCHITECTURE, BROWSER_TESTS, SUPABASE §3.3 note, design README, CLAUDE.md map; BDR, EVAL, journal; commits pushed; checkpoint
- [x] gate fixes: shell HTML report removed (kept typed passwords), ready workspace kept during re-read, not-found heading focus; security PASS, verifier CONFORME 11/11 (round 3); check:all green 02:15:51
- Deviation: leave guard extended from Cancel to every in-app link; search term not kept on back navigation; phones shown E.164
- Pending owner: M1-M3 on DEV (SUPABASE.md §3.3) before the LAN check; D11 decision before V1-1.6
- Objective: list and search, create, edit, detail, archive and restore clients, FR/EN, phone and computer, keyboard
- Depends: V1-1.2, V1-1.3, V1-1.4 (client page lists animals); D11, U1, U2
- Files: `apps/app/src/app/App.tsx` (routes); `apps/app/src/app/routes/app/clients/*`; `apps/app/src/clients/{validation,useClientForm}.ts`; `apps/app/src/components/clients/*`; `SidebarNav.tsx`, `MobileDrawer.tsx`; `apps/app/src/i18n/{fr,en}.ts`; tests; `apps/app/e2e/clients.spec.ts`
@@ -0,0 +1,75 @@
# CONTRACT: V1-1.5 Clients UI, owner brief 2026-10-26 « Validation V1-1.4 et autorisation V1-1.5 Interface Clients »
- branch `feature/v1-1-clients-animals`, base 6251051 (V1-1.4 validated); commits a0e0699 (access layer), ff028ec
(workspace state), b38e627 (client screens), d33a8f6 (Playwright journeys), db81928 (shell report fix), ae0bd3f (docs)
- diff under review: `git diff 6251051..HEAD -- packages apps docs CLAUDE.md` (HEAD includes e1c1980 workspace kept during a re-read, 567ad40 not-found heading focus, and the docs count update)
- functional contract `docs/development/V1-1_OWNERS_ANIMALS.md` §5.1, §7.1, §9.3, §9.4, §11 (§11.7 as built), §12.4, §12.5
- owner choices recorded in TODO (V1-1.5) and contract §11.7: U1 « Afficher plus », U2 archived toggle, animals
read-only on the client page, « premier animal » section deferred to V1-1.6
- isolated stack `pnpm db:sandbox` is UP. Allowed: `pnpm db:sandbox test`, `pnpm db:sandbox test-db`,
`pnpm db:sandbox types --check`, `pnpm e2e:shell`, `pnpm --filter @faunosteo/supabase test:run`,
`pnpm --filter @faunosteo/app exec vitest run`, typecheck and lint, read-only SQL through `pnpm db:sandbox sql`.
Not allowed: `pnpm check:all` and builds (a run is in progress), `db:sandbox up/down`, anything on the DEV stack
except `pnpm supabase migration list --local`.
## Clauses
C1. **Scope.** Client screens and their data access only: no animal screen, route or form, no `animals.ts` or
`relations.ts` access module, no migration, no change under `crates/` or `supabase/`, no mobile tab bar, no
dashboard tiles, no change to the validated mockups. Existing files changed only where the clients need it
(App routes, AppLayout guard, SidebarNav entry, Icon, i18n, authStore, lib/id, e2e support).
C2. **Access layer.** `packages/supabase/src/{records,workspaces,clients,species}.ts`: only the authorised RPCs and
reads (search/list/preview through POST RPCs, read by id with an explicit column list, no `select=*`, no text
filter in a GET URL); pagination contract (25 default, ≤ 100, keyset, one probe row); generated types used for
argument names; failures folded into closed kinds keeping not_found, archived, conflict, request_conflict,
limit_reached, rate_limited, invalid_input, session_expired, network, unavailable; nothing distinguishes a foreign
id from an unknown one; no service key; the workspace id is a context the server re-checks, never an authorisation.
C3. **Personal workspace and identity.** Read after sign-in, never created by the browser; states session absent
(RequireAuth), unconfirmed, inactive, loading, ready, missing, error each rendered; a change of account clears the
previous account's profile, roles, avatar and workspace at once, and late answers of the previous account are
dropped; the client routes remount per workspace, so no row of a previous session shows.
C4. **List.** Search through the backend only (no client-side engine), debounced, ≤ 100 characters; 25 per page
with « Afficher plus »; deterministic order; archived toggle; status badges; access to the page; empty, loading,
network error with retry; reload after changes; no private value in URLs or logs.
C5. **Form.** Person | organization, display name required, no first/last name, optional contacts, no default
country, no notes; bounds and patterns from `field-limits.ts` (D-R7), code points, control characters, Unicode;
phone entry rule of contract §11.3; FR/EN messages; submitting state; double-click guard; one create_request_id per
creation intent reused on retry, a new form a new id, request_conflict explicit; update with the expected revision,
no silent overwrite, conflict understandable with the saved values; archived refusal.
C6. **Archive and restore.** Confirmation through the shared Dialog/ModalDialog (closing is not confirming,
refuses to close while pending, focus D13 kept), preview of sole-owned active animals, no deletion, no cascade to
animals, read-only archived page, restore through the RPC.
C7. **Client page.** Contract fields; `tel:` and `mailto:`; animals read-only from `list_client_animals` (no link,
no add, no invented data); `current_animal_count` from the backend in the list; same « introuvable » for unknown,
foreign and malformed ids.
C8. **Navigation, design, accessibility.** Clients entry in sidebar and drawer in the mockup's order, existing
navigation kept, no tab bar; existing components and tokens reused; labels, visible focus, errors announced next
to fields, first error focused, page heading focused on open; 375 px without horizontal overflow; FR/EN; the new
pages pass axe without any KNOWN exception applying to their own elements.
C9. **Unsaved changes.** `beforeunload` while dirty; in-app links ask first (ModalDialog), staying keeps the
values; what the router cannot intercept (browser back/forward) documented, not claimed.
C10. **Tests.** Unit tests (access layer call shapes and failure mapping; schema; store identity change; screens:
states, retry idempotence, new intent, conflict, archived, archive dialog pending, leave guard, double click);
the access layer against real PostgREST (`clients-access.sandbox.ts`); Chromium journeys on the sandbox
(`e2e/shell/clients.spec.ts`: create, search, edit, archive, filter, restore, pagination, keyboard, two accounts,
conflict, retry, errors, leave guard, language, desktop + 375, axe); request URLs free of fixture values; suites
green when run.
C11. **Reports and docs.** No private data in test reports beyond fictitious fixtures (the shell HTML report that
kept typed passwords removed); contract §11.7, BROWSER_TESTS, TEST_STRATEGY, SUPABASE.md, FRONTEND_ARCHITECTURE,
design README, CLAUDE.md updated; commits pushed; no merge; main and release/0.2.0 untouched; DEV untouched.
## CLARIFICATIONS
- FLOOR ASSERT_DROP `apps/app/e2e/shell/shell.spec.ts` (2 → 0 assertion lines): the `signIn` helper, with its two
`expect` lines, moved verbatim to `apps/app/e2e/support/shell.ts` so both shell specs share it; both specs still
await it, no assertion is lost. Authorised.