feat(suppress): polymorphic owner on template_suppressions (M1.1)

Reshape the app-only suppression marker to a group/app polymorphic owner
(mirrors 0056/0057 + the 0051/0052 config markers): nullable group_id
(CASCADE), nullable app_id, exactly-one CHECK, per-owner partial unique
indexes. Lets a [group] decline a template it inherits from a higher
ancestor for its whole subtree; consumption filters land in M1.3/M1.4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-07-01 20:00:44 +02:00
parent bfa4b48930
commit cdef97a634
2 changed files with 46 additions and 2 deletions

View File

@@ -379,10 +379,11 @@ table: secrets
table: template_suppressions
id: uuid NOT NULL default=gen_random_uuid()
app_id: uuid NOT NULL
app_id: uuid NULL
target_kind: text NOT NULL
reference: text NOT NULL
created_at: timestamp with time zone NOT NULL default=now()
group_id: uuid NULL
table: topics
app_id: uuid NOT NULL
@@ -616,8 +617,10 @@ indexes on secrets:
indexes on template_suppressions:
template_suppressions_app_idx: public.template_suppressions USING btree (app_id)
template_suppressions_app_uidx: public.template_suppressions USING btree (app_id, target_kind, reference) WHERE (app_id IS NOT NULL)
template_suppressions_group_idx: public.template_suppressions USING btree (group_id) WHERE (group_id IS NOT NULL)
template_suppressions_group_uidx: public.template_suppressions USING btree (group_id, target_kind, reference) WHERE (group_id IS NOT NULL)
template_suppressions_pkey: public.template_suppressions USING btree (id)
template_suppressions_uidx: public.template_suppressions USING btree (app_id, target_kind, reference)
indexes on topics:
topics_pkey: public.topics USING btree (app_id, name)
@@ -848,8 +851,10 @@ constraints on secrets:
[FOREIGN KEY] secrets_group_id_fkey: FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE
constraints on template_suppressions:
[CHECK] template_suppressions_owner_exactly_one: CHECK (((group_id IS NULL) <> (app_id IS NULL)))
[CHECK] template_suppressions_target_kind_check: CHECK ((target_kind = ANY (ARRAY['trigger'::text, 'route'::text])))
[FOREIGN KEY] template_suppressions_app_id_fkey: FOREIGN KEY (app_id) REFERENCES apps(id) ON DELETE CASCADE
[FOREIGN KEY] template_suppressions_group_id_fkey: FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE
[PRIMARY KEY] template_suppressions_pkey: PRIMARY KEY (id)
constraints on topics:
@@ -934,3 +939,4 @@ constraints on vars:
0057: group routes
0058: template suppressions
0059: sealed templates
0060: group suppressions