Files
faunosteo/.claude/tasks/contracts/2026-11-02-v1-2-5-admin-catalogue.md
bchanot dcb1a94ee4 docs(supabase): V1-2.5 checkpoint decisions, TOTP reuse measured, lost-factor review
IDENTITY 4.1 asserted reuse span (step N and N+1), 4.2 lost authenticator paths and gaps, production prerequisite; V1-2 contract 12.3, 13, 17.10, 17.11; design README accepted deviations; REVUE L15 and object_conflict EN; M7 header.
2026-11-02 22:57:22 +01:00

7.9 KiB

Contract: V1-2.5 administration space, rights, species, MFA, catalogue (owner, 2026-11-02)

Brief « Validation propriétaire V1-2.4 » (2026-11-02): V1-2.5 authorised once its dependencies are VERIFIED, within the existing contract, no new scope. Prerequisites checked on 994b04e (V1-2 contract §17.10). Plan: V1-2 contract §16.6, with §5.2 to §5.7, §7.2, §10, §11, §15; owner answers BDR-097 (M7 admin reads, working-copy action, EN « Permission »); design reference docs/design/v1-2-4/ (approved, BDR-096). Step plan: .claude/tasks/plans/2026-11-02-v1-2-5.md.

Kept from the brief: no merge into develop, main or a release; no Supabase DEV operation; no worker on DEV; tests and an independent review fit for the step; commits and pushes on feature/v1-2-anatomical-sheets; STOP at the V1-2.5 checkpoint (gates; the owner tries the result at V1-2.6). Sandbox stack only (pnpm db:sandbox), never DEV; every command runs from the V1-2 worktree, never from the main checkout. The graphic design is not reopened.

Criteria

  • C1 MFA behaviour proven on the sandbox (real GoTrue, §5.6, §5.7.1, §5.7.3, §5.7.4): first factor enrolled at aal1; verify reaches aal2; a second factor from aal1 refused; removal of a verified factor from aal1 refused; removal from aal2 and what it does to the account's other sessions recorded; a dormant unverified factor verified later recorded; a password change or reset never reaches aal2; refresh keeps aal2; a new sign-in starts at aal1. Expectations are what the pinned image does; if aal1 can enrol a second factor or remove a verified one, the step STOPS for an owner decision.
  • C2 Mon compte, Sécurité: add a TOTP factor (QR code, secret shown once, never stored, logged or sent anywhere by the app), verify it with a code, name it, list and remove factors; the aal2 requirements of GoTrue surfaced as messages, never bypassed; a step-up challenge entering /app/admin at aal1, no admin data requested before it succeeds.
  • C3 Navigation (§11.1, BDR-094): « Fiches anatomiques » only for catalogue readers (hint from the caller's own grant rows), one « Administration » entry for capability holders and the owner role, sidebar and drawer; a direct /app/anatomy URL without the right shows « Accès non autorisé » (L32) acting on the server's refusal, the same whether the sheet exists or not; signed out → login. Hidden entries protect nothing.
  • C4 Administration (board 10, §11.1): the page lists the caller's permissions and session state; cards « Fiches officielles », « Espèces », and « Accès et habilitations » for the owner only; each account sees only the entries and actions its capabilities allow (reviewer-only: no « Nouvelle fiche », « Créer une copie de travail », « Accès et habilitations », species creation or activation).
  • C5 Sheets (A1, W1 start): /app/admin/sheets every official sheet with the historical and working-copy badges and the filters species, sheet status, version status, round status, through M7; /new species (inline creation of an inactive species), names, slug, from the core's empty document; /:sheetId overview with versions and rounds; « Créer une copie de travail » on the historical sheet, disabled with its explanation while a copy is active; creation and copy land on the overview (editor in V1-2.6).
  • C6 Species (S1, §7.2): /app/admin/species active and inactive species; creation and editing of an inactive species (E); activation and renaming (O); the animal forms unchanged until activation.
  • C7 Rights (A0, §5.2): /app/admin/access (owner): find an account by e-mail, grant with reason, verification note (capabilities) and optional expiry, revoke with a reason; active, expiring (30 days), expired and revoked grants with their reason and note; aal1 attempts refused in the UI and in SQL.
  • C8 Catalogue (P1, boards 01 to 03, complementary page): /app/anatomy published sheets by species, search by sheet name only, species filter; /:sheetId current version (views, zones, findings, references, disclaimer, earlier versions); /:sheetId/versions/:number; loaded through get_sheet_version and PreviewSheet (hash, fingerprint, caps checked by the core); whole drawing at opening on a phone, zoom and pan after; drafts never listed; archived sheets absent from the list and readable by id; Supabase or core unavailable → the unavailable notice.
  • C9 M7 sheet_admin_reads: read RPCs only, capability holders at aal2 (caller_can_see_official_sheet), one answer for unknown and forbidden ids; no write path, grant widening, policy or rule change; pgTAP allowed and denied cases (anonymous, reader, admin without capability, capability at aal1); types regenerated; a fresh install and an upgrade from the M6 state on the sandbox.
  • C10 Labels: ratified wordings used verbatim (V1-2 contract §3 with BDR-097, REVUE.md tables); every new FR/EN string goes through i18n and is listed at the checkpoint as a proposal; every failure kind the screens meet has an FR and an EN message.
  • C11 Tests and gates: unit; e2e:shell A0, A1, S1, P1, access per right, MFA required, refresh keeps aal2, no aal1 enrolment of a second factor, axe, 320 to 430 px for the catalogue, 375 px for admin screens, FR and EN; pnpm check:all; fresh verifier against this contract; fresh security audit. Nothing reported as passed that did not run.
  • C12 Docs: IDENTITY.md (MFA screens, step-up, recorded GoTrue behaviour), V1-2 contract state, CLAUDE.md folder map, design README owning steps, TODO, memory.

Out of scope

The editor (V1-2.6), the review and publication screens (V1-2.7), deprecation and archive actions (V1-2.7), the equine working copy content work (V1-2.8), any DEV operation (§16.11), recovery runbook rehearsal (V1-2.9).

CLARIFICATIONS (after the fresh reviews of 2026-11-02 on 3d2b5a5)

  • Skips: apps/app/e2e/shell/admin.spec.ts skips A0, A1 and S1 on the chromium-375 project only (three test.skip(isPhone(info))). These journeys run on desktop; every admin page at 375 px is covered by the unskipped screens test and the access-per-right test. Deliberate, not a reduction.
  • C4 gap fixed: /app/admin/sheets/new shows « Accès non autorisé » to any account whose own grants, once read, hold no active sheet_editor grant (display rule; the server refuses creation anyway); unit tests for a reviewer, a publisher and an owner without the capability. While the grants load the page waits; when their read failed it shows « Impossible de vérifier vos autorisations » with a Retry button, never the form (owner decision 2026-11-02; a server refusal of the species read still wins with « Accès non autorisé »; V1-2 contract §17.11).
  • Security MEDIUM fixed: M7 restates the grants of the redefined get_sheet_version. LOW fixed: the e2e enrolment check no longer prints the throwaway setup key on failure.
  • Run evidence for the criteria a read-only verifier cannot run (orchestrator runs, sandbox only): C1 mfa-behaviour.sandbox.ts 10/10 (twice by the executor, once on a fresh install); C9 sandbox fresh install and upgrade from M6, pgTAP 1941 pass, types match (after the fixes: fresh install, 1941 pass, types match); C11 pnpm check:all all checks passed on 4f6c0ba code (= 3d2b5a5 code), pnpm e2e:shell 108 passed / 6 skipped (slice J run, and again after the fixes), unit core-wasm 66, supabase 148, app 653.
  • P1 catalogue journey on chromium-375 (search typed, 8 cards instead of 1): failed in two of four full e2e:shell runs, reproduced once in 16 repetitions. Cause: the test filled the search box while the mobile drawer's modal was still closing, page inert. Fixed in the test: both navigation helpers wait for the drawer to be gone (32 of 32 repetitions, then the full suite green). A person cannot type in that window either. pgTAP 014 (« nine species ») fails on a stack where the shell suite already ran (test species left behind): run test-db before e2e:shell on one stack.