feat(supabase): add draft_last_save to the sheet admin read (M8, sandbox only)

This commit is contained in:
bchanot committed 2026-11-04 11:40:22 +01:00
1 parent 2571978780
commit 2f824a947c
7 files changed
+269 -2

No files matched your search

+3 -1
View File
@@ -1760,6 +1760,7 @@ of the document's JSON text in one form, the same for every layer:
| 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 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 |
| M8 `sheet_draft_last_save` | V1-2.6 | read migration (owner decision 2026-11-03, sandbox only): `get_official_sheet_admin` redefined to answer `draft_last_save` = `{revision, saved_at, saved_by}` (the account that saved the draft's current revision, from the newest `anatomical_sheet_version.saved` audit row of that revision), null when no save wrote it; the list and the summary helper untouched; no write path, no new grant, no policy change, privileges restated as M7; 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
@@ -2315,7 +2316,8 @@ V1-2.7 on.
- Dependencies: V1-2.1, V1-2.2, V1-2.4, V1-2.5 (not V1-2.3).
- Security prerequisites: stored bytes never inserted into the page; only
core-composed trees rendered.
- Application changes: the draft editor. SQL changes: none.
- Application changes: the draft editor. SQL changes: M8 `sheet_draft_last_save`, a read
migration for the conflict dialog (§12.3, owner decision 2026-11-03; was « none »).
- Tests: `e2e:shell` A2, A3, A4 with a conflict and a local recovery;
keyboard path through numeric fields; axe; read-only below 1 024 px.
- Acceptance: a sheet for a species other than the horse, with a drawing