On this page
- Status: Accepted
- Date: 2026-07
- Context owner: Platform
- Related: ADR 0002 (plugin architecture), ADR 0007 (demo posture), §21/§47/§62/§66/§67/§69/§70/§71
Context#
UCIP serves organizations with very different shapes: BLO-style tailored customers (4 frozen English-term dashboards), marketplace-first sellers, market-intelligence-only buyers. Each org must be able to run its own composition of the product: enabled plugins, enabled connectors, menu structure and naming, a predefined set of dashboards on day one, plus fully custom dashboards — and predefined dashboards must themselves be customizable per org without losing the vendor's ability to improve them later.
A 7-subsystem code audit + 4-track product research round (Salesforce/ServiceNow/Notion/Linear nav models; Grafana/Looker/Datadog/Power BI template semantics; Stigg/Schematic entitlement models; multi-tenant config layering) established the current state:
- Plugins/entitlement (ADR 0002): compiled
PLUGIN_REGISTRY(~30 manifests incl. 18 connectors), per-orgorg_plugin_installationsledger, 3-step resolution +dependsOncascade, page+nav enforcement. No bundle/plan layer; new orgs rely ondefaultEnabled. - Menus: registry (
DASHBOARD_NAV_GROUPSjoined toORG_MENU_ITEMS) + per-roleorg_role_policies.menu_items+ per-orgmenu_order/menu_group_order/menu_labels(sparse overrides — already the shape those products converge on) — but every editor is super-admin-only, there is no org-wide hide list, no cross-group moves, no user layer. - Dashboards: a Data-Studio-class builder (
dashboards+dashboard_widgets, Zod widget union §21, oneexplore.querydata path).is_templateis dead,template_keyis a free-text tag; "templates" exist only as imperative per-org seed scripts. No lineage, no vendor-update path. The BLO 4-set is hardcoded RSC pages owned by theblo-dashboardsplugin (replacesNavItemIdshides generic reports). - Provisioning:
admin.createOrganization= bare INSERT + role-policy seed. Everything else is manual one-off onboarding scripts. - Connector entitlement gap:
connectors.createnever checks plugin enablement server-side (UI-only gate); the worker never re-checks plugin state for scheduled syncs.
Alternatives considered#
Five decisions were contested. The case against the option that was rejected, and the outcome:
- Full plan→feature→limit entitlement engine vs. provisioning bundles. The case for a plan
engine is entitlements as stored, resolved data. Against:
org_plugin_installationsis already the resolved entitlement store, the platform has negotiated contracts and no self-serve billing, and a metered-limit engine is speculative (Agent contract #4). Outcome: blueprints (bundles) as versioned code data applied at provisioning + the existing per-org ledger as the runtime store. A plan/limit engine is explicitly deferred, with the resolver seam (resolve.ts) named as its future hook. - Dashboard templates in DB (cross-org readable rows) vs. in code. A DB gallery reads
better, but cross-org readable rows mean a new RLS carve-out and a new threat surface — the
repo's only sanctioned cross-org read is the SECURITY DEFINER share lookup — and the repo
idiom is compiled catalogs (
PLUGIN_REGISTRY,BUILTIN_THEMES). Outcome: templates are code (Zod-validated declarative bundles); org instances are ordinary org-scoped rows. No RLS change at all. - Fork vs. overlay vs. sync for customized templates. Research shows nobody ships true
3-way merge; Looker refinements (pure overlay) is the only survivor and is fragile; Power
BI's ownership split (vendor updates its widgets, never deletes yours) is the proven middle.
Outcome: materialized fork with lineage + per-widget ownership split + baseline
snapshot: each installed widget stores
template_widget_key,origin, and the pristinetemplate_baselineconfig. Updates are opt-in and per-widget: unmodified template widgets are replaced + re-baselined, modified ones are kept and reported, new ones are appended, deleted ones are removed only if unmodified. Detach clears lineage (full fork). - Templatize the bespoke report pages now? The four operator-protected BLO dashboards are customer-frozen (EN terms, exact column spec — operator directive) and the table-centric reports as not expressible in the widget catalog yet. Outcome: v1 templates compose ONLY the existing widget types over existing metric slugs (no new metric surface ⇒ no new §53 assertions); bespoke pages stay; the staged migration (catalog gaps → overview parity → system-template class → nav re-pointing) is recorded as future work in the plan doc.
- Menu self-service scope. The storage/composition pipeline is already right (sparse overrides over a stable-id registry — the Salesforce model); the gap is exposure: org-admin editors, an org-wide hide list, and pinned custom dashboards. Per-user personalization and cross-group moves are deferred (per-role reorder is the documented ServiceNow sprawl trap; user layer is additive-only when it comes).
Decisions#
D1 — Workspace blueprints (provisioning bundles as code)
ORG_BLUEPRINT_REGISTRY (Zod-validated, versioned) declares per blueprint: plugins to enable,
dashboard templates to install, menu presets (menu_order, menu_group_order, menu_labels),
role-policy menu additions, theme slug, and org setting defaults. applyOrgBlueprint(orgId, blueprintId) is idempotent (upserts on the existing unique constraints, §25/§68 discipline),
ORG-pinned, is_sample-aware, audit-logged, and is invoked from admin.createOrganization
(optional blueprintId input) and re-runnable standalone. Blueprints supersede the ad-hoc
scripts/onboarding/seed-* flow for new orgs.
D2 — Dashboard template registry + install engine
DASHBOARD_TEMPLATE_REGISTRY (code, Zod-validated): each template has a stable key, integer
version, bilingual name/description keys, and widgets whose configs must parse against the
existing §21 union and whose metricSlugs must exist in the metric catalog (build-time audit).
Install materializes ordinary dashboards + dashboard_widgets rows for the org
(template_key + new template_version; per-widget template_widget_key, origin ('template'|'custom'), template_baseline jsonb). The install path reuses the duplicate
engine's id/anchor remapping. Instances are fully editable in the existing builder.
D3 — Opt-in template updates with per-widget ownership split
dashboardTemplates.updateAvailable compares instance template_version to the registry.
applyUpdate (owner/org-admin, audit-logged) per template widget key: config equals baseline →
replace + re-baseline; modified → keep + report as skipped; missing from new version →
delete only if unmodified; new keys → append. Layout for replaced/added widgets comes from the
new template; customer widgets keep their positions. detach clears lineage. Never silent,
never destructive of org-authored content.
D4 — Menu configuration becomes org-admin self-service
New orgMenu router (org-scoped, manage_org_settings capability, rate-limited,
audit-logged): get/set for the three existing override blobs + new
organizations.hidden_menu_items (org-wide hide list merged into the sidebar's existing
hardHiddenItems, nav-only per §47 — page guards unchanged). The existing super-admin editors
remain; the new settings page reuses their components. Sidebar composition pipeline
(filterNavGroups / applyMenuOrder / applyDashboardGroupOrder) is unchanged.
Precedence inside hardHiddenItems: a menu id the org's workspace blueprint explicitly grants
(roleMenuAdditions) is never hidden by the stored hidden_menu_items floor — the grant is
subtracted at read time (mergeHardHiddenNavItems) and removed from the stored floor by the next
applyOrgBlueprint. The plugin / pillar / parked legs still win, so a granted item whose plugin is
off stays hidden. Operator effect: an org provisioned before a blueprint started granting an item
sees that item in its sidebar on the next page load, with no data change and no re-apply.
D5 — Pinned dashboards in the sidebar
organizations.pinned_dashboard_ids (ordered uuid array, hard cap 8): org-chosen saved
dashboards rendered as nav entries in the overview group after dashboards, visible only to
roles whose policy includes dashboards, respecting dashboard visibility. Managed from the
dashboards list UI (org-admin).
D6 — Connector entitlement is enforced server-side
connectors.create rejects a connectorType whose owning plugin is not effectively enabled
for the org (super-admin bypass, mirroring the market-intel ingest gate). Scheduled sync paths
re-check plugin enablement so disabling a plugin pauses live syncs. This closes the UI-only
gap found in the audit.
D7 — Placement and guards
New code lives in new modules (server/routers/org-menu.ts, server/routers/ dashboard-templates.ts, server/dashboard-templates/*, server/org-blueprints/*) — the
P1-09 file-growth ratchet forbids growing admin.ts/dashboards.ts/reports.ts. New static
audits wired into audit:all: template-registry validity (unique/stable keys, §21-parsing
configs, catalog-known metric slugs, monotonic versions, bilingual titles) and blueprint
validity (known plugin ids + dependsOn closure, known template keys, valid menu ids). Update
semantics are pure functions with unit tests; applyOrgBlueprint idempotency is tested.
D8 — An ORG TYPE is config; the vocabulary it composes from is a release
An org type (MSO type: eCom, Marketing, Market Intelligence, Audience) is a BLUEPRINT — enabled
plugins, installed dashboard templates, menu ids, group order, theme — and adding or reshaping one
is a config change, applied through applyOrgBlueprint with no deploy. The vocabulary a blueprint
composes FROM is compiled and ships as a release: a new menu item id, a new pillar, a new metric
slug (METRIC_DEFINITIONS), a new connector manifest, a new dashboard template key, a new widget
kind, and any new RSC surface (page.tsx + its surface.ts). A blueprint may only name what
already exists; it can never mint one. This is ADR 0023 D3's two-plane law at the workspace layer,
and it is what keeps a per-client workspace out of TypeScript (§81) while org-blueprint-validity.ts
holds the naming half — a blueprint referencing an unknown plugin id, template key or menu id fails
audit:all.
Alternatives considered#
- Entitlements-as-a-service / plan engine (Stigg-style plans+limits+metering): deferred,
not rejected. The substrate decision (entitlements as stored resolved data behind one
resolver) is already satisfied by
org_plugin_installations+resolve.ts; add plans there when billing/self-serve arrives. - DB-stored template gallery in a "system org": rejected — requires a cross-org RLS carve-out for no current authoring need; code templates are versioned, reviewed, and build-validated for free.
- Pure overlay (Looker-refinement) instances: rejected for v1 — highest fidelity to upstream updates but requires a closed overlay grammar and replay engine; the baseline column keeps this evolution open (an overlay can be derived as instance-vs-baseline diff).
- Grafana-style provisioning overwrite: rejected outright — silently discards tenant edits; the exact class of foot-gun this repo audits against.
- Per-user nav personalization now: deferred — additive-only user layer (Salesforce semantics) documented for a later phase; org layer first.
Consequences#
- A new org can be provisioned to a full working workspace (plugins, dashboards, menu, theme) in one audited action, and re-provisioned idempotently.
- Vendor dashboard improvements reach orgs without clobbering org edits; orgs can customize any installed template with the existing builder.
- Org admins self-serve menu naming/layout within the §47 boundary (nav cosmetic, page guards authoritative).
- The dead
is_templatecolumn is retired from UI copy;template_keybecomes real lineage. - Accepted residuals: menu label overrides stay single-string (vi-first product; bilingual override shape is a recorded extension), tRPC read-API entitlement remains page+nav layer (ADR 0002 D3 unchanged), no metered limits.
Amendment 2026-09-03#
D4/D5's menu configuration and pinned-dashboards mechanism gains a brand-scoped tier: org_nav_config
(one row per org, plus one override row per brand) resolves onto the same six blobs this ADR's org
columns already define, brand row overriding org default column by column, org columns staying the
ultimate fallback. See ADR 0043 D6.
Amendment 2026-09-10#
D8's "an org type is a blueprint" gains a second half: a blueprint now also DECLARES its verticals
(orgBlueprintSchema.verticals?: Vertical[]) — the product-level axis ADR 0048 introduces above plane,
ingest family and resolver pillar. org-blueprint-validity.ts extends its "may only name what exists"
check accordingly: every plugin the blueprint enables whose manifest declares a vertical must be a
member of the blueprint's own verticals list — a blueprint may not enable an HR connector while
claiming to be eCom-only.
datasetPacks (a list of pack keys, e.g. ['hr-people-analytics']) is a FOURTH kind of thing a
blueprint composes from, alongside plugins, dashboard templates and menu presets: applyOrgBlueprint
declares each named pack's datasets (declarePackDatasets) and installs its pages
(installDatasetPack) for every brand the org has at apply time, both idempotent (ADR 0042 D2 / ADR
0038 amendment (d)). Same rule as every other blueprint component: a blueprint may only name a pack
key that already exists in the repo (dataset-pack-registry-validity.ts); it can never mint one. See
ADR 0048 D2/D3.