Switchbordswitchbord
v0.16.27

v0.16.27

conversation-label link rows now carry a direct workspace_id with parent-match constraints and trigger validation.

What's new


  • Tenant hardening: conversation_label_links now has a direct workspace_id derived from its parent conversation and label.
  • Parent-match enforcement: new foreign keys require the link row's workspace to match both the conversation and the label, preventing cross-workspace label links at the database boundary.
  • Future-write guard: a SECURITY DEFINER trigger derives workspace_id when omitted and rejects mismatched parent pairs or supplied workspace values.
  • Preflight evidence: BORD-732 documents the live aggregate preflight: 17,292 existing links, zero missing parents, and zero cross-workspace parent pairs before enforcement.

Why


This continues the DB hardening program's inherited/link-table slice after campaign_mm_metrics. Direct tenant keys make future RLS policies and indexes simpler and safer than relying only on parent subqueries.


Out of scope


  • No RLS policy rewrite in this slice; existing policies remain in place while the direct tenant invariant is established.
  • No changes to contact tag links yet; that larger table remains a dedicated follow-up slice.