Skip to content
MSO CloudDocumentation

ADR 0023 — Per-client taxonomy as a new stream's dimension tables

On this page
  • Status: Accepted (2026-07-31) — operator directive, after Fable review (D1–D6 all Landed; the D5 cross-org read test ships and passes as both runtime identities). Originally THE merge gate for the programme's schema work. Fable ruling F1 (2026-07-30, after a chaired 15-agent debate) makes this ADR a merge gate, not a research question: schema PRs may OPEN once this ADR is drafted and reviewed; they MERGE only once this ADR is accepted. The D5 cross-org read test ships in the same WP1 change as the tables it probes and must be green before that change merges.
  • Date: 2026-07-30
  • Context owner: Platform
  • Related: ADR 0012 (D1/D2 — provisioning bundles and the dashboard-template registry are CODE, Zod-validated), ADR 0017 (D1 sanctioned path for a new data kind; the EAV non-goal), ADR 0020 (D1 starter packs, D9 two metric planes, F6 — forbidden as a citation for this feature, see D2), ADR 0021 (confirm-gate posture: nothing load-bearing until a human confirms), ADR 0022 (companion — the audience pillar + content_intel connector family), ADR 0024 + ADR 0025 (companions — tabs/widgets and the narrative gates), CLAUDE.md §15 §16 §46 §49 §53 §65 §66 §68. The programme's evidence bundle private/mso-content-intelligence/** is operator-local (gitignored); the quotations in this ADR are the durable record.

Implementation status (declared 2026-07-30)#

This ledger is filled decision-by-decision as work lands, per the ADR 0017 convention — an ADR that claims more than the code does is how a reader concludes the opposite of the decision. First filled 2026-07-30: the WP1 schema (four catalog tables + bridge, migration 0129_content_intelligence_tables), the WP2 stream registration and the WP4 metric layer landed together in commit 9b58033f.

Decision Status Evidence that will count when it lands
D1 — catalog = a new stream's dimension tables Landed (2026-07-30) content_mention in all four registries (STREAM_NATURAL_KEYS at natural-keys.ts:103, schema at streams.ts:720-786); the four catalog tables + bridge exist with org_id+brand_id NOT NULL (tables/content-intelligence.ts); dictionary-drift checks green (connectors-core suite 371 tests)
D2 — F6 is not the licence, and is closed Landed (2026-07-30) No programme doc or code comment cites ADR 0020 F6 as a licence (grep: every hit is the prohibition itself); ADR status remains Proposed pending operator acceptance
D3 — the code/data boundary Landed (2026-07-30) CONTENT_DIMENSION_KINDS (10) + CONTENT_DIMENSION_ROLES (8) compiled unions with DB CHECKs (content-intelligence.ts:92-186); 5 MVP slugs on pillar:'audience' in METRIC_DEFINITIONS (packages/metrics/src/catalog.ts); vocabulary rows carry no slug/widget/transform columns
D4 — three hard rules, each with enforcement Landed (2026-07-30) content-taxonomy-typed.py registered in audit:all (negative-control verified); cube:generate:check NOW registered in audit:all and green (the gap this decision closed); RLS policies + rls-policy-inventory.ts coverage (WP1)
D5 — cross-org read test (the gate) Landed (2026-07-30) scripts/audit/rls-audience-catalog-crossorg.ts chained into verify:rls (package.json); 62 PASS as yng_app + yng_worker on the migrated dev DB (2026-07-30 local run), incl. a negative control proving it reddens on a real leak
D6 — compiled-module fallback documented only Landed (2026-07-30) Nothing in the tree anticipates it: no per-client TS module, no generator emitting one, no branch on a client slug (continuously re-checked by content-taxonomy-typed.py's slug-synthesis rule)

Context#

Five delivered Content Intelligence client cases were reverse-engineered file by file. Each is one row per social-listening mention inside a fixed envelope (content, context, source, date, link, sentiment, platform, mention type, id) plus a per-client LLM-enriched taxonomy: single-select stages and intents, multi-select topics, open-vocabulary entity lists (hospitals, doctors, clubs, players, watch locations), eligibility gates, confidence ladders, evidence quotes, and Sub_topic → Master_Topic hierarchies. The vocabulary is the client's own confidential research and it changes weekly — a new value can be admitted on a Monday. Under the platform's current shape that is a code change per client per week.

The platform doctrine points the other way, twice. ADR 0012 D1/D2 make provisioning bundles and the dashboard-template registry CODE, Zod-validated (0012:79-93). ADR 0020's SaaS architect ruled "Do not put the dictionary in the database. The moment a tenant can add a field at runtime you have schema-on-read, no compile-time consumer safety, and a support queue of one-off fields" (0020:65-70), and its D9 fixed two metric planes — platform metrics as a code catalog, tenant metrics as ROWS (0020:325-339). All three debate proposals reached for the same escape valve: they cited ADR 0020 F6's "declared extension namespace" as their licence — while putting per-client dimensions into METRIC_DEFINITIONS and into shared aggregates, which is exactly what F6 forbids. That argument would have failed review.

The chair's reframing, verified rather than asserted, is the one that survives: the taxonomy catalog is not an extension of an existing stream's dictionary — it is a new stream's own dimension tables, on the path ADR 0017 D1 already sanctions. Fable ruling F1 made that binding and made this ADR the merge gate, with two obligations attached: carry the tenancy/security review, and ship a cross-org read test.

Fact Evidence
Metric slugs are compiled: METRIC_DEFINITIONS is a readonly TS array literal (85 slugs today), and the header states slugs are the stable identifier that must never be renamed packages/metrics/src/catalog.ts:1-7 — "Slugs are the stable identifier — frontends, alerts, and AI prompts all reference metrics by slug. Never rename; bump version for breaking changes."
No audience pillar exists yet — the pillar enum is closed and compiled packages/metrics/src/types.ts:44 — MetricPillar = z.enum(['ecom','marketing','social','crm','market'])
The Cube generator reads only compiled registries; it has no runtime database client at all scripts/cube/generate-schema.ts:14-21 imports node:fs/node:path/node:url, METRIC_DEFINITIONS (+ its type), CUBE_SELECT_COLUMNS (from @yng/schema/runtime-acl, whose own postgres import is type-only — erased at build), prettier — nothing else; :11-12 "Source of truth: METRIC_DEFINITIONS in @yng/metrics. DO NOT hand-edit" (§9)
The playbook Rule DSL — types, evaluator, validator — is pure compiled code packages/metrics/src/playbook-rules.ts:7-8 "This module is the PURE Rule DSL: no DB, no Date, no LLM"; PlaybookRule at :478-506
Rule thresholds are named compiled constants, and rules are compiled literals packages/metrics/src/skincare-playbook-rules.ts:33-52 (COMBO_MULTI_SKU_THIN_BP, HERO_SKU_SHARE_MIN_BP, …); SKINCARE_PLAYBOOK_RULES literals at :175-677
But the org-operative rule INSTANCE is persisted as jsonb, validated against playbookRuleSchema at the router boundary, immutable once active (§16) packages/schema/src/tables/mso.ts:528-535 ("the canonical type is PlaybookRule … validated by playbookRuleSchema at the router boundary before it is written here"), :550-554 (version/status), :565-567 (rule jsonb)
Tenant-specific metrics are already ROWS, not catalog slugs ADR 0020 D9, 0020:325-339
The RLS effectiveness harness connects as the non-superuser runtime roles and asserts posture, closed-by-default, wrong-org isolation, and nested-scope restore scripts/audit/rls-context-effective.ts:24-37 (steps 0, 0a–0c, 1 force-rls, 2 closed, 3 legacy-pattern still closed, 4 enforce, 5 isolate, 6 nested + restore)
The policy inventory introspects the migrated database, not a hand-written table list, so a new Drizzle table cannot silently escape the gate scripts/audit/rls-policy-inventory.ts:1-8
The policy idiom is org_scope_* / org_brand_scope_*, created by FOREACH over declared table arrays, with ENABLE and FORCE RLS packages/schema/sql/rls-policies.sql:294-364
verify:rls chains inventory → runtime ACL → context effectiveness → append-only ledger package.json:43
verify:data in CI runs against a fresh-migrated bare Postgres seeded with one synthetic fixture org — per-client rows are absent by construction .github/workflows/ci.yml:114-184 (postgres:16.14 service, pnpm run db:migrate, scripts/fixtures/adversarial-data-consistency.ts, ORG_ID=00000000-ad00-4000-8000-000000000001)
audit:all is the ONE place static audits are enumerated package.json:40
None of this exists yet grep: content_dimensions, content_mentions, content_mention_tags → 0 hits outside this ADR

Tenancy & security review#

This ADR carries the review; that is why it is the merge gate rather than a schema note.

Threat. Per-client vocabulary rows are tenant data of the most sensitive kind we would hold on this pillar: they ARE a paying client's confidential research — its segmentation of its own market, its barrier taxonomy, its named competitor and entity lists, its glossary definitions. A read that crosses an org boundary inside an agency's portfolio therefore leaks one client's strategy to another, and the two clients may be competitors. The catalog is small, human-authored and low-volume, which makes it easy to under-guard relative to the fact tables — the opposite of the right instinct.

Mechanism. Four controls, all of them existing platform machinery rather than new invention:

  • org_id uuid NOT NULL and brand_id uuid NOT NULL on every catalog, bridge, fact and aggregate table from row one — never added later. Tenancy is org → brand (root invariant 1). Stated precisely: RLS provides cross-ORG isolation; the brand leg of the org_brand_scope_* predicate is deliberately permissive on two conditions — it passes when brand_id IS NULL or when no brand context is pinned (app_current_brand() IS NULL, rls-policies.sql:338-364) — so brand isolation is app-layer authority (brandProcedure pins the authorized brand; org_memberships.viewable_brand_ids), with RLS as the org-level safety net. NOT NULL tenant columns are the prerequisite that keeps the predicate meaningful, not the brand guarantee itself.
  • org_brand_scope_* policies in packages/schema/sql/rls-policies.sql with ENABLE and FORCE RLS, created through the same FOREACH idiom as every other brand-partitioned table (:325-364); coverage proven by the DB-introspecting rls-policy-inventory.ts:1-8, so omitting a policy is a named gate failure and not a silent hole.
  • Non-bypass runtime identities (§66c): production web is yng_app, worker yng_worker, Cube yng_cube, exact-identity and NOSUPERUSER + NOBYPASSRLS — because SUPERUSER/BYPASSRLS skips even FORCE RLS, and a correct policy on a privileged connection is decoration (rls-context-effective.ts:11-13, :24).
  • App-layer authorization is the authority, RLS is the safety net (root invariant 1): reads go through brandProcedure, which wraps the whole resolver in runWithRlsContext; the catalog reader carries an explicit eq(orgId)/eq(brandId) predicate of its own.

What is NOT closed. RISK-002 stands, unchanged by this ADR: app.current_org_id is caller-settable and yng_app still combines tenant web with reviewed auth/control-plane access, so a stolen web credential can select another tenant's GUC (docs/SECURITY.md:140; root invariant 1). That is a platform-wide production blocker owned by the RLS P0 workstream. This ADR neither worsens nor fixes it, and no sentence in this ADR should be read as tenancy clearance for multi-tenant production. What this ADR does close is the narrower question it is accountable for: whether the catalog tables are correctly scoped and provably isolated under the runtime roles we actually ship — and D5 is the evidence, not the assertion.

Decision#

D1 — The taxonomy catalog is a NEW STREAM's own dimension tables, on ADR 0017 D1's sanctioned path

ADR 0017 D1 already names the legal route for data the platform has never carried, verbatim (0017:106-108):

A genuinely new data kind is a PRODUCT release: new stream + sink + rollup consumer (§46) + pillar metrics + dashboard template — never a per-customer branch or table.

The new data kind is the content_mention stream: a mention-level social-listening row whose envelope is a FIXED 21-field dictionary registered ONCE in TARGET_STREAMS / STREAM_FIELDS / STREAM_SCHEMAS / STREAM_NATURAL_KEYS, exactly as the existing 27 streams are (packages/connectors/core/src/mapping/spec.ts:13-71). The registry already carries a mention-grain social_mention stream — ADR 0014's org-scoped market_intel sink; content_mention is a distinct stream on the 1st-party plane, and the two never merge (ADR 0022 D5). Its dimension tables are the catalog: content_dimensions (the client's dimensions), content_dimension_values (their vocabulary, with label_vi, definition_vi, sort_index, color_token, status), content_value_aliases (surface-form folding), plus the text-keyed content_mention_tags bridge that attaches values to facts. This is a star schema: a fact table, its dimension tables, and a bridge for the multi-valued dimensions. Nothing about it is novel except that the dimension ROWS differ per client — which is what dimension rows are for.

Onboarding client #6 adds zero fields, zero tables, zero code. Its variability lands entirely in catalog rows and mapping templates (ADR 0017 D2), and the envelope stays closed: the stream's field list is a product artifact, versioned by product release, identical for every tenant.

This is why the catalog is legal where EAV is not. ADR 0017's non-goal is upheld verbatim (0017:274-276):

Per-customer custom fields, EAV, or schema-on-read — variability lives in mappings; a field two customers need becomes a NULLABLE canonical field via a product release (§32: unmapped → NULL, never fabricated).

The catalog does not violate it and must never be allowed to: no stream gains a per-customer field, no row in the catalog can introduce one, and no consumer reads a client-named field off a fact row. The envelope is closed and typed; the catalog describes the STREAM'S OWN dimensions, not the client's private extensions to somebody else's dictionary. A vocabulary value is a row in a dimension table; a field is a compiled member of a dictionary. Confusing the two is the failure mode this decision exists to prevent.

D2 — ADR 0020 F6 is NOT the licence, and may never be cited for this feature

F6 reads, verbatim (0020:209-222, "F6 — dictionary extensibility: field packs first, a declared extension namespace later"):

Ruling: vertical field packs (still code-declared) absorb anything two tenants in a segment would want, and remain the first answer. A per-stream typed extension namespace is accepted in principle for the genuine one-off, with a hard boundary — extension fields may never enter METRIC_DEFINITIONS, the Cube generator, or a shared aggregate; display, export and single-org filtering only. EAV is rejected on the reviewer's own analysis rather than on inherited doctrine. Neither is built here.

Recorded plainly, because it is the misreading this ADR exists to close: all three independent debate proposals cited F6 as their licence while putting per-client dimensions into METRIC_DEFINITIONS and into shared aggregates — precisely the three things F6 forbids. The argument would have failed review. It is CLOSED here: any future design document, PR description, or code comment that cites ADR 0020 F6 to justify taxonomy or catalog behaviour is wrong by construction, and reviewers should reject it on that ground alone without re-opening the design.

The two are different objects, not two readings of one rule:

  • F6 governs extension FIELDS bolted onto an EXISTING stream's rows. The stream, its dictionary, its metrics and its aggregates already exist and belong to every tenant; a tenant is asking to smuggle one more attribute through them. F6 permits that only at the edges — display, export, single-org filtering — because anything deeper would let one tenant's attribute change a shared definition.
  • This ADR's catalog is the dimension-table SET OF A NEW STREAM, structuring that stream's own facts. There is no existing dictionary to extend and no shared definition to distort; the stream arrives complete — envelope, sink, promoters, pillar metrics, dashboard template — as a product release. That is ADR 0017 D1's path, and it comes with D1's obligations, not F6's permissions.

The practical consequence is that this feature is held to a HIGHER bar than F6, not a lower one: the catalog does enter metrics and aggregates by design (a distribution over a client's dimension IS the product), so the boundary cannot be "stay at the edges". It has to be D3's two-plane law, enforced by D4's three rules.

D3 — The code/data boundary, as a rule

COMPILED CODE, never data:

  • the kind union — 10 closed members, each earned by a real client case (single_select, ordered_stage, multi_select, entity_list, hierarchy_child, boolean_gate, confidence_ladder, evidence, derived_cardinality, free_text);
  • the role enum — 8 structural members (primary_topic, topic_parent, sentiment, ordered_stage, entity, gate, confidence, evidence), deliberately structural so client semantics (barrier, motivation, persona, intent, watch location) never compile into the platform;
  • every mapping transform kind (a Zod variant + a test, §15 — no per-source branching);
  • every metric slug — all on pillar:'audience', parameterized by dimension binding;
  • every widget kind, in the ONE WIDGET_REGISTRY (ADR 0019 D6).

DATA — rows, per org + brand, versioned (§16): vocabulary and only vocabulary. Dimension instances, value lists, label_vi, display_role (primary|secondary|diagnostic|hidden — together with label_vi, this is where client semantics such as barrier, motivation, persona, intent and watch-location live, per the settled template-portability decision; the role enum stays structural precisely because this column exists), definition_vi (this IS the client-facing glossary), aliases, sort_index, color_token references (a token FK, never a hex string — §67), and per-dimension thresholds such as min_base.

Two precedents, stated precisely, because a sloppy version of each is what invites the wrong design:

  • The §65 playbook pattern is "DSL compiled, instances persisted as validated data" — NOT "rules never touch the DB". The Rule DSL module is pure: "no DB, no Date, no LLM" (playbook-rules.ts:7-8), with the PlaybookRule shape at :478-506 and named threshold constants and rule literals compiled in skincare-playbook-rules.ts:33-52, :175-677. And the ORG-OPERATIVE rule is a jsonb column — mso_playbooks.rule — validated against playbookRuleSchema at the router boundary before it is written, versioned, and immutable once active (edit = version N+1 + archive in one transaction, §16; packages/schema/src/tables/mso.ts:528-535, :550-554, :565-567). The schema-versus-instance split already runs in production, under audit, on the platform's most consequential numbers. The catalog asks for the same split, not a new indulgence.
  • ADR 0020 D9: platform metrics are a code catalog; a tenant's own metrics are ROWS in business_kpi_facts, discovered per request inside the org scope — "triệu metric riêng = triệu HÀNG" (a million tenant metrics = a million ROWS, translated), never a global enum, never a per-customer branch (0020:325-339, quoted phrase at :332).

The catalog follows the same two-plane law: shared semantics compile; tenant vocabulary is data.

D4 — Three hard rules, each with a named enforcement

  1. Catalog rows never mint metric slugs. Slugs exist only in METRIC_DEFINITIONS — a compiled readonly array whose header states they are the stable identifier and must never be renamed (packages/metrics/src/catalog.ts:1-7). A client's dimension is PARAMETER rows consumed by the compiled pillar:'audience' slugs (nine at product completion; five ship in MVP — handoff WP4); adding client #6 adds no slug, and a slug is never derived from, concatenated with, or keyed on a dim_key or value_key. Enforcement: scripts/audit/content-taxonomy-typed.py, registered in audit:all (package.json:40 — the ONE registry; never inlined into a hook or workflow).

  2. Catalog rows never enter the Cube schema generator. The generator's inputs are compiled registries and static source specs only — it imports node:fs/node:path/node:url, METRIC_DEFINITIONS (plus its type), CUBE_SELECT_COLUMNS and prettier, and nothing else; there is no RUNTIME postgres, drizzle or DB-client import in the file or in its CUBE_SELECT_COLUMNS source (scripts/cube/generate-schema.ts:14-21), and the generated schema is never hand-edited (§9, :11-12). Audience Cube binding is deferred to V3 (generated cubes carry no brand_id yet), and even then it binds envelope and rollup COLUMNS, never catalog values as schema — a per-client dimension does not become a Cube dimension. Enforcement: the generator's import surface (a runtime DB import there is a review-visible change) plus cube:generate:check (package.json:48). Stated honestly: cube:generate:check is NOT currently chained into audit:all, verify, or CI — today it is a §9/release-checklist step. Registering it in audit:all is part of D4's landed evidence (ledger above), so this decision closes that gap rather than inheriting it.

  3. Catalog rows never join a cross-org aggregate. Every catalog, bridge, fact and aggregate table carries org_id + brand_id NOT NULL with org_brand_scope_* policies under ENABLE + FORCE RLS (packages/schema/sql/rls-policies.sql:325-364), and the agg_content_* keys embed (org_id, brand_id, dataset_id) so no aggregate row can span orgs — there is no key shape in which two tenants' vocabulary could land in one bucket. Enforcement: the RLS policies + the DB-introspecting rls-policy-inventory.ts:1-8 (a new table without coverage fails verify:rls) + the D5 test.

D5 — The cross-org read test WP1 must ship (this is the merge gate)

A new step in verify:rls (package.json:43), written in the existing scripts/audit/rls-context-effective.ts idiom and named scripts/audit/rls-audience-catalog-crossorg.ts:

  • Fixture: seed content_dimensions, content_dimension_values, content_value_aliases, plus at least one content_mentions row and its content_mention_tags bridge rows, for TWO distinct orgs (is_sample, distinct brands).
  • Identities: connect as yng_app AND yng_worker, asserting first that both are NOSUPERUSER + NOBYPASSRLS and that the probe tables report rowsecurity + forcerowsecurity ON — steps 0 and 1 of the existing harness (rls-context-effective.ts:24-30). A green test on a privileged connection proves nothing.
  • Assertions, mirroring steps 2 and 4–6 of that harness (:31-37):
    • (a) closed — with no RLS context, every catalog table returns 0 rows;
    • (b) isolate — runWithRlsContext(orgA) returns org A's rows and exactly 0 of org B's, and the inverse holds for org B (both directions, not one);
    • (c) nested — an inner wrong-org scope sees 0 rows, and the outer scope's context is restored afterwards (rows visible again);
    • (d) coverage — rls-policy-inventory.ts reports full SELECT/INSERT/UPDATE/DELETE policy coverage for every new table, with no entry added to rls-exceptions.json.

Sequencing, in force as written in architecture §5 F1 and the programme handoff: "Schema PRs may open once 0023 is drafted; they merge only after 0023 is accepted." Acceptance of this ADR requires the test SPECIFIED as above; the test RUNNING green is the merge condition of the WP1 schema change that creates the tables — the test ships inside that same change, so the tables and their isolation proof land together or not at all.

D6 — Rejected but documented: a per-client compiled taxonomy module

The fallback shape: the Taxonomy Studio generates a TypeScript module per client — vocabulary as code constants (dimensions, values, labels, definitions, aliases, thresholds) — shipped by PR and compiled into the build. It is recorded here because it is the genuine recovery path had this ADR's tenancy review rejected catalog-as-data: a slowdown, not a redesign. The metric layer, the transform kinds, the widget kinds, the promoters and the dashboard archetypes are identical either way; only the vocabulary's transport changes.

We are not building toward it, and no code may anticipate it — no per-client module, no generator that emits one, no branch on a client slug. Two reasons. First, it re-inserts an engineer and a PR cycle into every client onboarding and into every Monday vocabulary admission, which is the exact cost the programme exists to remove; a client whose analyst cannot admit a new topic value without a deploy is the static-HTML workflow with extra steps. Second, its safety benefit is already obtained by D3's two-plane law and D4's compiled boundary: what makes the design safe is that kind, role, transforms, slugs and widget kinds are compiled — not that the vocabulary is.

Trigger to revisit: only a failed tenancy review would reopen it, and D5 exists to settle that question with evidence rather than argument. Absent a red D5, citing D6 is not a design option.

Non-goals

  • No EAV, no schema-on-read, and no per-customer fields on any existing stream — ADR 0017's non-goal (0017:274-276) is upheld verbatim, and D1 explains why the catalog is not an instance of it.
  • No exhaustive schema DDL in this ADR. Tables, columns, keys, generated columns and indexes are owned by WP1 of the programme handoff (its table list is the spec). Where this ADR names a constraint — tenant columns NOT NULL, the bridge unique key, the agg_content_* key prefix, the kind/role CHECKs — that constraint is a boundary condition WP1 must satisfy, not an optional suggestion.
  • No per-client metric slugs, widget kinds, tables, or TypeScript under this decision — ever. Including "just one" for the largest client. D6's compiled-module fallback is not an exception: it would SUPERSEDE this ADR, not sit beside it, and requires a new accepted ADR plus a red D5.
  • No catalog write path outside the Taxonomy Studio and the import promoters. No admin SQL path, no seeding script that writes another org's vocabulary, no LLM writing a kind, role or threshold (V2's proposer may draft labels, glossary text, ordering and alias clusters only, behind the ADR 0021 confirm gate).
  • No Cube binding for the audience pillar in MVP (D4 rule 2; V3, columns only).

Consequences#

What it buys.

  • Client #N is rows: onboarding adds catalog rows and a mapping template, not a migration, a slug, a widget kind or a deploy. The programme's MVP cut-line — Client A (banking) delivered with zero engineer-hours in the taxonomy-authoring step — is only reachable on this side of the boundary.
  • Monday vocabulary admission without a deploy. A new topic value or entity alias is an analyst action in the Studio; unknown values land pending in a visible "chưa phân loại" bucket rather than being dropped, so a delivery never fails on vocabulary drift.
  • Text-keyed history survives version bumps. The bridge stores dim_key/value_key as TEXT beside the FK ids, so a taxonomy version bump (§16 — version N+1 + archive in one transaction) does not orphan an already-tagged corpus. This is the modelling choice that lets versioning coexist with millions of fact rows.

What it costs, stated plainly.

  • A data-shaped vocabulary layer must be guarded by audits and tests forever. D4's three enforcements are standing obligations, not a one-time setup: content-taxonomy-typed.py in audit:all, the generator's import surface plus cube:generate:check (registered in audit:all as part of D4's evidence), and the RLS policy + inventory + D5 triad. If any of the three is deleted or allowlisted away, the boundary is gone and the design silently becomes the thing ADR 0017 forbids.
  • Catalog quality becomes operational data governance, not code review. A wrong threshold, a duplicated value, a bad alias cluster, a glossary definition that misstates what a dimension counts — none of these are caught by a compiler or a diff. They are caught by the Studio's confirm gate (ADR 0021 posture: nothing load-bearing until a human confirms), by the pending bucket being visible, and by the receipt. That is a new operational discipline the platform did not previously owe.
  • Per-client correctness anchors live OUTSIDE ci.yml — Tier B, by construction, not by laziness. CI's verify:data runs against a fresh-migrated bare Postgres seeded with one synthetic fixture org (.github/workflows/ci.yml:114-184), so a per-client oracle row there would iterate an empty database and go vacuously green; and committing real client exports as CI fixtures is a §44 and contract non-starter. CI therefore carries client-AGNOSTIC structural assertions over committed synthetic is_sample fixtures, and per-client anchors run in an operator/delivery gate. The Tier-A/Tier-B split itself is owned by the architecture document; this ADR records only why the split is forced.

Alternatives considered#

  • (a) A declared extension namespace under ADR 0020 F6. Rejected — and, uniquely among these alternatives, forbidden as a citation (D2). F6 admits an extension namespace only for display, export and single-org filtering, and explicitly bars extension fields from METRIC_DEFINITIONS, the Cube generator and shared aggregates. This feature must put dimension distributions into metrics and aggregates to exist at all, so F6 cannot license it; the three proposals that claimed it would have been rejected at review.
  • (b) A per-client compiled taxonomy module. Rejected but documented (D6): correct, safe, and a dead end for the programme, because it re-inserts an engineer into every onboarding and every weekly vocabulary admission while adding no safety that D3/D4 do not already provide.
  • (c) EAV / schema-on-read on an existing stream. Rejected — ADR 0017's non-goal upheld verbatim (0017:274-276), on its own reasoning rather than inherited doctrine (ADR 0020 F6 also rejected EAV on the reviewer's own analysis): it destroys compile-time consumer safety and turns every metric into a per-tenant special case.
  • (d) A jsonb tag blob or a facet-id array on the fact rows. Rejected in the debate. It reads as the cheap version of the same idea and fails on two mechanics the platform depends on: a §68-keyed, idempotent re-import needs a per-tag row to upsert and delete against (the settled bridge is UNIQUE (mention_id, dim_key, value_key) NULLS NOT DISTINCT with ordinal as a PAYLOAD column and per-mention DELETE-then-INSERT in one transaction — the judge record reproduced the alternative key producing 4 bridge rows for 2 real labels on a reordered re-import, inflating a rendered measure while the proposal's own assertion still passed); and per-value, RLS-scoped reads need a row a policy can filter, which a blob inside a fact row does not provide.

Amendment 2026-09-03#

The two-plane law (D1: shared semantics compile as code, tenant vocabulary is data) extends past content-intelligence dimensions to numeric tenant datasets — org_dataset_fields is the same split applied to measures/dimensions/records instead of taxonomy values. See ADR 0038 D1, and ADR 0017's own non-goal, amended the same day.