chore(memory): V1-1.6 progress in TODO, gate contract

This commit is contained in:
bchanot committed 2026-10-26 17:24:56 +01:00
1 parent e215e9b2cb
commit 212392263c
2 files changed
+94 -1

No files matched your search

@@ -0,0 +1,78 @@
# CONTRACT: V1-1.6 Animals and relations UI, owner brief 2026-10-26 « Validation V1-1.5 et autorisation V1-1.6 Interface Animaux et clôture »
- branch `feature/v1-1-clients-animals`, base 3c2b503 (V1-1.5 validated); commits e223576 (access layer), 930499c
(screens), 3c2b503..HEAD also holds 3e968ee (Playwright journeys, sandbox e2e argument passthrough) and e215e9b (docs)
- diff under review: `git diff 3c2b503..HEAD -- packages apps docs scripts CLAUDE.md`
- functional contract `docs/development/V1-1_OWNERS_ANIMALS.md` §5.2, §5.3, §5.4, §7.1, §9.3, §9.4, §11.1 to §11.5,
§11.8 (as built), §13.3, §15 (closure inventory); owner decisions recorded in §11.8 and TODO: D11 drawer only, first
animal from the client page in one `create_animal` call, no role preselected, relation add as an in-page panel, end /
dates / void as confirmations, U3 date fills and locks the year; D12 not in the brief
- isolated stack `pnpm db:sandbox` is UP. Allowed: `pnpm db:sandbox test`, `pnpm db:sandbox test-db`,
`pnpm db:sandbox types --check`, `pnpm db:sandbox e2e-shell [spec] [--project ...] [--grep ...]`,
`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, `db:sandbox up/down`, any
file change, anything on the DEV stack except `pnpm supabase migration list --local`.
## Clauses
C1. **Scope.** Animal screens, relation panels and dialogs, the client page's animal section, their data access, tests
and docs only: no migration, nothing under `supabase/` or `crates/`, no bilan link (V1-3), no sheet shown, no cabinet,
no tab bar, no dashboard tiles, no weight / photo / coat / identification / neutering / death date / notes field, no
redesign of the client screens (the client page's animal section and the shared `Card` / `Button` fixes aside).
C2. **Access layer.** `packages/supabase/src/{animals,relations}.ts` and the `records.ts` additions: writes only
through the M3 RPCs (no direct insert, update or delete on a record table); reads by id with explicit column lists,
never `select=*`; searches through POST RPCs (no term in a URL); the relations read by animal id with `voided_at is
null` and a bound; generated argument names; Zod-checked answers; closed failure kinds including `duplicate_relation`
and `already_ended`; a non-uuid id makes no request; a foreign id reads as unknown; no service key.
C3. **Routes and isolation.** `/app/animals`, `/new`, `/:animalId`, `/:animalId/edit` behind the workspace gate
(remount per workspace, no data of a previous account shown); the same « Animal introuvable » for unknown, foreign and
malformed ids; no private value or business identifier in a URL query (the origin client travels in the navigation
state and is read again and checked active before being pre-associated); the workspace id is a context, never an
authorisation.
C4. **Form (D-R7).** Name, species, sex required; sex with no preselected value; species from the active rows only;
the detail required for « Autre » and never sent for another species; breed optional; birth year or full date (D6b),
a full date fills and locks the year (U3), no year turned into a date, not in the future (device date), not before
1900; bounds and patterns from `field-limits.ts`; errors under their field, first error focused; one
`create_request_id` per creation intent reused on a retry; `conflict` keeps the typed values and shows the stored
ones; leave guard.
C5. **Creation with a first client.** Optional; one atomic `create_animal` call carrying `client_id`,
`relation_role` and `started_on` (never two calls); the role explicit with none preselected; the pre-associated client
removable before saving; a lost answer retried with the same request id gives one animal and one relation.
C6. **Animal page.** Identity, species, sex, breed, birth with its known precision, status; current relations then the
history, roles, client links, phones as `tel:`, dates only when known (`ended_at` never shown as a date); « Propriétaire
non renseigné » without a current owner, never a placeholder client; voided relations shown nowhere; actions only on an
active animal; archive and restore through the shared dialog, archived page read-only, no client archived.
C7. **Relation writes.** Add (both active, explicit role, optional start), end with an optional real date not before
the start, correct dates, void explained as an erroneous entry and final, never a physical deletion; every write sends
the revision it read; `duplicate_relation`, `conflict`, `already_ended`, `archived`, `limit_reached`, `rate_limited`,
`session_expired`, `network` phrased distinctly; a stale relation (`conflict`, `not_found`) reloads the relations;
confirmations refuse to close while pending and return focus after the change is shown, also when the opener left.
C8. **Client page.** Animals from `list_client_animals` once per animal and group with every role and dates, linked to
the animal page; « Ajouter un (premier) animal » with the client pre-associated; « Associer un animal existant » panel;
none on an archived client; the contractual `current_animal_count` of the list unchanged; ended relations shown as
former, voided ones nowhere.
C9. **Navigation, design, accessibility.** « Animaux » after « Clients » in the sidebar and the drawer, drawer only (no
tab bar); existing components and tokens; labels, visible focus, errors announced, heading focused on page open; 375 px
without horizontal overflow; FR/EN key parity; the new pages pass axe without any KNOWN exception applying to their own
elements; the two phone states scanned from the top of the page are justified in BROWSER_TESTS.md §6.
C10. **Tests.** Unit (access mapping and call shapes, schema and display rules, screens: states, request id reuse,
conflict, archive, relations, client page, session gate); the access layer against real PostgREST
(`animals-access.sandbox.ts`); Chromium journeys `e2e/shell/animals.spec.ts` (brief §17 items 1 to 24, FR/EN, desktop
and 375, axe, request URLs free of fixture values); existing suites green; counter-checks recorded in §11.8.
C11. **Reports, docs, git.** No private data in reports, traces or logs beyond fictitious fixtures (shell suite: no
trace, no HTML report); contract §11.8, §13.3, §14, §15, SUPABASE.md §3.3 (restore check, DEV browser acceptance),
BROWSER_TESTS, TEST_STRATEGY, FRONTEND_ARCHITECTURE, design README, CLAUDE.md updated; commits pushed; no merge; `main`,
`develop` and `release/0.2.0` untouched; DEV untouched (M1 to M3 still pending there).
C12. **Technology boundary.** No business rule re-implemented in TypeScript that PostgreSQL already enforces beyond the
D-R7 form checks; no artificial Rust/wasm call; the boundary choice written in §11.8.