diff --git a/.claude/tasks/contracts/2026-11-02-v1-2-5-owner-checkpoint-2041.md b/.claude/tasks/contracts/2026-11-02-v1-2-5-owner-checkpoint-2041.md index 181d9607..f1efdf54 100644 --- a/.claude/tasks/contracts/2026-11-02-v1-2-5-owner-checkpoint-2041.md +++ b/.claude/tasks/contracts/2026-11-02-v1-2-5-owner-checkpoint-2041.md @@ -122,6 +122,13 @@ Q: Creation page with failed own grants but a server `rights.*` refusal / A: del failed client read only. Q: What does Retry re-read? / A: delegated (plan challenge) — roles and own grants (and the creation page's species list when it failed); a failed Retry never wipes the profile, roles or workspace already held. +Q: The new unavailable-permissions e2e test is skipped on `chromium-375` / A: [gated 2026-11-02, mid-run, internal] +criterion 5 asks for a desktop proof; the skip follows the file's A0/A1/S1 idiom; the 375 px admin pages stay +covered by the unskipped « admin screens » and « access per right » tests. +Q: Sandbox suites share one stack's state / A: [gated 2026-11-02, mid-run, internal] two pre-existing test defects +surfaced by the gates are fixed inside this run (FILE SCOPE extended): `sheets-admin.sandbox.ts` working-copy case +(green only from the second run) and `sheets-concurrency.sandbox.ts` storage seeding (HTTP 400 duplicate after +e2e:shell seeded the same content-addressed object). Product code untouched. ## ACCEPTANCE CRITERIA @@ -147,7 +154,7 @@ list when it failed); a failed Retry never wipes the profile, roles or workspace read to the server » test is replaced; `pnpm test:run` is green on each lot. CHECK: cd /tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2 && pnpm --filter @faunosteo/app exec vitest run tests/unit/routes.admin.test.tsx tests/unit/state.authStore.test.ts tests/unit/lib.dates.test.ts tests/unit/admin.validation.test.ts tests/unit/components.SecurityPanel.test.tsx && echo UNIT-OK EXPECT: UNIT-OK - EVIDENCE: pending + EVIDENCE: MET exit=0 marker-found :: RUN v3.2.7 /tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2/apps/app ✓ tests/unit/lib… 5. `e2e:shell` (sandbox) proves on desktop: an editor at `aal2` gets the form; a reviewer-only account gets « Accès non autorisé » on `/app/admin/sheets/new`; with the own-grants request answered 500, the unavailable screen shows (no form field present), axe clean, and Retry after the request is restored shows the form. At @@ -210,6 +217,7 @@ list when it failed); a failed Retry never wipes the profile, roles or workspace - apps/app/e2e/shell/{admin.spec.ts,catalogue spec} - supabase/migrations/20261102100000_sheet_admin_reads.sql (M7), supabase/tests/{015_catalog_access,022_sheet_admin_reads}.sql - packages/supabase/tests/sandbox/mfa-behaviour.sandbox.ts +- packages/supabase/tests/sandbox/{sheets-admin,sheets-concurrency}.sandbox.ts (state-independence fixes, mid-run) - docs/development/IDENTITY.md, docs/development/V1-2_ANATOMICAL_SHEETS.md, docs/design/README.md, docs/design/v1-2-4/REVUE.md, .claude/tasks/contracts/2026-11-02-v1-2-5-admin-catalogue.md, .claude/audits/2026-11-02-v1-2-5-label-proposals.md diff --git a/docs/development/IDENTITY.md b/docs/development/IDENTITY.md index 2c2a549a..8a7a6352 100644 --- a/docs/development/IDENTITY.md +++ b/docs/development/IDENTITY.md @@ -163,8 +163,8 @@ rehearsed at V1-2.9; the paths and gaps are reviewed in §4.2. N+1 is accepted too (one step of skew); a session E verifying C in step N+2 is refused (422 `mfa_verification_failed`). Measured span of one code: its own step and the next, 30 to 60 s. Consequence: a code seen over a shoulder - or relayed by a phishing page can be replayed once by another password-holding - session within that span; it does not outlive it. Configuration that ran + or relayed by a phishing page can be replayed by any session holding the + password, more than once, within that span; it does not outlive it. Configuration that ran the measurement: the sandbox GoTrue (`scripts/db-sandbox.sh`, image `gotrue:v2.197.0`), which sets no MFA variable, so the image defaults apply. The CLI and DEV stacks are configured by `supabase/config.toml` `[auth.mfa]` diff --git a/docs/development/V1-2_ANATOMICAL_SHEETS.md b/docs/development/V1-2_ANATOMICAL_SHEETS.md index 12b5f03a..94f3561b 100644 --- a/docs/development/V1-2_ANATOMICAL_SHEETS.md +++ b/docs/development/V1-2_ANATOMICAL_SHEETS.md @@ -1756,7 +1756,7 @@ of the document's JSON text in one form, the same for every layer: | M4 `sheet_access_hardening` | V1-2.1 | `anatomical_catalog_grants` and its RPCs; `has_mfa`, `grant_active`, `caller_has`; `can_read_official_catalog` and the reader row predicate; `can_edit_sheet` redefined (F14); AR-1 B on the platform role RPCs and the private write functions (F19, §5.7), F17, F18; F1, F2, F3 (fork closed), F5, F6, F8, F9, F12 (every catalogue table), F13, F15; asset-row immutability trigger (F16); historical-sheet protection trigger (§14.2); reader column grants narrowed; personal creation and visibility changes refused | no row changes | | M5 `sheet_review_workflow` | V1-2.1 | version columns `revision`, `authors`, `source_version_id`, `published_review_id`, `document_fingerprint`; sheet column `working_copy_source_version_id`; revision, author and freeze triggers, the historical-sheet write rule; extended immutability guard (§6.8); rounds, comments, acknowledgments; `create_official_sheet`, `create_sheet_draft` adapted, `save_sheet_draft`, submit, withdraw, comment, acknowledge, decide, publish; `create_sheet_working_copy`; species RPCs; catalogue and version read RPCs; upload: `register_sheet_asset` extended, `confirm_sheet_asset_upload` with the storage check (F7), INSERT policy, bucket limit 2 MiB; mirror removal and status check (§12.2); superseded signatures dropped; the content-size CHECK replaced by the text measure (`octet_length(content::text)`, §12.2) | new columns take their defaults on the equine v1 row (`revision` 0, empty author set); its document, status, number and assets unchanged; the new size CHECK is validated against the existing rows when M5 is applied (the equine document measures 184 105 bytes as `content::text`, measured on the sandbox); bucket limit lowered; no round, no grant | | M6 `sheet_verification_jobs` | V1-2.3 | worker RPCs (claim, input, complete with the verdict structure check, fail), service role only, with the retry delay (hidden `not_before` column on the round, `private.sheet_verification_retry_delay`: owner decision 2026-11-01, replaces « without backoff ») and the retry by cause (definitive codes close at the first occurrence, `private.sheet_worker_final_codes`); written as `20261101100000_sheet_verification_jobs.sql`, pgTAP `021`, rehearsed on the sandbox from the state before M4 (M4 to M6 in one `migration up`) and from the state before M6 | none | -| M7 `sheet_admin_reads` | V1-2.5 | read RPCs of the admin space (owner decision 2026-11-02, BDR-097): the official sheet list with its badges (historical, working copy), statuses and round counts, and one sheet's overview (versions, rounds); `get_sheet_version` redefined to return the fingerprint of deprecated versions too (BDR-098); the admin reads for capability holders at `aal2` only (`caller_can_see_official_sheet`); no write path, no new grant, no policy change; the one rule change is the species sort order: `create_species` and `update_inactive_species` are redefined to refuse an order outside 0..9 999 with `invalid_input` (null keeps today's meaning, owner 2026-11-02), `security definer`, `search_path = ''` and their privileges restated; pgTAP allowed and denied cases | none | +| M7 `sheet_admin_reads` | V1-2.5 | read RPCs of the admin space (owner decision 2026-11-02, BDR-097): the official sheet list with its badges (historical, working copy), statuses and round counts, and one sheet's overview (versions, rounds); `get_sheet_version` redefined to return the fingerprint of deprecated versions too (BDR-098); the admin reads for capability holders at `aal2` only (`caller_can_see_official_sheet`); no new write path (it redefines two existing write RPCs), no new grant, no policy change; the one rule change is the species sort order: `create_species` and `update_inactive_species` are redefined to refuse an order outside 0..9 999 with `invalid_input` (null keeps today's meaning, owner 2026-11-02), `security definer`, `search_path = ''` and their privileges restated; pgTAP allowed and denied cases | none | Each migration ships its pgTAP file (allowed and denied cases), regenerated `database.types.ts`, a `db:sandbox up upgrade` run from the DEV state (with a @@ -2594,7 +2594,7 @@ VERIFIED (BDR-092), V1-2.4 approved (§17.9); V1-2.3 VERIFIED as well (BDR-093). | Item | Decision | Where | |---|---|---| -| Admin reads | the admin list needs the working-copy badge and round counts, which no table grant gives (§5.3) and no RPC returned: one read migration M7, capability holders at `aal2`, no write path | §12.3, §16.6 | +| Admin reads | the admin list needs the working-copy badge and round counts, which no table grant gives (§5.3) and no RPC returned: one read migration M7, capability holders at `aal2`, no new write path | §12.3, §16.6 | | Working copy action | « Créer une copie de travail » built in V1-2.5 (board 10), landing on the copy's overview; the editor link arrives with V1-2.6 | §11.1, §16.6 | | EN term | « Habilitation » reads « Permission » in the English interface; `capability` stays the technical term | §3 | | Deprecated fingerprint | found while building the catalogue: `PreviewSheet` checks the fingerprint of published and deprecated versions, `get_sheet_version` returned it for published only, so no withdrawn version could open; `get_sheet_version` now returns it for both (redefined in M7, BDR-098) | §10, §12.3 | diff --git a/packages/supabase/tests/sandbox/sheets-concurrency.sandbox.ts b/packages/supabase/tests/sandbox/sheets-concurrency.sandbox.ts index 5b0ca715..60fcb4aa 100644 --- a/packages/supabase/tests/sandbox/sheets-concurrency.sandbox.ts +++ b/packages/supabase/tests/sandbox/sheets-concurrency.sandbox.ts @@ -240,7 +240,10 @@ describe('two working copies of the historical sheet (§14.3)', () => { const res = await fetch(`${stack.storageUrl}/object/anatomical-sheet-assets/${row[1]}.svg`, { method: 'POST', headers: { Authorization: `Bearer ${stack.serviceKey}`, 'Content-Type': 'image/svg+xml' }, body: new Uint8Array(bytes), }) - expect([200, 409]).toContain(res.status) + // Storage reports an existing object as HTTP 400 with statusCode "409" in the body. + const body = await res.text() + const duplicate = res.status === 400 && (JSON.parse(body) as { statusCode?: string }).statusCode === '409' + expect(res.status === 200 || res.status === 409 || duplicate, `${res.status} ${body}`).toBe(true) ok(await rpc('confirm_sheet_asset_upload', { asset_id: row[0] }, stack.serviceKey)) } // A copy left active by an earlier run is set aside and put back after.