Skip to content
MSO CloudDocumentation

ADR 0059 — Per-org dashboards at scale: vocabulary, declaration, facts

On this page
  • Status: Accepted (implementing). D2, D3, D4, D6, D8 and D10 are in code; D9 budgets and the D7 cache proposal remain proposals. See "Implementation status".
  • Date: 2026-11-05
  • Owners: Platform (dashboard surface, tenant dataset plane).
  • Related:
    • ADR 0023 D3 (client vocabulary is data);
    • ADR 0029 (deck presentation as data);
    • ADR 0033 (org skins, brand override);
    • ADR 0038 (tenant datasets);
    • ADR 0042 (packs as data);
    • ADR 0043 D6 (brand-scoped navigation, org groups);
    • ADR 0044 D5 (binding cache);
    • ADR 0055 (panel read model);
    • §69 (one theme path), §76 (route budgets), §81, §132 (no per-tenant code), §135 (cache keys), §154 (chat reads the panel through its resolver), §185 (landing follows the sidebar).

Context#

The product serves hundreds of orgs. Each org differs in data, menu, page structure, look and wording. Three page sources exist today:

  • compiled templates;
  • dataset packs (org_dataset_packs);
  • the content-deck generator with deck_presentation.

Widgets are one registry of typed kinds, lazy-loaded one family per import(). Themes are one inline CSS-variable skin per request.

A vendor-delivered social-listening report exposed the gaps that remain when a new org must be onboarded without new per-org code. The report has two dashboards:

  • one built from report-period aggregates (7- and 14-day periods, cumulative-to-date values, printed percentages and shares, text lists);
  • one built from tracking aggregates plus a record-level sample with multi-label topics and a curated quote whitelist.

The gaps, each verified against the code at commit 3cdf3d4d:

  1. Single-dim reads. agg_org_dataset_period answers one dimension per read (selectMeasureQueryDim); other filters are reported as ignored. A printed value keyed by six dimensions cannot be read exactly. Report periods that end in the same month collide on period_month.
  2. Sales-only panel reader. The panel table (ADR 0055) holds every dimension of a record, but its reader catalogue is closed over sales roles (focus, entity, item) and the metric set value | units | asp.
  3. No text rows in datasets. Records carry dims and integer measures only. A list of titles, analyst summaries or quotes has no reader.
  4. Panel frames are read-only. No panel frame answers a click; only classic chart kinds write a cross-filter leg.
  5. Sidebar ignores org_nav_config. Brand rows and org-defined groups store fine (ADR 0043 D6) but never render. The layout reads only organizations.*, and filterNavGroups maps only compiled groups.
  6. The spec layer cannot be separated. The registry, config union and pack schemas live in apps/web and import app-local modules. The declaration grammar cannot leave the monorepo.

Decisions#

D1 — The three-layer law

  • L1, vocabulary (compiled, shared, client-neutral):
    • widget kinds and the typed config union;
    • panel reader views;
    • click grammar;
    • theme token schema;
    • pack and deck-pack grammars;
    • client-neutral packs.
  • L2, declaration (per org and brand, rows):
    • dataset pack rows and their pages;
    • deck_presentation;
    • dashboard, tab and widget rows;
    • org_nav_config (including groups);
    • org-owned skins, brand skin pointers and brand ink overrides;
    • dimension value vocabularies (labels, order, parents).
  • L3, facts (read only through resolvers):
    • the cell resolver;
    • the panel reader;
    • the audience readers.
  • Rules:
    • A new org adds only L2.
    • A new shape is an L1 release that every org may declare.
    • No L1 file names a tenant, and no L1 code branches on an org, brand or slug (§132). Client wording, period names, group labels and status labels are L2 data (ADR 0023 D3, §81).

Enforcement:

  • no-per-customer-hardcodes.py;
  • the tenant-name ban in dataset-pack-registry-validity.ts;
  • a review grep of the diff for the onboarded client's tokens. Proposal: a host-local deny-list read by a pre-push check, so no client name enters a committed audit.

D2 — An exact-cell grid view on the panel read model

The panel reader gains one view, cells. It needs no roles and no measure roles, and it extends the closed catalogue of ADR 0055 without touching any existing view.

Request

  • follows (page legs the card reads; any other leg is reported, never applied).
  • pins (fixed dims; a pin beats a page leg).
  • defaults (last / first per dim, resolved by sort_index among values present, and reported back so a required control can show the applied value).
  • rows and optional cols. Each axis is either:
    • the values of a dim, with vocabulary order, an ordinal window anchored on a resolved dim, hierarchy from parent_value_key, and label/sublabel from sibling dims; or
    • explicit items.
  • A row item may override any column's cell spec.
  • A cell spec carries: measure, extra pins, offset (−k on an ordered dim), delta (of/vs with requireSame dims), base + minBase, statusFrom (a dim whose label explains a blank), and text from a dim with an optional href dim.
  • shape: one of table | bands | bullets | chart | ring.

Resolution of one cell

The cell's conditions are: card pins ∧ cell pins ∧ followed legs ∧ resolved defaults, matched exactly against the cached partition.

Rows matched Answer
0 Null, state no_data.
1 Its measure. An absent key is null, with the statusFrom label or no_data.
More than 1 Null, state not_applicable_at_grain.

The view never sums. A value that is printed but not additive (a percentage, a share, a deduplicated audience) can therefore only be read at its full grain. A filter that would drop a dimension produces a blank with a reason, never an aggregate. Summing additive measures is a later extension behind the field's declared aggregation and temporality.

delta is the only arithmetic:

  • rates (percent_bp, ratio_bp) give points;
  • counts give a percentage, null with a reason when the base is 0;
  • a requireSame mismatch gives null with a reason.

A pack declares no delta on cumulative-to-date values whose source restates earlier marks.

Answer

Existing frames only:

  • panel_matrix (table, bands, bullets): heat, in-cell bars, text cells, hierarchy;
  • chart_aligned_pivot: bar/line series, stacks, x roles and badges, highlight bands;
  • ring_compare.

No new widget kind.

What a pack declares to use it

  • Ordinary dims carry the reporting grain: report period, mode, scope, channel node and similar.
  • period_month is the month in which the period ends.
  • Day series use subPeriodKind: 'day'.
  • Text rows are dims keyed by a stable id (≤128 chars), with the text as the value label (rendered at most 400 chars).

The loader writes labels, sort_index and parent_value_key from the delivery's own dimension tables (D8).

The view is opt-in per dataset. It is available, to cards and to chat, only on a dataset whose panel spec declares it, so the views advertised for existing panel datasets do not change.

Nothing in the table changes (ADR 0055 D1). The view obeys ADR 0055 D5:

  • one partition per read;
  • formulas in @yng/metrics;
  • the compensation gate per measure;
  • binding-cache keys carry only the followed legs (§135).

D3 — Additive frame fields

Four optional fields, so an absent field leaves every existing frame byte-identical:

Field Purpose
axis: 'left' | 'right' on a pivot series Dual-axis combo
state on a number cell The availability state behind a blank
neutral polarity Direction colour that never reads as good or bad
href on a text cell https only, opened with noopener noreferrer

D4 — Drill grammar

A mark or row click does exactly one of four things. The target binding is always resolved on the server from the stored source widget; the client sends only the clicked key.

Kind Effect Available on
filter Toggles a page leg for the clicked dim (toggleDatasetCrossFilter). The source never narrows itself. Classic chart kinds (today); panel matrix rows and pivot x points (new, opt-in)
detail Opens a dialog that renders a second frame, from the source widget's declared detail binding plus the clicked key. Panel frames (new, opt-in)
records The existing records drawer over corpus rows. Audience kinds with recordDrilldown
navigate Moves to another page or tab and carries only the legs the target declares as controls. A hidden filter cannot travel by construction. Proposal; phase 2

A filter click dim enters the page view scope exactly like a declared control or a classic crossFilter dim. The client mask and the endpoint mask therefore pass it to the cards that follow it, and to no other card.

An aggregate with no records behind it may filter, open a detail frame, or navigate. It never opens a records drawer of fabricated rows.

D5 — Evidence posture is structural

When a client restricts which verbatims may be shown, that restriction is enforced by what is STORED, not by a display flag:

  • Record-level rows that may only be counted are ingested without content, link or author.
  • Whitelisted items carry their curated text and are tagged in a curated-evidence dimension.
  • Only evidence cards open the record drawer: list cards opt in with recordDrilldown: true, and measure cards (drawer on by default for existing decks) opt out with recordDrilldown: false.

No drawer, chat sample, AI card, sampler or share page can then reveal text that does not exist. Curated items that are not corpus rows (posts with no record id) are text rows in a dataset (D2), opened through detail.

D6 — Navigation grouping is data (ADR 0043 D6, render leg)

  • The workspace layout reads the org default row and the active brand row of org_nav_config: one unique-index read, at most 2 rows, inside the existing parallel fetch.
  • It renders resolveEffectiveNavConfig(legacy org columns, org default row, brand row).
  • filterNavGroups appends org-defined groups (org-group:<uuid>), ordered by mergeNavGroupIds. A group's label rides the existing menuLabels['group:<id>'] override.
  • Every consumer gets the same groups and the same effective configuration: rail, drawer, the active-item resolver and the landing (§185).
  • Group definitions live on the org default row; pins remain brand-filtered at render. Two consequences:
    • a group with no pin visible to the viewer's brand does not render;
    • every installer sees one group set, so no install for one brand prunes another brand's pins.
  • An org with no org_nav_config rows renders byte-identically. Prod held 0 rows on 2026-11-05 (read-only probe); the probe is re-run at deploy.
  • A pack page or tab names its group in menu.group.
  • Proposal: name groups by label and let install upsert the group, so a pack is self-describing.

D7 — Theme path and its cost

Element What it is Per-request cost
Path One inline <style id="yng-skin"> of CSS custom properties per request, rendered server-side from a validated payload (§69). No per-org bundle, no runtime CSS-in-JS, no client merge.
Structure (sidebar, surfaces, chrome) A brand points theme_slug at an org-owned skin. No extra cost: the brand row read already carries theme_slug and theme_overrides, and the skin lookup by slug runs for every request today.
Ink (accent, charts, heat ramp, panels) A brand override (ADR 0033 D5/D6). Zero extra queries.
Cache Proposal: an LRU of the rendered CSS keyed (org, brand, theme updated_at). Added only if measurement shows more than 1 ms in skin resolution plus rendering.

Why a brand skin pointer does not reopen ADR 0033 D5. D5 refuses structure in a brand OVERRIDE so that the brands of one client organisation do not drift into several products, one patch at a time. A brand skin pointer is a different object:

  • It names a whole, validated skin. The skin is authored once, owned by the org, listed in its theme picker, and subject to the same themePayloadSchema and contrast guards as any skin.
  • It is used when a brand is a separately delivered client workspace inside a shared org, whose readers never switch to the sibling brands. A provider org hosting several end clients is the case.

For brands of ONE client the D5 rule stands: ink overrides only. The chooser is the operator; the code path is the existing §69 tier chain, unchanged.

D8 — A loader for vendor star-schema deliveries

The dataset file loader accepts:

  • packFile: an absolute path outside the repo, so the pack JSON stays private L2 data;
  • valueMeta[]: writes a dim's labels, sort_index and parent_value_key from sibling columns or the delivery's dim_* tables.

A generic Tier-B script reads a frozen oracle, built from the client's own workbook by an independent pass (§55). It resolves each expected cell through resolvePanelView (§154) with zero tolerance, so every printed figure on a delivered page has a reconciliation row.

D9 — Performance levers, measure first

Budgets:

Metric Budget Status
LCP p75 at 1440 px ≤ 2.5 s external standard (web.dev "good")
INP ≤ 200 ms external standard
CLS ≤ 0.1 external standard
TTFB ≤ 0.8 s external standard
Route first-load JS no raise §76 ratchet
Panel frame server time ≤ 150 ms p95 warm proposal; calibrate against an existing panel-family page
Panel frame DB queries 0 warm per card (partition memo); bounded per dataset cold proposal

Lever order:

  1. Measure navigation timing, LCP and per-card request counts and durations on the real pages.
  2. Partition-memo hit rate.
  3. Server prefetch of the first tab's above-the-fold frames.
  4. Batched streaming transport for the per-card requests.
  5. Pre-aggregation of hot cards.
  6. A shared cache tier, only if the per-instance hit rate is poor.

A lever is adopted only with a before/after number.

D10 — Separability seam

  • Spec set:
    • widget-config.ts, widget-config-schemas.ts, widget-registry.ts with its generated views;
    • widget-click-behavior.ts, dataset-packs/pack-schema.ts, content-deck-packs/pack-schema.ts, deck-presentation.ts, datasets/panel-view-request.ts.
  • Allowed imports: zod, @yng/* package subpaths, and the set itself.
  • Ratchet: scripts/audit/dashboard-spec-seam.py (in audit:all) counts app-local modules imported from outside the set.
    • Counting rule: distinct modules under apps/web/src, outside the set, imported DIRECTLY by a set file (static import … from, type-only imports included). The three generated registry views count as members of the set.
    • Baseline: 11, measured with that rule at 3cdf3d4d.
    • The count may only shrink.
    • At 0 the set moves to packages/dashboard-spec (follow-up ADR).
  • Readers: new readers are written in packages/metrics from the start (the cells view included).
  • L2 is already portable:
    • a pack is one JSON row;
    • a deck exports as yng-deck-bundle;
    • an org exports through the org archive.

Alternatives considered#

  • Model record-level, multi-label samples as panel rows (one boolean column per topic). Rejected:
    • it duplicates the audience plane;
    • it bypasses its distinct-mention counting and Tier-B oracle;
    • it needs one pre-aggregated dataset per card.
  • Extend the cell resolver to multi-dim reads for classic kinds. Rejected for this step:
    • agg_org_dataset_period cannot answer cross-dim requests at all (ADR 0055 Context);
    • routing classic kinds to panel rows would change numbers for existing cards unless opt-in;
    • classic kinds still lack text rows, heat tables and multi-measure series.
  • Per-org components or CSS bundles. Rejected:
    • every org would add code and bundle bytes;
    • it violates §132 and the §76 ratchet.
  • A committed per-client deck pack. Rejected: client structure is L2. A client-neutral deck pack remains a valid L1 addition when a second org needs the same shape.

Consequences#

  • A delivered report whose numbers are printed aggregates can be rebuilt as pack data plus a loader mapping, with zero per-org TypeScript. Its non-additive figures cannot be summed by any filter path.
  • The panel catalogue gains its first view that is not sales-shaped. Chat reads it through the same resolver (§154); a pack may declare chat questions for it.
  • The sidebar costs one more unique-index read per request, and brand rows and org groups start to render. Orgs without rows are unchanged.
  • Three org-scoped rows may accompany a brand onboarding: a group-definition row, nav pin entries and an org-owned skin. None renders for another brand.
  • The spec seam becomes a number that only shrinks.

Implementation status#

Decision Status Lands in
D1 In force this ADR + review grep
D2 In code packages/metrics/src/dataset-panel-cells.ts, panel-view-request.ts, resolver dispatch, verify:data assertion
D3 In code packages/metrics/src/dataset-panel-frames.ts
D4 In code (filter, detail, navigate) panel renderer, widget-config.ts, panel-endpoint.ts
D5 Data posture; no code onboarding runbook
D6 In code layout.tsx, nav-resolve.ts, dashboard-shell-server.tsx, landing.ts, landing-dashboard-order.ts
D7 Existing path; LRU proposal —
D8 In code scripts/onboarding/load-dataset-files*.ts, verify-dataset-panel-ground-truth.ts
D9 Proposal (budgets) measurement in the first delivery
D10 In code scripts/audit/dashboard-spec-seam.py + baseline