76 lines
6.0 KiB
Markdown
76 lines
6.0 KiB
Markdown
# 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.
|