chore(memory): V1-2.1 final decisions evidence, BDR-085, TODO, journal

This commit is contained in:
bchanot committed 2026-10-28 19:41:17 +01:00
1 parent 7eca44167b
commit 12816671e4
4 files changed
+60 -20

No files matched your search

@@ -56,40 +56,65 @@ files of this pass:
## 4. Real-stack results on the corrected HEAD ## 4. Real-stack results on the corrected HEAD
| Run | Fresh stack | Upgraded stack (M3 + drawing object, then M4+M5) | Final decisions pass (owner brief « V1-2.1 : décisions finales du propriétaire »), code at
`7eca441` (M6 option A, text size measure, pgTAP 015/017). Earlier figures (1 333 pgTAP) were
the `2af61e7` state.
| Run | Fresh stack | Upgraded stack (M3 + Git fixture, then M4+M5) |
|---|---|---| |---|---|---|
| pgTAP (`test-db`) | 1 333/1 333 | 1 333/1 333 | | pgTAP (`test-db`) | 1 352/1 352 | 1 352/1 352 |
| sandbox suite, run 1 | 86/86 | 86/86 | | sandbox suite, run 1 | 86/86 | 86/86 |
| sandbox suite, run 2 (same stack) | 86/86 | 86/86 | | sandbox suite, run 2 (same stack) | 86/86 | 86/86 |
| pgTAP again after both suite runs | 1 333/1 333 | 1 333/1 333 | | of which two-session concurrency (`sheets-concurrency`) | 16/16 each run | 16/16 each run |
| `types --check` | | types match | | pgTAP again after both suite runs | 1 352/1 352 | 1 352/1 352 |
| `types --check` | types match | types match |
PGlite: 127/127 (packages/supabase: the 17 pgTAP files and the closed-code census). PGlite: 127/127 (packages/supabase: the 17 pgTAP files and the closed-code census).
New in 017: M6 (owner self-grants `sheet_reviewer`; owner-reviewer acknowledges and approves a
version written by E, E publishes; owner refused on a round it authored, `review.separation`;
publication after an author's approval refused, `publish.approval.invalid`) and the document
size (cap − 1 and cap saved and measured, cap + 1 refused, a 2 MiB document of 3-byte
characters saved, cap + 1 in 4-byte characters refused, a dense document within the cap as text
and over it as binary jsonb saved whole, creation over the cap refused, the table CHECK
definition). Every refusal answers `document.too_large` (23514), never a raw constraint error.
## 5. Timing at the caps (§15, budget 2 000 ms for save, submit, publish) ## 5. Timing at the caps (§15, budget 2 000 ms for save, submit, publish)
Synthetic document: 64 views, 1 024 annotations, 8 192 finding nodes (depth 8), 1 089 review Synthetic document: 64 views, 1 024 annotations, 8 192 finding nodes (depth 8), 1 089 review
groups, 4 drawings of 2 000 000 bytes; text 1 807 583 bytes, stored jsonb 2 057 488 bytes groups, 4 drawings of 2 000 000 bytes. Since the size measure follows the contract, the labels are
(the binding measure, cap 2 097 152). HTTP wall-clock through PostgREST on the development calibrated on the text alone: text 2 076 707 bytes (cap 2 097 152), binary jsonb 2 346 648 bytes,
machine, milliseconds (min / median / max): over the cap and accepted, as the contract's measure requires. HTTP wall-clock through PostgREST
on the development machine, milliseconds (min / median / max):
| Stack, run | save (7) | submit (5) | approve (3) | publish (3) | | Stack, run | save (7) | submit (5) | approve (3) | publish (3) |
|---|---|---|---|---| |---|---|---|---|---|
| fresh, 1 | 97 / 102 / 111 | 3 / 4 / 4 | 278 / 283 / 286 | 272 / 285 / 288 | | fresh, 1 | 118 / 123 / 137 | 4 / 6 / 7 | 189 / 284 / 303 | 198 / 289 / 300 |
| fresh, 2 | 95 / 110 / 119 | 5 / 6 / 6 | 200 / 283 / 297 | 192 / 274 / 287 | | fresh, 2 | 114 / 125 / 139 | 5 / 6 / 6 | 196 / 281 / 292 | 210 / 297 / 307 |
| upgraded, 1 | 107 / 144 / 374 | 6 / 9 / 17 | 197 / 303 / 304 | 209 / 294 / 330 | | upgraded, 1 | 123 / 128 / 131 | 5 / 6 / 10 | 286 / 292 / 302 | 208 / 291 / 299 |
| upgraded, 2 | 98 / 108 / 114 | 4 / 6 / 7 | 198 / 282 / 286 | 193 / 281 / 290 | | upgraded, 2 | 118 / 123 / 129 | 4 / 6 / 7 | 198 / 285 / 295 | 211 / 292 / 310 |
The core's at-caps fixture is V1-2.2 work; the contract fixes the budgets at the V1-2.3 The core's at-caps fixture is V1-2.2 work; the contract fixes the budgets at the V1-2.3
checkpoint and measures verification (120 s) there. checkpoint and measures verification (120 s) there.
## 6. M7: upgrade rehearsal with the drawing object ## 6. M7: upgrade rehearsal with a Git fixture of the drawing object
DEV path: `up upgrade 20261028100000` from a copy whose migrations stop at M3, the historical Accepted by the owner for V1-2.1 (brief « V1-2.1 : décisions finales du propriétaire »,
drawing placed as the operator tool placed it on DEV (the Git file 2026-10-28; contract §12.3, §17.3). What this rehearsal is, and is not:
`supabase/seed/anatomical-sheets/equine/draft/assets/horse.svg`, 132 997 bytes, sha256
`0ea5202f…08541` = the seeded row's; service-key upload, pre-M4 confirmation RPC), then M4+M5 by - It uses a representative Git fixture, not a copy of the DEV object: the committed file
`supabase migration up`. `supabase/seed/anatomical-sheets/equine/draft/assets/horse.svg` (132 997 bytes), whose sha256
`0ea5202f…08541` equals the sha256 referenced by the DEV metadata (the asset row
`7f767f74…` of the historical sheet, seeded from `equine_draft.sql`).
- Its bytes, its Storage metadata and its relations (asset row, historical sheet, version) are
compared before and after the migration.
- No file was read from the real Storage of DEV, and nothing on DEV was read or written in
V1-2.1. The current integrity of the live DEV object is therefore **not demonstrated**; it is
checked when the owner applies M4 to M6 on DEV (contract §16.11).
DEV path: `up upgrade 20261028100000` from a copy whose migrations stop at M3, the fixture
placed as the operator tool placed the drawing on DEV (service-key upload, pre-M4 confirmation
RPC), then M4+M5 by `supabase migration up`.
- `storage.objects` row (id, owner, metadata, version, timestamps), the asset row, the - `storage.objects` row (id, owner, metadata, version, timestamps), the asset row, the
historical sheet row and its version (content md5, updated_at): identical before and after. historical sheet row and its version (content md5, updated_at): identical before and after.
@@ -100,7 +125,8 @@ drawing placed as the operator tool placed it on DEV (the Git file
bytes (sha256 equal to the key); the same editor at aal1, a catalogue reader and an anonymous bytes (sha256 equal to the key); the same editor at aal1, a catalogue reader and an anonymous
caller are refused (the historical sheet has no published version). caller are refused (the historical sheet has no published version).
The rehearsal is reproducible from the repository, re-run at the final HEAD with the same The rehearsal is reproducible from the repository, re-run on `7eca441` (final decisions pass)
results: `bash .claude/audits/2026-10-28-v1-2-1-m7/m7-rehearsal.sh [work dir]` (sandbox only; it applies with the same results, the only diff lines being the bucket limit and the service_role
privileges: `bash .claude/audits/2026-10-28-v1-2-1-m7/m7-rehearsal.sh [work dir]` (sandbox only; it applies
M4+M5 with `supabase migration up --db-url` on the sandbox port, a step `scripts/db-sandbox.sh` M4+M5 with `supabase migration up --db-url` on the sandbox port, a step `scripts/db-sandbox.sh`
has no subcommand for) and `m7-read.mjs` (the reads with real tokens). has no subcommand for) and `m7-read.mjs` (the reads with real tokens).
+7
View File
@@ -626,3 +626,10 @@ Key design choices:
- O22 mirror removed: dropped `sheet_document_issues` + the 4 business-mirror helpers; kept `sheet_document_has_shape`, `check_sheet_version_document`, `unknown_assets`; added the declared status check `sheet_all_reviewed` (absent review_status = inherited = refused). pgTAP 011 + the SQL-mirror parts of the Rust `sheet_conformance` generator deleted; ledger retargeted. - O22 mirror removed: dropped `sheet_document_issues` + the 4 business-mirror helpers; kept `sheet_document_has_shape`, `check_sheet_version_document`, `unknown_assets`; added the declared status check `sheet_all_reviewed` (absent review_status = inherited = refused). pgTAP 011 + the SQL-mirror parts of the Rust `sheet_conformance` generator deleted; ledger retargeted.
- Publish gate: `publish_sheet_version(review_id)` atomic; `guard_sheet_version_update` lets draft->published only with an approved round of same version+revision + passed verdict (no direct UPDATE publishes, even table owner). Verdict is a fixture until M6 (V1-2.3). - Publish gate: `publish_sheet_version(review_id)` atomic; `guard_sheet_version_update` lets draft->published only with an approved round of same version+revision + passed verdict (no direct UPDATE publishes, even table owner). Verdict is a fixture until M6 (V1-2.3).
- Reader column grants narrowed; editor needs only `revision` on versions; authors/provenance/fingerprint reach staff via RPCs (`get_sheet_version`). - Reader column grants narrowed; editor needs only `revision` on versions; authors/provenance/fingerprint reach staff via RPCs (`get_sheet_version`).
## BDR-085 — V1-2.1 owner final decisions: M6 self-review grant, M7 Git fixture, text size measure (2026-10-28)
- **Status**: implemented + tested on sandbox; DEV untouched
Owner brief « V1-2.1 : décisions finales du propriétaire » on checkpoint 2af61e7. Three decisions, M4/M5 edited in place (never on DEV).
- M6 option A: `grant.self_review` dropped from `grant_catalog_right` + `SHEET_FAILURE_KINDS`. Owner at aal2 + verified factor may self-grant `sheet_reviewer`. Separation stays per round: author refused at ack + approve (`review.separation`), author approval refused again at publish (`publish.approval.invalid`). pgTAP 015 flipped, 017 owner-reviewer block (7 cases). Residual: owner reviewing others' drafts is now a normal path, audited like any grant.
- M7: Git fixture accepted for V1-2.1 upgrade rehearsal (horse.svg, sha256 = DEV asset row). Bytes/metadata/relations compared before/after. No DEV Storage read -> live DEV object integrity NOT shown; checked when owner applies M4-M6 on DEV. Contract §12.3, §16.2, §17.3.
- Size: one measure = UTF-8 bytes of jsonb text form `octet_length(content::text)` (`": "`, `", "` separators, jsonb key order, numeric without exponent). Base table CHECK `pg_column_size` (binary jsonb, uncompressed at write, bigger than text for dense docs) replaced in M5 by the text measure; `check_document_structure` drops pg_column_size. TS/Rust: no check today; core must compute same form in V1-2.2 (compact JSON.stringify shorter -> necessary not sufficient). Alternative rejected: compact JSON measure (SQL cannot compute it exactly: numeric prints no exponent).
+1
View File
@@ -477,3 +477,4 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp
- V1-2.1 M4/M5 built+tested on sandbox (DEV untouched): M4 20261028100000 sheet_access_hardening (rights table + RPCs, has_mfa/has_aal2_session, catalogue reader predicate, can_edit_sheet on capability, AR-1 B role RPCs + F17/F18/F19, F1-F16), M5 20261028110000 sheet_review_workflow (version/sheet cols, freeze/revision/author triggers, rounds/comments/acks, lifecycle+review+publish RPCs, species, working copy, uploads+INSERT policy, mirror removed + status check). Defects F1-F19 reproduced on old schema; pgTAP 001/003/004/005/006/007/010/015/016 green (850 real-stack, 122 PGlite); sandbox real-GoTrue AR-1 B + F18 race green; fresh install + M3->M5 upgrade green; sheets.ts closed kinds, client gate deleted, types regen no drift; rust:check + typecheck + lint + build green. 011 + SQL-mirror generator deleted, ledger retargeted. BDR + LRN-095. check:all Docker image/worker stages not re-run (no app/worker/Dockerfile change). STOP at checkpoint. - V1-2.1 M4/M5 built+tested on sandbox (DEV untouched): M4 20261028100000 sheet_access_hardening (rights table + RPCs, has_mfa/has_aal2_session, catalogue reader predicate, can_edit_sheet on capability, AR-1 B role RPCs + F17/F18/F19, F1-F16), M5 20261028110000 sheet_review_workflow (version/sheet cols, freeze/revision/author triggers, rounds/comments/acks, lifecycle+review+publish RPCs, species, working copy, uploads+INSERT policy, mirror removed + status check). Defects F1-F19 reproduced on old schema; pgTAP 001/003/004/005/006/007/010/015/016 green (850 real-stack, 122 PGlite); sandbox real-GoTrue AR-1 B + F18 race green; fresh install + M3->M5 upgrade green; sheets.ts closed kinds, client gate deleted, types regen no drift; rust:check + typecheck + lint + build green. 011 + SQL-mirror generator deleted, ledger retargeted. BDR + LRN-095. check:all Docker image/worker stages not re-run (no app/worker/Dockerfile change). STOP at checkpoint.
- V1-2.1 fresh security+verifier gates run on commit 77e5fa4: security PASS (no blocker; lease-token whole-row grant narrowed to omit attempts/lease_token/locked_at). Verifier ECARTS(10) → fixed the real gaps: publish re-checks the approver's reviewer grant (publish.approval.invalid), scope disclaimer enforced at approve+publish (publish.disclaimer.missing, O6), to_confirm split from inherited (publish.to_confirm.open), save requires an active sheet, delete_sheet_asset revoked from service_role, species table comment updated, working-copy 2 MiB check, lock order sheet→version→round in decide/publish, conflict_retry kind (40001/40P01) in sheets.ts. Tests added (pgTAP 016 now 50, 001 census no-other-writer): omitted review_status, separation author-reviewer, revoked-reviewer approval + renewal, ack carry, inactive-species publish refusal, deprecated-delete, schema_version 1 refused, content-write-without-actor, working-copy positive. 871 real-stack pgTAP / 122 PGlite / 4 sandbox green; typecheck+lint+types drift clean. Deferred (noted): at-caps timing (V1-2.2 doc), fuller MFA factor mgmt (V1-2.5), low residuals (existence oracle, write-budget on some admin RPCs). - V1-2.1 fresh security+verifier gates run on commit 77e5fa4: security PASS (no blocker; lease-token whole-row grant narrowed to omit attempts/lease_token/locked_at). Verifier ECARTS(10) → fixed the real gaps: publish re-checks the approver's reviewer grant (publish.approval.invalid), scope disclaimer enforced at approve+publish (publish.disclaimer.missing, O6), to_confirm split from inherited (publish.to_confirm.open), save requires an active sheet, delete_sheet_asset revoked from service_role, species table comment updated, working-copy 2 MiB check, lock order sheet→version→round in decide/publish, conflict_retry kind (40001/40P01) in sheets.ts. Tests added (pgTAP 016 now 50, 001 census no-other-writer): omitted review_status, separation author-reviewer, revoked-reviewer approval + renewal, ack carry, inactive-species publish refusal, deprecated-delete, schema_version 1 refused, content-write-without-actor, working-copy positive. 871 real-stack pgTAP / 122 PGlite / 4 sandbox green; typecheck+lint+types drift clean. Deferred (noted): at-caps timing (V1-2.2 doc), fuller MFA factor mgmt (V1-2.5), low residuals (existence oracle, write-budget on some admin RPCs).
- V1-2.1 corrections after audit (3914eaa CHANGES REQUIRED): M1 approve needs active sheet, M2 base only from published round version, LOW fixes (rights.mfa first, closed codes, budgets, view.asset.unknown at submit, upload policy = registrant, append-only acks, deprecate/working-copy locks). Found+fixed: published round withdrawable, approver-author not refused at publish. Found: jsonb pg_column_size > text size (CHECK binds before contract measure) → closed code; owner decision. pgTAP 1325 fresh+upgraded, sandbox 86/86 x2 both stacks, caps timing max 374 ms, M7 rehearsal object+metadata identical, check:all green. Commits d05f75d..4a82941 pushed. M6 + M7 criterion + size measure → owner. Fresh verifier + security gates dispatched. - V1-2.1 corrections after audit (3914eaa CHANGES REQUIRED): M1 approve needs active sheet, M2 base only from published round version, LOW fixes (rights.mfa first, closed codes, budgets, view.asset.unknown at submit, upload policy = registrant, append-only acks, deprecate/working-copy locks). Found+fixed: published round withdrawable, approver-author not refused at publish. Found: jsonb pg_column_size > text size (CHECK binds before contract measure) → closed code; owner decision. pgTAP 1325 fresh+upgraded, sandbox 86/86 x2 both stacks, caps timing max 374 ms, M7 rehearsal object+metadata identical, check:all green. Commits d05f75d..4a82941 pushed. M6 + M7 criterion + size measure → owner. Fresh verifier + security gates dispatched.
- V1-2.1 final owner decisions (2af61e7): M6 A grant.self_review dropped, size = octet_length(content::text) (table CHECK replaced in M5), M7 Git fixture wording in contract + evidence. pgTAP 1352 fresh+upgraded, sandbox 86/86 x2 both stacks (concurrency 16/16), caps text 2 076 707 / jsonb 2 346 648 accepted, PGlite 127. DEV metadata identical. BDR-085.
+7 -1
View File
@@ -555,7 +555,13 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet
- [x] G7 M7 upgrade rehearsal from the M3 state with a drawing-object fixture (Git bytes, sha256 = DEV row), bytes and metadata before/after; DEV-copy criterion → owner decision - [x] G7 M7 upgrade rehearsal from the M3 state with a drawing-object fixture (Git bytes, sha256 = DEV row), bytes and metadata before/after; DEV-copy criterion → owner decision
- [x] G8 AR-1 on the upgraded stack: seed owner with two factors works at aal2, refused at aal1; without a factor usable at aal1 except roles and rights - [x] G8 AR-1 on the upgraded stack: seed owner with two factors works at aal2, refused at aal1; without a factor usable at aal1 except roles and rights
- [x] G9 gates: pgTAP fresh + upgraded, PGlite, unit, sandbox ×2, types, check:all; fresh verifier + security audit - [x] G9 gates: pgTAP fresh + upgraded, PGlite, unit, sandbox ×2, types, check:all; fresh verifier + security audit
- [ ] M6 `grant.self_review`: divergence and proposal presented; owner decision pending, rule unchanged - [x] M6 `grant.self_review`: divergence and proposal presented; owner decision → H1
- [ ] H owner final decisions (brief « V1-2.1 : décisions finales du propriétaire », 2026-10-28, on 2af61e7): M4/M5 edited in place, sandbox only, DEV untouched; STOP at checkpoint, no V1-2.2, no merge
- [x] H1 M6 option A: drop `grant.self_review` (M4, sheets.ts kinds); keep author ≠ reviewer at ack/approve/publish, MFA, eligibility; pgTAP: owner self-grants reviewer ok, owner-reviewer approves another's draft ok, owner approving own draft refused, publish after an author's approval refused
- [x] H2 M7 Git fixture accepted: contract §12.3/§15/§16.2 + evidence say Git fixture with sha256 = DEV row, bytes/metadata/relations before/after, no DEV Storage read, live DEV object integrity not shown
- [x] H3 size measure = contract `octet_length(content::text)` (UTF-8 bytes of the jsonb text form): drop `pg_column_size` from `check_document_structure`, M5 replaces the base table CHECK by the text measure; contract defines the form for SQL, TS, Rust; pgTAP: cap − 1, cap, cap + 1, multibyte, dense (jsonb > cap, text ≤ cap) accepted; refusals `document.too_large`
- [ ] H4 gates: pgTAP fresh + upgraded, PGlite + unit, sandbox suite ×2, concurrency, fresh + M3→M5 (M7 rehearsal), types, check:all; fresh verifier + security on final HEAD; DEV metadata before/after — sandbox done on 7eca441 (pgTAP 1352 ×2 per stack, suite 86/86 ×2 per stack, types match, M7 diff = bucket + service_role only, DEV metadata identical); check:all + reviews on final HEAD pending
- [ ] H5 memory (BDR M6/size, journal), commit + push branch, final report
- [ ] V1-2.2 core verdict, preview, change list, edit primitives, SVG cleaning · V1-2.3 drawings and worker verification (M6) · V1-2.4 wireframes (editor, review, admin entry) · V1-2.5 catalogue, admin space, rights, species, MFA · V1-2.6 editor level 1 · V1-2.7 preview, review, publication UI · V1-2.8 equine working copy and review preparation · V1-2.9 FR/EN acceptance and closure (owner checkpoints V1-2.3, V1-2.4, V1-2.6, V1-2.7, V1-2.8, V1-2.9 + each DEV operation of contract §16.11) - [ ] V1-2.2 core verdict, preview, change list, edit primitives, SVG cleaning · V1-2.3 drawings and worker verification (M6) · V1-2.4 wireframes (editor, review, admin entry) · V1-2.5 catalogue, admin space, rights, species, MFA · V1-2.6 editor level 1 · V1-2.7 preview, review, publication UI · V1-2.8 equine working copy and review preparation · V1-2.9 FR/EN acceptance and closure (owner checkpoints V1-2.3, V1-2.4, V1-2.6, V1-2.7, V1-2.8, V1-2.9 + each DEV operation of contract §16.11)
## Release readiness track (owner 2026-10-25, distinct from the functional roadmap; nothing here authorises a release or exposure) ## Release readiness track (owner 2026-10-25, distinct from the functional roadmap; nothing here authorises a release or exposure)