docs(docs): V1-1.6 as built, D11 drawer only, closure inventory, DEV steps

Contract §11.8 and §15; D11 and U3 decided, D12 open; SUPABASE.md §3.3 gains
the rehearsed restore check and the owner's browser acceptance on DEV; browser,
test and frontend docs, design README, CLAUDE.md map.
This commit is contained in:
bchanot committed 2026-10-26 17:24:19 +01:00
1 parent 3e968eeeab
commit e215e9b2cb
7 files changed
+201 -28

No files matched your search

+13 -8
View File
@@ -50,11 +50,11 @@ Product roadmap (owner, 2026-10-25): P0 docs, then V1-1 clients and animals, V1-
V1-3 cloud bilans, V1-4 stored PDF and sharing, V1-5 mobile and accessibility pass
(`docs/development/IMPLEMENTATION_PLAN.md` §0; V1-1 contract `docs/development/V1-1_OWNERS_ANIMALS.md`:
business decisions ratified 2026-10-25, BDR-073; architecture and N1-N9 validated, BDR-074; on
`feature/v1-1-clients-animals` V1-1.1 to V1-1.4 (validated) and V1-1.5 are built: migrations `20261025100000_workspaces.sql`,
`feature/v1-1-clients-animals` V1-1.1 to V1-1.5 (validated) and V1-1.6 are built: migrations `20261025100000_workspaces.sql`,
`20261025110000_clients.sql` and `20261026100000_animals_relations.sql` (contract §8.3), tested on PGlite and the isolated stack
`pnpm db:sandbox`, not applied to Supabase DEV; V1-1.3 the native modal dialog (D13) and the Playwright + axe suites
(D14, `docs/development/BROWSER_TESTS.md`); V1-1.5 the client screens (`/app/clients`, contract §11.7) on the
isolated stack; no animal screen yet).
(D14, `docs/development/BROWSER_TESTS.md`); V1-1.5 the client screens (`/app/clients`, contract §11.7) and V1-1.6
the animal screens and the relations (`/app/animals`, contract §11.8; D11: drawer only, no tab bar) on the isolated stack).
---
@@ -183,7 +183,7 @@ or call `corepack pnpm <cmd>`. Root scripts resolve `node_modules/.bin/pnpm`.
pnpm test:run # vitest run — all tests, single pass, CI-safe
pnpm test # vitest watch — dev loop
pnpm e2e:ui # Playwright Chromium, no backend: Dialog test page + local tool dialogs, desktop + 375 px, axe (in check:all when the pinned Chromium is installed)
pnpm e2e:shell # Playwright Chromium against `pnpm db:sandbox` (must be up): sign-in, dashboard, photo confirmation, phone drawer; never DEV
pnpm e2e:shell # Playwright Chromium against `pnpm db:sandbox` (must be up): sign-in, dashboard, photo confirmation, phone drawer, client, animal and relation journeys; never DEV (`pnpm db:sandbox e2e-shell <spec> [--grep]` for one file)
```
Browser suites (`apps/app/e2e`, `docs/development/BROWSER_TESTS.md`): Chromium only until V1-5,
@@ -225,7 +225,8 @@ faunosteo/
│ │ ├─ routes/auth/{Login,Signup,ForgotPassword,ResetPassword,AuthCallback}Route.tsx
│ │ ├─ routes/app/{Dashboard,Account}Route.tsx ← behind RequireAuth, inside AppLayout
│ │ ├─ routes/app/clients/{ClientsList,ClientCreate,ClientDetail,ClientEdit}Route.tsx ← V1-1.5, behind RequireWorkspace
│ │ ├─ guards/{RequireAuth,RedirectIfSignedIn,SessionLoading,RequireWorkspace}.tsx ← RequireWorkspace: personal workspace ready, remount per workspace
│ │ ├─ routes/app/animals/{AnimalsList,AnimalCreate,AnimalDetail,AnimalEdit}Route.tsx ← V1-1.6, same RequireWorkspace; the first client arrives in the navigation state, never the URL
│ │ ├─ guards/{RequireAuth,RedirectIfSignedIn,SessionLoading,RequireWorkspace}.tsx ← RequireWorkspace: personal workspace ready, remount per workspace, species labels (SpeciesProvider)
│ │ ├─ useLeaveGuard.ts + usePageHeading.ts ← unsaved changes (beforeunload + in-app links via AppLayout); heading focus on page open
│ │ └─ providers/{ConfigProvider,AuthProvider}.tsx ← AppConfig context; session + locale sync start
│ ├─ auth/{validation,redirects,useAuthFailureMessage}.ts ← Zod schemas (i18n keys), safe next path, failure phrasing
@@ -248,9 +249,11 @@ faunosteo/
│ │ ├─ localeStore.ts ← locale Zustand store (persisted to localStorage)
│ │ └─ practitionerCache.ts ← localStorage prefill
│ ├─ clients/{validation,countries,useClientForm,useClientList,useClientRecord}.ts ← client form schema on field-limits (D-R7), ISO list, page-local hooks
│ ├─ animals/{validation,age,species,useAnimalForm,useAnimalList,useAnimalRecord}.ts(x) ← animal form schema (D-R7, U3 birth, no default sex or role), display age, species context
│ ├─ relations/{groups,choices,useAnimalRelations}.ts ← an animal's relations (current / former), stable picker searches
│ ├─ anatomy/drawing.ts ← the core's composed view (`view.canvas`) → DOMParser → importNode (R3; no sanitiser here)
│ ├─ components/
│ │ ├─ ui/{Button,ButtonLink,Card,Dialog,ModalDialog,Input,Label,Select,Textarea,Badge,Chip,Icon,FormField,Notice}.tsx ← ModalDialog: native <dialog> showModal (D13), Dialog and MobileDrawer on it
│ │ ├─ ui/{Button,ButtonLink,Card,Dialog,ModalDialog,Input,Label,Select,Textarea,Badge,Chip,ChoiceRadios,Icon,FormField,Notice}.tsx ← ModalDialog: native <dialog> showModal (D13), Dialog and MobileDrawer on it
│ │ ├─ canvas/{AnatomyCanvas,DetailModal}.tsx
│ │ ├─ observation/{ObservationList,ObservationCard,ObservationPickers,FindingsTreePicker,
│ │ │ VertebraPicker,SeveritySelector,LateralityPicker,
@@ -260,6 +263,8 @@ faunosteo/
│ │ ├─ brand/{Brand,AppHeader,Footer,LanguageSwitcher,HomeSpaceLink}.tsx
│ │ ├─ auth/{AuthLayout,OAuthButtons,PasswordField,UnavailableNotice,AuthLink}.tsx
│ │ ├─ clients/{ClientForm,ClientAnimals,ArchiveClientDialog,ClientNotFound}.tsx
│ │ ├─ animals/{AnimalForm,ArchiveAnimalDialog,AnimalNotFound}.tsx
│ │ ├─ relations/{AnimalRelations,RelationPanel,RelationActionDialog,RelationDialogs,RecordPicker,Pickers}.tsx ← in-page link panel, end / dates / void confirmations
│ │ ├─ shell/{AppLayout,SidebarNav,MobileDrawer,UserBadge,SignOutButton}.tsx
│ │ └─ account/{SectionCard,SaveRow,AvatarSection,PersonalInfoForm,ProfessionalInfoForm,PreferencesForm,SecurityPanel,RoleBadges}.tsx
│ ├─ account/avatarTransport.ts ← magic-byte sniff (never SVG), createImageBitmap → canvas ≤ 1024 px → JPEG transport blob
@@ -272,7 +277,7 @@ faunosteo/
├─ tests/
│ ├─ setup.ts
│ └─ unit/*.test.ts
├─ e2e/ ← Playwright (V1-1.3): playwright.{ui,shell}.config.ts, support/{browser,sandbox}.ts, ui/*.spec.ts, shell/*.spec.ts, harness/dialog.{html,tsx} (dev server only, never built)
├─ e2e/ ← Playwright (V1-1.3): playwright.{ui,shell}.config.ts, support/{browser,sandbox,shell,records}.ts, ui/*.spec.ts, shell/*.spec.ts, harness/dialog.{html,tsx} (dev server only, never built)
├─ docker/
│ ├─ entrypoint.sh ← injects env.js at container start
│ └─ nginx.conf ← SPA fallback + PORT envsubst
@@ -289,7 +294,7 @@ faunosteo/
│ (packages/domain and packages/anatomy deleted at R5.7: their sources resolve at 756b7ef, crates/core/tests/curation/{FILES,LEDGER}.tsv)
├─ packages/supabase/ ← @faunosteo/supabase
│ ├─ src/{index,client,database.types,anatomical-sheets,assets}.ts ← typed client, generated types, publish gate, avatar flow (closed AssetFailure kinds)
│ ├─ src/{records,workspaces,clients,species,field-limits}.ts ← V1-1 record access (closed RecordFailure kinds, keyset pages), D-R7 bounds
│ ├─ src/{records,workspaces,clients,species,animals,relations,field-limits}.ts ← V1-1 record access (closed RecordFailure kinds, keyset pages), D-R7 bounds
│ ├─ tests/e2e/avatar-flow.e2e.ts + vitest.e2e.config.ts ← real-stack end-to-end (`pnpm e2e:avatar`), skipped without the stack env
│ └─ tests/{client,anatomical-sheets}.test.ts, tests/db/ ← PGlite harness, shim, pgTAP runner, schema↔types test
├─ supabase/
+2 -2
View File
@@ -30,14 +30,14 @@ step has built yet, with the step that owns them:
| Element | Owner |
|---|---|
| Clients and Animaux entries and screens | roadmap V1-1 (plan Step 12 reduced, `docs/development/V1-1_OWNERS_ANIMALS.md`). Clients built in V1-1.5 (2026-10-26): the entry in the sidebar and the drawer after Tableau de bord, the screens on the existing cards, fields, badges and buttons (the mockup draws no client screen); Animaux with V1-1.6 |
| Clients and Animaux entries and screens | roadmap V1-1 (plan Step 12 reduced, `docs/development/V1-1_OWNERS_ANIMALS.md`). Clients built in V1-1.5 (2026-10-26): the entry in the sidebar and the drawer after Tableau de bord, the screens on the existing cards, fields, badges and buttons (the mockup draws no client screen); Animaux built in V1-1.6 (2026-10-26): the entry after Clients, the list, form and page on the same components (the mockup draws no animal screen either), relation actions as bordered buttons and in-page panel |
| Fiches anatomiques entry and screen | roadmap V1-2 (plan Step 13 reduced) |
| Bilans entry and screens | roadmap V1-3 (plan Step 14) |
| Agenda entry and screens | plan Step 20 |
| Stat tiles (bilans créés, clients, animaux, rendez-vous) and "Derniers bilans" | once the reports and agenda tables exist; never invented numbers |
| Notification bell | notifications step |
| Avatar photo and "Modifier la photo" | built in Step 8 (2026-10-13): circle + "Modifier la photo" in Informations personnelles, photo in the sidebar / drawer badge and in the top bar with the name on desktop (link to Mon compte, no dropdown) |
| Bottom tab bar on mobile | with the first list screens (today only two destinations) |
| Bottom tab bar on mobile | not reproduced in V1-1: owner decision D11 of 2026-10-26, the drawer stays the mobile navigation for V1-1 (Clients and Animaux in it). The mockup's bar (Accueil, Bilans, Agenda, Profil) stays the direction, a later UX subject, at the earliest with Bilans (V1-3); no custom V1-1 bar, the mockup unchanged |
| Tabs in Mon compte | optional restructuring when "Cabinet et activité" gains fields (activity type, website) |
| Password rule checklist | the mockup says 8 characters; the server policy is 12 with lower, upper and digit (config.toml); the hint text follows the server |
+13 -2
View File
@@ -8,7 +8,7 @@ Chromium only until V1-5. The suites live in `apps/app/e2e`.
| Command | Backend | Dev server | Content |
|---|---|---|---|
| `pnpm e2e:ui` | none | Vite on `127.0.0.1:5191` | `e2e/ui/dialog.spec.ts`: the D13 contract of the shared Dialog on a test page; `e2e/ui/local-tool.spec.ts`: the disclaimer, edit and replace dialogs on the real local-tool routes |
| `pnpm e2e:shell` | the isolated stack of `pnpm db:sandbox` | Vite on `127.0.0.1:5192` | `e2e/shell/shell.spec.ts`: sign-in, dashboard, the account photo confirmation, the phone drawer |
| `pnpm e2e:shell` | the isolated stack of `pnpm db:sandbox` | Vite on `127.0.0.1:5192` | `e2e/shell/shell.spec.ts`: sign-in, dashboard, the account photo confirmation, the phone drawer; `e2e/shell/clients.spec.ts`: the client journeys (V1-1.5); `e2e/shell/animals.spec.ts`: the animal and relation journeys (V1-1.6, contract §11.8) |
Each suite runs on two Chromium projects: `chromium-desktop` (1280 × 800) and
`chromium-375` (375 × 667, mobile viewport, touch). A test tagged `@phone`
@@ -29,7 +29,13 @@ CLI stack. Each test creates its own confirmed account through the sandbox's
GoTrue admin API (random address under `sandbox.local`, random password, a
fictitious display name, the profile locale of the test), and seeds the clean
avatar the worker would have produced (the `assets` row as postgres, the
object with the service key). `pnpm db:sandbox down` removes all of it.
object with the service key). Rows around the subject of a test (clients,
animals, relations) are written as postgres by `e2e/support/records.ts`,
every value quoted as an SQL literal. `pnpm db:sandbox down` removes all of it.
`pnpm db:sandbox e2e-shell <args>` passes its arguments to Playwright: one
spec file, `--project`, `--grep`. The animal suite removes its routes after
each test without waiting for them, so an answer still in flight when the last
check passed is dropped with the context instead of failing the test.
## 2. Prerequisites
@@ -114,6 +120,11 @@ suite needs Docker in the runner for the sandbox.
click has no opener to return to there; a keyboard opening always has one.
- The vitest suites (happy-dom) cover the React wiring of the dialogs only:
happy-dom has no top layer, no inertness and no dialog focusing steps.
- axe's target-size rule measures a control partly under the sticky top bar
as cut. Two phone states of the animal suite are reached at the bottom of a
long page (the client page after linking an animal, a refused duplicate);
they are scanned from the top of the page (`expectAccessibleFromTop`), where
nothing sits under the bar. The controls are 44 px high either way.
## 7. Adding a test
@@ -19,6 +19,12 @@ V1-1.5 (2026-10-26): the first record screens, the clients
under `apps/app/src/clients/`, the personal workspace in `authStore`, the
routes behind `RequireWorkspace`, unsaved changes guarded by `useLeaveGuard`
and `AppLayout`. No data cache library: each page reads what it shows.
V1-1.6 (2026-10-26): the animal screens and the relations (§11.8): hooks
under `apps/app/src/animals/` and `apps/app/src/relations/`, components
under `components/{animals,relations}/`; one `RequireWorkspace` above the
client and animal routes, which also holds the species labels (read once per
workspace, dropped with it); no new business rule in TypeScript (the M3 RPCs
decide, the schemas are D-R7 form checks, age and grouping are display).
## 1. Starting point
+57 -9
View File
@@ -242,6 +242,19 @@ docker exec supabase_db_faunosteo sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" pg_dump
docker exec -i supabase_db_faunosteo pg_restore --list < ~/faunosteo-backups/dev-before-v1-1.dump \
| grep -E "TABLE DATA (auth users|public profiles|supabase_migrations schema_migrations)" # three lines expected
# 3b. The dump restores: into a scratch database of the same server, counts compared, then dropped.
# The scratch name is the only database created or dropped here; never type another one.
docker exec supabase_db_faunosteo sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" createdb -h 127.0.0.1 -U postgres restore_check_v1_1'
docker exec -i supabase_db_faunosteo sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" pg_restore -h 127.0.0.1 -U postgres \
-d restore_check_v1_1 --no-owner' < ~/faunosteo-backups/dev-before-v1-1.dump 2> ~/faunosteo-backups/restore-check.log
grep -c "error:" ~/faunosteo-backups/restore-check.log # only privilege errors on Supabase-managed objects (see below)
for db in postgres restore_check_v1_1; do
docker exec supabase_db_faunosteo sh -c "PGPASSWORD=\"\$POSTGRES_PASSWORD\" psql -h 127.0.0.1 -U postgres -d $db -t -A -c \
\"select '$db: ' || (select count(*) from auth.users) || ' users, ' || (select count(*) from public.profiles)
|| ' profiles, ' || (select count(*) from supabase_migrations.schema_migrations) || ' migrations'\""
done # the two lines must give the same counts
docker exec supabase_db_faunosteo sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" dropdb -h 127.0.0.1 -U postgres restore_check_v1_1'
# 4. Apply without reset (M1's backfill runs inside the migration). `migration up` applies every
# pending migration of the checkout, in order (a shorter path: run it from the checkouts named in step 1).
pnpm supabase migration up --local # "Applying migration 20261025100000_workspaces.sql", then
@@ -262,19 +275,28 @@ docker exec supabase_db_faunosteo sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" psql -h
|| (select count(*) from public.animals) || '"'"' animals'"'"'"'
# expected: N profiles, N workspaces, N members, 0 profiles without exactly one workspace,
# 10 active species, 0 animals
pnpm db:test # pgTAP 001-014 (grants, policies, reads); every file runs in
# begin ... rollback: rows unchanged (checked on the sandbox)
pnpm db:test # pgTAP 001-014: the privilege census (001: grants of every role,
# definer functions, RLS on every table), the policies and the
# RPC refusals; every file runs in begin ... rollback: rows
# unchanged (checked on the sandbox)
pnpm db:types:check # no diff
pnpm e2e:avatar # avatar flow and worker on the DEV stack (fictitious seed accounts)
```
Stop and report instead of continuing when: `migration list` shows another
pending migration or a remote-only one; `db:types:check` before step 4 shows
anything beyond the objects listed in step 1; the dump check misses a line; `migration up`
anything beyond the objects listed in step 1; the dump check misses a line; the
restore check gives other counts or an error that is not one of the expected
privilege errors; `migration up`
applies anything else than the expected V1-1 migrations; any count after it differs from
the expectation. The backup restores into a scratch database (rehearsed:
every row back; `pg_restore --no-owner` prints privilege errors on
Supabase-managed objects, which do not affect the data). Storage file bytes
the expectation. Step 3b was rehearsed on 2026-10-26 against the M3 sandbox
(container `faunosteo_dbsandbox_db`, 119 MB dump of fictitious load-test
data): users, profiles, workspaces, animals and the migration history came back
with the same counts; `pg_restore --no-owner` printed 26 errors, all privilege
refusals on Supabase-managed objects (18 « permission denied to change default
privileges », 5 « grant options cannot be granted back to your own grantor »,
`vault.secrets`, `pg_stat_statements_reset`, `pg_reload_conf`), none on a
table of the application. Storage file bytes
(avatars) live in the storage container's volume, not in the dump; M1 does not
touch them. No down migration exists: going back means restoring the step 3
dump, an owner procedure of its own that is not rehearsed here.
@@ -316,9 +338,35 @@ either (D9a): in DEV, delete its relations, animals and clients first from a
privileged SQL session, in that order.
The browser reaches these tables through `packages/supabase/src/{workspaces,clients,species,records}.ts`
since V1-1.5 (contract §11.7). The client screens run against DEV only once
the owner has applied M1 to M3 with §3.3; until then they are developed and
tested on the isolated stack, and no DEV acceptance is recorded.
since V1-1.5 (contract §11.7) and `{animals,relations}.ts` since V1-1.6
(§11.8). The client and animal screens run against DEV only once the owner has
applied M1 to M3 with §3.3; until then they are developed and tested on the
isolated stack, and no DEV acceptance is recorded.
#### Browser acceptance on DEV (owner, after §3.3)
A checkpoint of its own: the Playwright suites never run against DEV, so this
is the owner's check, from a phone and a computer of the private network, on
`pnpm dev` (DEV origin), with fictitious accounts only (never a real profile
changed for a test). Each line is done in French and in English:
1. sign in; Clients and Animaux open from the sidebar and the drawer;
2. journey 1: new client, « Ajouter un premier animal » from its page, owner
chosen, back on the client page with the animal;
3. journey 2: find the animal from the phone, open it, call the owner through
the `tel:` link;
4. journey 3: add the new owner, end the former owner's relation with a date,
the former owner's page shows « Ancien propriétaire »;
5. journey 4: an animal with no client shows « Propriétaire non renseigné »;
6. journey 5: archive a client (the confirmation lists its sole-owned
animals), find it under « Afficher les archivés », restore it;
7. journey 6: a structure linked as keeper; journey 7: « Autre » with « Furet »;
8. a relation entered by mistake removed with « Erreur de saisie », gone from
both pages;
9. a second account sees none of it (list, search, a copied record URL).
Results are recorded per line, device and language; a line not done is
reported as not done.
## 4. Writing a migration
+7
View File
@@ -39,6 +39,13 @@ V1-1.5 (2026-10-26): supabase vitest 92 (access layer 33); sandbox suites 54
real GoTrue and PostgREST); app vitest 509 (client screens 22, form schema 20,
workspace and account change 7); `e2e:shell` 42 (client journeys 36, FR/EN,
desktop and 375 px, axe). The shell suite keeps no HTML report.
V1-1.6 (2026-10-26): supabase vitest 127 (animal and relation access 35);
sandbox suites 61 (`animals-access.sandbox.ts` 7: the same functions against
real GoTrue and PostgREST, replays, duplicates, end, void, archived, foreign
ids); app vitest 566 (animal screens 35, animal form schema and display rules
22); `e2e:shell` 82 (animal and relation journeys 40: ten journeys, FR/EN,
desktop and 375 px, axe). Counter-checks: 12 deliberate faults caught by the
unit suites, 2 by the browser journeys.
## 1. Layers
+103 -7
View File
@@ -16,7 +16,10 @@ Animaux et relations », BDR-077), which authorised V1-1.4. Migrations M1
procedure: SUPABASE.md §3.3). V1-1.4 was validated on 2026-10-26 (brief
« Validation V1-1.4 et autorisation V1-1.5 Interface Clients »), which
authorised the client screens of V1-1.5 (§11.7), built and tested on the
isolated stack. Nothing of V1-1.6 exists.
isolated stack. V1-1.5 was validated on 2026-10-26 (brief « Validation V1-1.5
et autorisation V1-1.6 Interface Animaux et clôture »), which authorised the
animal screens and the relations of V1-1.6 (§11.8), built and tested on the
isolated stack, and the closure inventory (§15).
Branch: `feature/v1-1-clients-animals`. Roadmap position:
`IMPLEMENTATION_PLAN.md` §0; this step is a reduced plan Step 12 that also lays
the permission frame of Step 10. The file name keeps "OWNERS" so the documents
@@ -26,7 +29,7 @@ Parts: 1 facts, 2 scope, 3 nomenclature, 4 workspaces, 5 entities,
6 permissions, 7 archive, deletion and data protection, 8 SQL schema,
9 policies, helpers and RPCs, 10 technical limits, 11 screens and journeys,
12 tests and Definition of Done, 13 decisions, 14 implementation steps and
risks.
risks, 15 closure inventory.
---
@@ -1304,6 +1307,61 @@ workspace back to loading and unmounted an open form (fixed: a ready workspace
stays on screen until the answer); the « introuvable » screen did not focus its
heading (fixed).
### 11.8 V1-1.6 as built (2026-10-26)
Owner decisions of 2026-10-26: D11 drawer only for V1-1 (the mockup's tab bar
is not reproduced, stays the direction for a later UX step, the mockup is
unchanged); the first animal of a client is created from the client page
(« Ajouter un premier animal ») with that client pre-associated, in one
`create_animal` call, so the client form does not change; no relation role is
preselected; linking a client or an animal is a panel inside the page, ending,
correcting dates and voiding are confirmations; U3 as recommended (a full date
fills and locks the year). The dashboard tiles (D12) are outside the brief's
scope and not built.
| Part | As built |
|---|---|
| Access layer | `packages/supabase/src/animals.ts`: `searchAnimals` (POST, 25 + one probe row, `species_filter`), `fetchAnimalRecord` (explicit columns, no request for a non-uuid id), `createAnimalRecord` (the optional first relation in the same call, `{id, revision, relationId}`), `updateAnimalRecord` (the seven fields, null included), `setAnimalArchived`. `relations.ts`: `fetchAnimalRelations` (one select by animal id, the client embedded through `animal_client_relations_client_fk`, `voided_at is null`, at most 200), `createAnimalClientRelation`, `endAnimalClientRelation`, `updateAnimalClientRelation`, `voidAnimalClientRelation`. `records.ts`: kinds `duplicate_relation`, `already_ended`; every answer checked by Zod |
| Routes | `/app/animals`, `/app/animals/new`, `/app/animals/:animalId`, `/app/animals/:animalId/edit`, under the same `RequireWorkspace` as the client routes (one gate, remount per workspace); an unknown, foreign or malformed id shows « Animal introuvable » |
| Species | read once per workspace, when a page needs them (`SpeciesProvider` inside `RequireWorkspace`), dropped with the workspace on a change of account |
| List | search after 300 ms (name, breed, species detail; POST), species filter over the active rows, « Afficher les archivés », « Afficher plus »; rows with species (and detail), breed, sex, the current owners (three names and the rest counted) or « Propriétaire non renseigné » |
| Form | identity: name; species from the active rows; detail shown and required for « Autre », dropped for any other species; sex as three choices, none checked; breed. Birth: a year, or a full date that fills and locks the year (clearing it leaves the year editable); not after the device's date, not before 1900. On a creation, the optional client: a search among the active clients, then the role (required, none preselected) and the start date. One request id per form, sent again on a retry; `conflict` shows the stored values; leave guard |
| First animal | « Ajouter un (premier) animal » on an active client's page opens the form with the client id in the navigation state, never in the URL; the form reads the client again and pre-associates it only when it is active in this workspace, else says so; the client can be removed before saving; the save returns to the client page |
| Animal page | identity (species, sex, breed, birth with its precision: a date and the age, a year and « environ », or « Inconnue »; status), then « Clients liés »: current relations by role then name, the history by end, each with the client's page link, an archived badge, the phone as `tel:` and the dates when known; « Propriétaire non renseigné » without a current owner. On an active animal: « Ajouter un client » (panel), « Terminer » (optional end date, not before the start), « Corriger les dates », « Erreur de saisie » (voiding, explained as for a relation that never existed, final). An archived animal shows no action. Voided relations are never read |
| Confirmations | `Dialog` on `ModalDialog`; while the write and the reload that shows it run, the dialog refuses to close, so focus returns once the row has moved (to the opener, or the first control of its section when the opener left); `conflict` or `not_found` reloads the relations and says the relation changed elsewhere; any other failure stays in the dialog with the typed date |
| Client page | the animals once per animal and group (current, former) with every role the client holds and the dates, each a link to the animal; « Ajouter un premier animal » / « Ajouter un animal » and « Associer un animal existant » (panel: search among the active animals, role, start date); neither on an archived client |
| Navigation | « Animaux » after « Clients » in the sidebar and the drawer (the mockup's order); no tab bar |
| Shared components | `Card` now passes `aria-labelledby`: it dropped it silently, so the section cards of V1-1.5 had no accessible name (found by the browser suite); `Button` takes `ref` (a React 19 prop); `ChoiceRadios` (the client kind's look) for sex and role |
| Technology boundary | no new business rule outside SQL: caps, duplicates, archived states, dates, revisions and idempotence are the M3 RPCs'; the TypeScript schemas are the D-R7 form checks on the constants proven equal to the CHECKs; age, grouping and order are display formatting. Nothing was added to `crates/`: no rule here is shared with a service or worth a wasm call |
Deviations and limits: a write on a voided relation is `invalid_input` on the
server, but a page that still shows the relation holds an older revision and
gets `conflict` first (lock order archived, revision, voided), so the page
reloads and the row is gone, with no separate « annulée » message; the
confirmations leave without their exit animation; the picker lists active
records only (an archived client or animal cannot be linked, §7.1); the
browser's own date control shows the browser's date format; the limits of
V1-1.5 stay (search not kept on return, E.164 display, back and forward not
guarded).
Tests: supabase vitest 127 (animal and relation access 35); sandbox suites 61
(`animals-access.sandbox.ts` 7: the same functions through supabase-js against
the sandbox's GoTrue and PostgREST); app vitest 566 (animal screens 35, form
schema and display rules 22); Chromium `e2e:shell` 82 (animal journeys 40:
an « Autre » without owner, search, species filter, edit, archive and
restore; pages of 25; the first animal from a client page and an existing
animal linked; co-owners, a keeper structure, a refused duplicate, a voided
mistake, the sale ended with its date; two accounts and a change of session;
keyboard only; a concurrent edit; a retry after a lost answer; network
failures and an archived client refused; a change of language; FR and EN,
desktop and 375 px, axe on every state). Counter-checks: 12 deliberate faults
(request id per attempt, voided rows read, a detail kept for any species, a
date that does not fill the year, a dialog closing on failure, a preselected
role, an archived origin client, no grouping per animal, the species filter
dropped, a default sex, an end before the start, a conflict without reload)
caught by the unit suites; `Card` dropping its name and a request id per
attempt caught by the browser journeys.
---
## 12. Tests and Definition of Done
@@ -1458,14 +1516,14 @@ Not ratified; recommendation and impact given.
| Id | Decision | Recommendation | Impact |
|---|---|---|---|
| D10 | Client information notice: text, and whether the app records that it was given | decide with the legal texts; nothing shown or recorded in V1-1 | none in V1-1; recording it later adds a column; required before public exposure |
| D11 | Mobile navigation (V1-1.3: current navigation kept, the three sources and their consequences in §11.6; decision before V1-1.6) | drawer only in V1-1; the mockup's tab bar (Accueil, Bilans, Agenda, Profil) arrives with Bilans (V1-3), since two of its four entries would lead nowhere today. `docs/design/README.md` says the tab bar comes "with the first list screens": the README line is updated once D11 is decided | UI |
| D12 | Dashboard tiles | the two real tiles (clients, animals) now, from live counts; bilans and appointments when their tables exist | UI |
| D11 | Mobile navigation | decided by the owner on 2026-10-26: the drawer only for V1-1, Clients and Animaux in it; the mockup's tab bar is not reproduced and stays the direction for a later UX step (§11.8, `docs/design/README.md`) | UI |
| D12 | Dashboard tiles | open: outside the V1-1.6 brief, not built; recommendation unchanged (the two real tiles from live counts when the owner asks; bilans and appointments when their tables exist) | UI |
| D13 | Shared `Dialog` focus containment and restore | approved 2026-10-25, built in V1-1.3 on the native modal dialog (§11.6) | shared component |
| D14 | Real-browser test tooling | approved 2026-10-25, built in V1-1.3: Playwright 1.64.1 and axe 4.14.0, Chromium desktop and 375 px, against the isolated stack (§11.6) | manifest and lockfile; Chromium build 1248, no `sudo` |
| D17 | Bridge to the local tool (« start a bilan for this animal », prefill only) | no: V1-3 links bilans to animals properly; a prefill now would be a second path to delete later | none |
| U1 | Long lists | « Afficher plus » (keyset pages of 25), no numbered pages | UI |
| U2 | Archived records | one « archivés » toggle on each list, not a separate tab | UI |
| U3 | Birth input | year field plus optional full date that fills and locks the year (§11.3) | UI |
| U3 | Birth input | decided 2026-10-26 as recommended: year field plus optional full date that fills and locks the year (§11.8) | UI |
### 13.4 Never assumed, framed before any public exposure
@@ -1490,8 +1548,8 @@ validates after V1-1.1 and after the first UI step; nothing merges into
| V1-1.2 | Clients data: M2, RPCs, searches, D15 guards (budget per workspace, its lock), N9 audit policy, field limits and parity test, sandbox suite. Written and tested on the isolated stack (§8.2), validated 2026-10-25; not applied to DEV |
| V1-1.3 | UI foundations: Playwright Chromium and axe (D14), `Dialog` containment and restore (D13). Built (§11.6), validated 2026-10-26 |
| V1-1.4 | Animals and relations data: M3 with the species rows, RPCs, history rules, D9a proof. Written and tested on the isolated stack (§8.3), validated 2026-10-26; not applied to DEV |
| V1-1.5 | Clients UI: routes, forms, list and search, archive, navigation entry. Built and tested on the isolated stack (§11.7), awaiting the owner's checkpoint; the owner's check over the LAN needs M1 to M3 on DEV |
| V1-1.6 | Animals and relations UI, navigation (D11), dashboard tiles (D12), documents, Definition of Done |
| V1-1.5 | Clients UI: routes, forms, list and search, archive, navigation entry. Built and tested on the isolated stack (§11.7), validated 2026-10-26 |
| V1-1.6 | Animals and relations UI, navigation (D11: drawer only), documents, closure inventory (§15). Built and tested on the isolated stack (§11.8), awaiting the owner's checkpoint; D12 not in its brief; the owner's check over the LAN needs M1 to M3 on DEV |
Recommended first step: V1-1.1. It is SQL only, has no visible choice, and
every later step depends on its helpers.
@@ -1518,3 +1576,41 @@ Risks and dependencies:
- no CI runs on the forge: every gate is local;
- two old R5.6 rehearsal worktrees in an earlier session's scratchpad hold
uncommitted edits; they are not V1-1 work and are left to the owner.
---
## 15. Closure inventory (V1-1.6, 2026-10-26)
Owner brief §21. Status words: **done** (built, tested on the isolated stack),
**debt** (non-blocking, documented, kept in the product follow-up),
**deferred** (left out on purpose, with who decided), **blocking** (before a
merge into `develop`), **DEV** (to verify once M1 to M3 are applied, SUPABASE.md
§3.3). Nothing below is verified on DEV: no V1-1 migration is applied there.
| Area | Item | Status | Proof or reason |
|---|---|---|---|
| Workspaces | creation at sign-up, one per account | done | trigger and backfill (§8.1); pgTAP 012; `workspaces.sandbox.ts` (sign-up, parallel GoTrue sign-ups, races, rollback) |
| Workspaces | read, isolation, account change in the app | done | RLS helpers; `authStore` states and reset; `RequireWorkspace` remount; two-account and change-of-session journeys |
| Workspaces | catch-up of existing accounts (backfill) | done; DEV | rehearsed in three migration states on the sandbox; the DEV run is the §3.3 count « 0 profiles without exactly one workspace » |
| Clients | create, search, read, edit, archive, restore | done | §11.7; `clients.spec.ts` 36 runs |
| Animals | create (with or without a client), search, species filter, read, edit, archive, restore | done | §11.8; `animals.spec.ts` |
| Animals | « Autre » with its detail; birth year or full date (D6b, U3) | done | form schema tests; the « Autre » journey |
| Relations | link from both pages, several roles, co-ownership, a keeper structure | done | `animals.spec.ts` co-owner journey; sandbox duplicate race |
| Relations | history, normal end with or without a date, date correction | done | end and dates dialogs; the sale journey; client page « Ancien propriétaire » |
| Relations | voiding a mistake (N4), never deleted, shown nowhere | done | void dialog; the row checked voided in SQL; absent from both pages and from the counts |
| Relations | no link across workspaces | done | composite keys; pgTAP 014; `animals.sandbox.ts` (B linking to A's client: `not_found`, no lock) |
| Quality | SQL | done | pgTAP 919 on the real image and on PGlite; types identical |
| Quality | integration (real GoTrue and PostgREST) | done | sandbox suites 61, in place of the DEV-origin file of §12.3 (`clients-animals.e2e.ts` not written: DEV holds none of M1 to M3, and the sandbox suites cover its cases: two accounts, refusals per role, anon and service keys, unconfirmed and deactivated accounts, D9a) |
| Quality | browsers, accessibility, FR/EN, desktop and 375 px | done | `e2e:shell` 82, axe on every state; Chromium only until V1-5 (§12.5) |
| Quality | `pnpm db:reset && pnpm db:test` of §12.6 | replaced | `db:reset` is forbidden on DEV (owner); the same proof runs on a fresh sandbox (`db:sandbox up fresh`, `test-db`) |
| Promised, not built | « Ajouter un premier animal » section inside `/app/clients/new` (§11.1, §11.3 two-call creation) | deferred | owner decision 2026-10-26: the first animal is created from the client page in one atomic call |
| Promised, not built | inline client creation from `/app/animals/new` (§11.1) | deferred | the V1-1.6 brief asks for a choice among existing clients only |
| Promised, not built | dashboard tiles (D12) | deferred | outside the V1-1.6 brief; D12 stays open |
| Promised, not built | mobile tab bar of the mockup | deferred | owner decision D11, 2026-10-26: drawer only in V1-1 |
| Debt | search and archived toggle not kept on return; phones in E.164; back and forward not guarded | debt | accepted by the owner for V1-1 (brief V1-1.6 §1) |
| Debt | no separate message for a relation voided elsewhere (seen as `conflict`) | debt | §11.8 |
| Debt | pre-existing axe exceptions of RR-7 (language switcher, top bar account link, dashboard `dl`) | debt | scoped to their element and route; no V1-1 page relies on them for its own elements |
| Debt | GoTrue admin with the service key, `service_role` on the species table, no read limit of its own, partial Unicode folding | debt | release track RR-3, RR-4 (§14) |
| DEV | M1 to M3 applied, workspaces and ten active species counted, pgTAP, types | DEV | SUPABASE.md §3.3, owner action |
| DEV | browser acceptance on a phone and a computer over the LAN | DEV | SUPABASE.md §3.3 « Browser acceptance on DEV »; not done |
| Merge | owner's go after the V1-1.6 checkpoint and the DEV acceptance | blocking | §14; nothing merges into `develop` without it |