diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 9334472f..fbe37bae 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -760,3 +760,16 @@ Also: G1/G2 corrections validated, conformance 8/8 acknowledged; UX decisions 2- **Decision**: owner 2026-11-02 (AskUserQuestion), V1-2.5 slice I. `get_sheet_version` returns `document_fingerprint` for published AND deprecated versions (draft: none). Redefined in M7 `20261102100000_sheet_admin_reads.sql` (never applied to DEV); body otherwise identical to M5. pgTAP 022 +3. Contract §10, §12.3, §17.10 amended. **Rationale**: core PreviewSheet (V1-2.2) checks stored fingerprint for published + deprecated; M5 RPC gave it for published only (contract §10 wording) → every withdrawn version page refused `fingerprint_mismatch`; §10 also says deprecated previews like published (self-contradiction). Fingerprint was public while version was published; integrity check kept. **Alternatives**: core skips fingerprint for deprecated (loses integrity check); defer retired versions (C8 unmet). + +## BDR-099 — V1-2.5 VERIFIED: permission states, Retry, Paris end-of-day expiry, species order 0..9999, UX deviations, MFA recovery prerequisite (2026-11-03) +- **Status**: accepted +**Decision**: owner accepted V1-2.5 final checkpoint at b4415a3 (brief « Validation V1-2.5 et autorisation V1-2.6 », 2026-11-03) → V1-2.5 VERIFIED. Decisions ratified (contract §17.11): +1. Permission states, `/app/admin/sheets/new` order: own grants `loading` → waiting status; server species read answered `rights.*` → « Accès non autorisé » (server wins over failed client read, BDR-094); own grants `failed` → « Impossible de vérifier vos autorisations » + short text + « Réessayer », never form; `ready` + active `sheet_editor` → form; `ready` without it (reviewer-only, publisher-only, owner without capability) → refused. Technical error never read as no-right. Admin home: same notice replaces « Vos habilitations » line. Lists hide grant-dependent actions on failed read, no notice. Server checks + RLS stay mandatory. +2. Retry (`reloadAccess`): status `loading`, re-reads platform roles + own grants (+ species list on creation page when it failed); ends `ready` or `failed` (grants `[]`); never wipes profile, roles, workspace already held; never rejects; `setForUser` guard drops late answers. +3. Grant expiry: stored instant = 23:59:59.999 Europe/Paris of chosen day, offset in force then (DST-aware); picker + display in Paris dates; backend unchanged (`expires_at > now()`); historical rows untouched. +4. Species order: integer 0..9 999, checked server-side in M7 (`create_species`, `update_inactive_species`); null keeps old meaning; M5 untouched. +5. Two accepted UX deviations, boards unchanged: selection in zone panel not tag over drawing (aria-live region mounted before pick, names zone); « Références » card not collapsible on phone (starts at/below drawing bottom, measured 320 + 375 px). +6. MFA lost-authenticator: no safe rehearsed recovery path exists (IDENTITY §4.2) → production prerequisite (contract §13). No bypass, no aal2 weakening, no factor-reset path. +7. Reserve: unavailable-permissions e2e runs desktop only (skipped chromium-375; admin pages at 375 covered by other specs); sandbox suites share stack state, two state-dependent tests fixed (0499a39, f5456f3), others may surface → fresh stack per gate run. +**Rationale**: owner brief §1-§5 at V1-2.5 checkpoint (14ff890) + final acceptance (b4415a3); fail-closed UI without false refusal; Paris = initial French scope. +**Alternatives**: show form on failed read (rejected, owner); deduce no-right from error (rejected); UTC midnight expiry (cuts chosen day short); collapsible Références (rejected, no redesign); add MFA recovery bypass now (rejected, weakens aal2). diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 8e9c7b08..5a827ed1 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -514,3 +514,4 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp ## 2026-11-03 - 2026-11-03 V1-2.5 owner checkpoint corrections (f5456f3): three permission states (creation page order loading, server refusal, failed read, editor rule; admin home notice; reloadAccess keeps held roles), Paris end-of-day expiry, species order 0..9999 in M7, labels, TOTP reuse measured (code accepted by several sessions in step N and N+1, refused N+2), lost-factor review = production prerequisite. 2 state-dependent sandbox tests fixed. Gates green on fresh stack, security PASS, verifier CONFORME. V1-2.5 VERIFIED. No DEV, no merge. +- 2026-11-03 owner accepted V1-2.5 final checkpoint b4415a3 (V1-2.5 VERIFIED): BDR-099 decisions, LRN-113 TOTP reuse/Storage 409/sandbox order. V1-2.6 editor level 1 authorised (brief « Validation V1-2.5 et autorisation V1-2.6 »). diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 891f4e4a..1a5bf600 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -777,3 +777,11 @@ Supersedes [[LRN-102]]. **Context**: V1-2.5 sandbox proofs on GoTrue v2.197.0 (mfa-behaviour.sandbox.ts, IDENTITY.md §4.1). **Pattern**: once a TOTP factor verified: password change and recovery-link reset refused at aal1 (401 insufficient_aal) → reset/change UI must step up first; email change same. Removing verified factor downgrades only sessions last verified with that factor; their access token keeps aal2 claim until expiry (has_mfa true, has_aal2_session false). supabase-js `mfa.listFactors().totp` hides unverified factors → read `all`. **Apply**: never assume aal from claim alone for sensitive RPCs (session row check); any password/email flow on MFA accounts needs a step-up path; factor lists show unverified ones. + +## LRN-113 — GoTrue v2.197 TOTP reuse observed; Storage 400 with statusCode 409; fresh sandbox, order test-db, e2e:shell, test (2026-11-03) +**Context**: V1-2.5 checkpoint gates (2026-11-02/03) on sandbox `pnpm db:sandbox` (GoTrue v2.197.0 image defaults, Storage API of the pinned Supabase images). +**Pattern**: +1. TOTP reuse, OBSERVED on sandbox only (IDENTITY §4.1 case 11), no general guarantee: GoTrue keeps no used-code record. Code C of step N accepted by session A, by second aal1 session B, by A again; session D in step N+1 accepted (one step skew); session E in N+2 refused 422 `mfa_verification_failed`. Span 30-60 s, replayable by any session holding password within it. CLI/DEV config sets no replay option, same behaviour expected but unmeasured; other GoTrue versions/configs unverified. +2. Storage duplicate upload: answers HTTP 400 with body `statusCode: "409"` (KeyAlreadyExists), not HTTP 409. Delete of missing object likewise HTTP 400 + `statusCode` 404. Test/client must read body `statusCode`; any other 400 still fails. +3. Sandbox suites share one stack: e2e:shell seeds content-addressed drawings + working copies that later `test` cases meet (duplicate upload, `working_copy.exists`), so a case green only from 2nd run or only after another suite hides defects. Gate run = fresh stack (`db:sandbox down` + `up fresh`), order `test-db → e2e:shell → test`, each case robust to state the earlier suites leave; never re-run until green. +**Apply**: never cite TOTP span as a guarantee (measured fact + version); Storage error handling reads body `statusCode`; V1-2.6+ gates start from fresh sandbox in that order, report state-dependent failures instead of masking them.