fix(supabase): V1-2.1 owner self-review grant and the text size measure

M6 option A: grant_catalog_right no longer refuses an owner granting
itself sheet_reviewer; authors stay refused at acknowledgment, approval
and publication. The document cap is the UTF-8 bytes of the JSON text:
check_document_structure drops pg_column_size and M5 replaces the base
table CHECK by octet_length(content::text). pgTAP 015 and 017 cover the
owner-reviewer journey and cap - 1, cap, cap + 1, multi-byte, dense.
This commit is contained in:
bchanot committed 2026-10-28 19:32:57 +01:00
1 parent 2af61e72cc
commit b1de87b5d0
6 files changed
+131 -34

No files matched your search

@@ -456,12 +456,9 @@ begin
or grant_catalog_right.expires_at <= now() then
raise exception 'invalid_input' using errcode = 'P0001';
end if;
-- An owner may hold the editor and publisher capabilities it needs (journey
-- A0) but never reviews on its own grant: a reviewer is habilitated by
-- another owner, so the separation of duties keeps two people.
if grant_catalog_right.user_id = v_actor and grant_catalog_right.kind = 'sheet_reviewer' then
raise exception 'grant.self_review' using errcode = 'P0001';
end if;
-- An owner may grant itself any capability, `sheet_reviewer` included (M6,
-- owner decision 2026-10-28): the separation of duties is a per-round rule,
-- so no author of a round acknowledges, approves or counts at publication.
-- Serialises the grants of one account: one active row per kind.
perform 1 from public.profiles p where p.id = grant_catalog_right.user_id for no key update;