diff --git a/.claude/audits/2026-10-28-v1-2-1-corrections-evidence.md b/.claude/audits/2026-10-28-v1-2-1-corrections-evidence.md index 5beb4e89..1cf0c2b6 100644 --- a/.claude/audits/2026-10-28-v1-2-1-corrections-evidence.md +++ b/.claude/audits/2026-10-28-v1-2-1-corrections-evidence.md @@ -53,7 +53,7 @@ files of this pass: |---|---|---| | 006 | 2 not ok: another editor uploads a pending key it did not register (L5) | 16/16 | | 016 | 1 not ok: a draft from a deprecated version takes it as base (M2) | 50/50 | -| 017 | M1 approval on an archived sheet succeeds; M2 base from a deprecated version; the file aborts there | 85/85 (110/110 after the final decisions pass, §4) | +| 017 | M1 approval on an archived sheet succeeds; M2 base from a deprecated version; the file aborts there | 85/85 (111/111 after the final decisions pass, §4) | | 018 | 93 not ok of 337: capability holders at aal1 get `rights.capability` instead of `rights.mfa` (§6.7); `delete_sheet_asset` answers a raw code | 337/337 | | 019 | 38/38 (lost coverage of behaviour that was already correct) | 38/38 | | sheets-concurrency | 5 failed of 15: publish against withdraw (no version lock), two deprecations (no sheet lock), archive against approve (no sheet lock) | 15/15 | @@ -97,8 +97,10 @@ New in this pass: non-owner class at aal2 (`rights.owner`) and at aal1 (`rights.mfa`). Number walk, linear (security gate on `7c4bf12`: `jsonb_path_query` row by row is quadratic on -PostgreSQL 17, 0.15 / 0.53 / 2.17 s for 50k / 100k / 200k numbers on the real image; replaced by -one `jsonb_path_query_array` call: 65 / 128 / 262 / 414 ms for 100k / 200k / 400k / 600k). Over +PostgreSQL 17). Raw psql timings on the sandbox, committed as +`2026-10-28-v1-2-1-number-walk.out` (rolled back): row by row 138 / 506 / 2 172 ms for 50k / +100k / 200k numbers; the shipped walk (one `jsonb_path_query_array` call) 69 / 135 / 267 / 421 ms +for 100k / 200k / 400k / 600k. Over HTTP on both stacks, each run: 600 000 numbers (1 801 760 bytes of text) saved in 677-695 ms; 1 000 000 numbers answered `document.too_large` in 1 019-1 078 ms (budget 2 000 ms). diff --git a/.claude/audits/2026-10-28-v1-2-1-number-walk.out b/.claude/audits/2026-10-28-v1-2-1-number-walk.out new file mode 100644 index 00000000..e81d190a --- /dev/null +++ b/.claude/audits/2026-10-28-v1-2-1-number-walk.out @@ -0,0 +1,54 @@ +1f9fa8b +Time: 0.086 ms +Time: 1.163 ms +Time: 603.977 ms +per_row 50000 + per_row +--------- + 50692 +(1 row) + +Time: 137.844 ms +per_row 100000 + per_row +--------- + 100692 +(1 row) + +Time: 506.026 ms +per_row 200000 + per_row +--------- + 200692 +(1 row) + +Time: 2172.483 ms (00:02.172) +shipped 100000 + check_document_structure +-------------------------- + +(1 row) + +Time: 68.834 ms +shipped 200000 + check_document_structure +-------------------------- + +(1 row) + +Time: 134.571 ms +shipped 400000 + check_document_structure +-------------------------- + +(1 row) + +Time: 267.344 ms +shipped 600000 + check_document_structure +-------------------------- + +(1 row) + +Time: 421.337 ms +Time: 0.498 ms diff --git a/docs/development/V1-2_ANATOMICAL_SHEETS.md b/docs/development/V1-2_ANATOMICAL_SHEETS.md index 5c375ae3..fd688005 100644 --- a/docs/development/V1-2_ANATOMICAL_SHEETS.md +++ b/docs/development/V1-2_ANATOMICAL_SHEETS.md @@ -1366,7 +1366,10 @@ A drawing never blocks authoring: only the round waits for its verdict. object's integrity undemonstrated (§12.3, §17.3). - `pnpm assets:upload` stays the seed tool of local and sandbox stacks. With the service role's table privileges revoked (F12), the same step gives the - tool a narrow read RPC for its planning and reruns `pnpm e2e:sheet-assets`. + tool a narrow read RPC for its planning. `pnpm e2e:sheet-assets` targets the + local DEV stack only, so V1-2.1 did not run it (sandbox-only rule); the + tool's switch to that RPC is covered by its stub-server tests and pgTAP 006, + and the rerun is an owner step of §16.11. - Objects are never deleted by the worker: its purge guard refuses any purge whose bucket is `anatomical-sheet-assets`, and no trigger enqueues a sheet object. @@ -1578,7 +1581,7 @@ of the document's JSON text in one form, the same for every layer: | Id | Step | Content | Data on DEV | |---|---|---|---| | 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 | new columns take their defaults on the equine v1 row (`revision` 0, empty author set); its document, status, number and assets unchanged; bucket limit lowered; no round, no grant | +| 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 is about 296 KB of text); 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 | none | Each migration ships its pgTAP file (allowed and denied cases), regenerated @@ -2179,6 +2182,8 @@ Each is an owner action, never run by Claude, after its own checkpoint: 6. any submission, approval, publication, deprecation or archive; 7. any factor reset (§5.6, §5.7.7) and any `object_conflict` deletion (§9.3); 8. rerunning the equine seed. +9. rerunning `pnpm e2e:sheet-assets` against DEV once M4 to M6 are applied + (§9.5). ### 16.12 Deferred (not V1-2)