From 532c61e08703d5b077396fc9bc3fb6f1f6ddd6b2 Mon Sep 17 00:00:00 2001 From: bchanot Date: Wed, 28 Oct 2026 21:15:08 +0100 Subject: [PATCH] docs(docs): V1-2.1 measured equine size, e2e:sheet-assets citers, logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The M5 row gives the measured content::text size; §15 and §16.4 point the e2e:sheet-assets rerun to the owner; the walk log carries its script and the HTTP timing lines are committed. --- .../2026-10-28-v1-2-1-corrections-evidence.md | 4 +-- .../audits/2026-10-28-v1-2-1-number-walk.out | 28 +++++++++++++++++++ .../2026-10-28-v1-2-1-sandbox-timings.out | 17 +++++++++++ docs/development/V1-2_ANATOMICAL_SHEETS.md | 9 +++--- 4 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 .claude/audits/2026-10-28-v1-2-1-sandbox-timings.out 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 1cf0c2b6..2d1db096 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 @@ -98,10 +98,10 @@ New in this pass: Number walk, linear (security gate on `7c4bf12`: `jsonb_path_query` row by row is quadratic on 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 / +`2026-10-28-v1-2-1-number-walk.out` (one transaction ending in `rollback`; script in its header line below): 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; +HTTP on both stacks, each run (lines extracted in `2026-10-28-v1-2-1-sandbox-timings.out`): 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). Number bomb on the real image (sandbox, re-run on `2379d28`): the shipped function answers 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 index e81d190a..2167b69b 100644 --- a/.claude/audits/2026-10-28-v1-2-1-number-walk.out +++ b/.claude/audits/2026-10-28-v1-2-1-number-walk.out @@ -1,4 +1,32 @@ 1f9fa8b +-- script: +-- -- Number walk timings on the sandbox (rolled back). shipped = private.check_document_structure as committed; +-- -- per_row = the same sum over jsonb_path_query row by row (the 3eba6d8 form). +-- \timing on +-- begin; +-- create function pg_temp.per_row(p jsonb) returns bigint language plpgsql as $f$ +-- declare v jsonb; t bigint := 0; +-- begin +-- for v in select jsonb_path_query(p, 'strict $.** ? (@.type() == "number")') loop t := t + octet_length(v::text); end loop; +-- return t; +-- end $f$; +-- create temp table d as select n, (select content from public.anatomical_sheet_versions order by version_number limit 1) +-- || jsonb_build_object('pad', (select jsonb_agg(0) from generate_series(1, n))) as doc from unnest(array[50000,100000,200000,400000,600000]) n; +-- \echo per_row 50000 +-- select pg_temp.per_row(doc) from d where n = 50000; +-- \echo per_row 100000 +-- select pg_temp.per_row(doc) from d where n = 100000; +-- \echo per_row 200000 +-- select pg_temp.per_row(doc) from d where n = 200000; +-- \echo shipped 100000 +-- select private.check_document_structure(doc) from d where n = 100000; +-- \echo shipped 200000 +-- select private.check_document_structure(doc) from d where n = 200000; +-- \echo shipped 400000 +-- select private.check_document_structure(doc) from d where n = 400000; +-- \echo shipped 600000 +-- select private.check_document_structure(doc) from d where n = 600000; +-- rollback; Time: 0.086 ms Time: 1.163 ms Time: 603.977 ms diff --git a/.claude/audits/2026-10-28-v1-2-1-sandbox-timings.out b/.claude/audits/2026-10-28-v1-2-1-sandbox-timings.out new file mode 100644 index 00000000..2bf3c46c --- /dev/null +++ b/.claude/audits/2026-10-28-v1-2-1-sandbox-timings.out @@ -0,0 +1,17 @@ +# Sandbox suite timing lines at 2379d28 (pnpm db:sandbox test, four runs), extracted from the run logs +== fresh/sandbox-run1.log +AT-CAPS TIMING {"document":{"textBytes":2076707,"jsonbBytes":2346648,"cap":2097152,"labelLength":29,"views":64,"annotations":1024,"findingNodes":8192,"depth":8,"groups":1089,"drawings":4,"drawingBytes":2000000},"budgetMs":2000,"save":{"n":7,"min":127,"median":137,"max":155},"submit":{"n":5,"min":4,"median":5,"max":6},"approve":{"n":3,"min":190,"median":285,"max":292},"publish":{"n":3,"min":195,"median":288,"max":303}} +NUMBER WALK {"within":{"numbers":600000,"textBytes":1801760,"ms":683},"over":{"numbers":1000000,"status":400,"ms":1026}} + Tests 87 passed (87) +== fresh/sandbox-run2.log +AT-CAPS TIMING {"document":{"textBytes":2076707,"jsonbBytes":2346648,"cap":2097152,"labelLength":29,"views":64,"annotations":1024,"findingNodes":8192,"depth":8,"groups":1089,"drawings":4,"drawingBytes":2000000},"budgetMs":2000,"save":{"n":7,"min":130,"median":142,"max":155},"submit":{"n":5,"min":4,"median":7,"max":13},"approve":{"n":3,"min":196,"median":284,"max":297},"publish":{"n":3,"min":205,"median":302,"max":306}} +NUMBER WALK {"within":{"numbers":600000,"textBytes":1801760,"ms":681},"over":{"numbers":1000000,"status":400,"ms":1062}} + Tests 87 passed (87) +== m7/logs/sandbox-run1.log +AT-CAPS TIMING {"document":{"textBytes":2076707,"jsonbBytes":2346648,"cap":2097152,"labelLength":29,"views":64,"annotations":1024,"findingNodes":8192,"depth":8,"groups":1089,"drawings":4,"drawingBytes":2000000},"budgetMs":2000,"save":{"n":7,"min":135,"median":139,"max":148},"submit":{"n":5,"min":5,"median":6,"max":6},"approve":{"n":3,"min":192,"median":282,"max":294},"publish":{"n":3,"min":196,"median":292,"max":296}} +NUMBER WALK {"within":{"numbers":600000,"textBytes":1801760,"ms":695},"over":{"numbers":1000000,"status":400,"ms":1019}} + Tests 87 passed (87) +== m7/logs/sandbox-run2.log +AT-CAPS TIMING {"document":{"textBytes":2076707,"jsonbBytes":2346648,"cap":2097152,"labelLength":29,"views":64,"annotations":1024,"findingNodes":8192,"depth":8,"groups":1089,"drawings":4,"drawingBytes":2000000},"budgetMs":2000,"save":{"n":7,"min":127,"median":137,"max":151},"submit":{"n":5,"min":5,"median":5,"max":7},"approve":{"n":3,"min":199,"median":286,"max":295},"publish":{"n":3,"min":220,"median":292,"max":299}} +NUMBER WALK {"within":{"numbers":600000,"textBytes":1801760,"ms":677},"over":{"numbers":1000000,"status":400,"ms":1078}} + Tests 87 passed (87) diff --git a/docs/development/V1-2_ANATOMICAL_SHEETS.md b/docs/development/V1-2_ANATOMICAL_SHEETS.md index fd688005..1121ab88 100644 --- a/docs/development/V1-2_ANATOMICAL_SHEETS.md +++ b/docs/development/V1-2_ANATOMICAL_SHEETS.md @@ -1581,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; 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 | +| 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 | none | Each migration ships its pgTAP file (allowed and denied cases), regenerated @@ -1898,7 +1898,8 @@ The final approval needs all 30 groups acknowledged, no `to_confirm` and no hostile SVG corpus in the sandboxed child, per-command limits and watchdog, the purge guard by bucket, sandbox tests and seccomp derivation, an e2e on the sandbox stack with the verification worker running; `pnpm e2e:avatar` - and `pnpm e2e:sheet-assets` unchanged in outcome. + unchanged in outcome; `pnpm e2e:sheet-assets` targets DEV only, its rerun + is an owner step (§16.11). - Release replay: a script loads every published version and drawing of a stack through the new core and fails on any regression. - Application: failure codes to FR and EN messages, editor state (undo, @@ -2031,7 +2032,7 @@ V1-2.7 on. - SQL changes: M6 (§12.3). - Tests: `pnpm worker:test`, hostile corpus, e2e on the sandbox, each failure of §6.5, upgrade rehearsal with a copy of the DEV object; `pnpm e2e:avatar` - and `pnpm e2e:sheet-assets` unchanged. + unchanged; `pnpm e2e:sheet-assets` rerun by the owner on DEV (§16.11). - Acceptance: verdict accepted on a clean sheet; each failure produced and its exit working; a stale or malformed completion writes nothing; avatars and purges unaffected; publication refused without a current passed verdict; @@ -2181,7 +2182,7 @@ Each is an owner action, never run by Claude, after its own checkpoint: 5. creating the equine working copy and applying the O18 corrections; 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. +8. rerunning the equine seed; 9. rerunning `pnpm e2e:sheet-assets` against DEV once M4 to M6 are applied (§9.5).