Skip to content
MSO CloudDocumentation

ADR 0043 — Page/Dashboard hierarchy, filter scope law, brand-scoped navigation

On this page
  • Status: Accepted. Batches A2/D3 (2026-09-03), commits d334b80e, a237ad68.
  • Owners: Platform (site programme).
  • Extends: ADR 0024 (tabs, parent/child depth, the shared-coordinate-space rule this ADR's grammar reuses), ADR 0029 (per-deck filter bar, the precedent this ADR's Page-level bar mirrors), ADR 0020 D3 (nav item namespacing), ADR 0012 D5 (pinned dashboards).

Context#

The operator's brief — a Page > Dashboard(tabs) hierarchy, page-level filters/search cascading, org menus binding a Page or a single Dashboard, nested rows/columns with preset widths, and per-org brand menus — reads like a request for new tables. It is not: dashboards / dashboard_tabs / dashboard_widgets already are that hierarchy (ADR 0024), and the flat 12-column ratio-packed grid (deliberately not a container tree, ADR 0024's own decision A9) already expresses nested rows and columns as position alone. What is missing is vocabulary, one new filter container (Page-level, next to the existing Org-cookie and Dashboard-tab-bar containers), two new span presets, a menu pin that can address one Dashboard-tab instead of always a Page's first tab, and a brand-scoped menu tree.

Decisions#

D1 — Vocabulary, not new tables: Trang / Bảng / Thẻ

Page = dashboards row ("Trang" / "Page"); Dashboard = dashboard_tabs row ("Bảng" / "Dashboard"); Card = dashboard_widgets row ("Thẻ" / "Card"). A Content-Intelligence client deck is already exactly one Page whose parent/child tabs (ADR 0024 D1, depth <= 2) are its Dashboards — the hierarchy this ADR names is the one already storing five production decks, with zero data migration. "Bảng" is reserved for a tab; "Trang" stays reserved for the menu-level Page — a guard test (deck-tab-vocabulary-guard.test.ts) pins this distinction across 90 i18n keys in the Layout Editor and its siblings, closing the exact class of naming drift a copy pass could otherwise reintroduce.

D2 — Filter scope law: Org < Page < Dashboard < card cross-filter

A filter is declared at exactly one container: Org (the existing sticky cookie, org-scoped), Page (new — dashboards.filter_bar), or Dashboard/tab (dashboard_tabs.filter_bar, new for generic Pages; a Content-Intelligence deck keeps declaring its tab filter bar on deck_presentation.tabs[k].filterBar unchanged — this ADR's dashboard_tabs.filter_bar is an additive sibling column, not a replacement). Precedence top-down: Org < Page < Dashboard < card cross-filter (?facet=). A container's filter reaches only its own descendants — a Page filter reaches every Dashboard-tab under it and their cards; a Dashboard filter reaches only that tab's own cards and its child tabs, never a sibling tab. A card never widens a filter it cannot express: it either narrows (the existing filterBlind abstain) or is excluded from the container's scope via its own opt-in (dashboard_widgets.filter_scope, new, mirroring the audience family's existing filterScope/AudienceFilterScope for the sixteen non-audience widget kinds that had no such field). null on a card's filter_scope means it still reads only the legacy ?from/?to/?platforms sticky triple — unchanged behaviour, so the addition is strictly additive.

D3 — Page-level filter params: a new pf* namespace, never colliding with tf*

apps/web/src/lib/page-filter-core.ts defines PAGE_FILTER_PARAMS (pfFrom, pfTo, pfPlatform, …), parallel to the existing Dashboard-tab tf* namespace, so a Page filter and a Dashboard filter on the same logical key can coexist in one URL without collision. apps/web/src/server/page-filter.ts is the server-side counterpart (read/validate/resolve). Cross-filtering from a card (?facet=) stays Dashboard-scoped, as before — it never promotes to Page or Org.

D4 — Layout grammar: two new span presets, no container tree

DECK_SPANS gains quarter (3 columns) and three_quarters (9 columns), joining the existing third/half/two_thirds/full — closing the operator's requested preset list (100 / 50-50 / 33-33-33 / 66-33 / 25-75 / 25-25-25-25) with zero change to the packer's algorithm, only the enum and its column map. A "nested column" (a cell that stacks two cards while its neighbour is one tall card) is already expressible as two cards at the same (x,w) band and different y — no new concept, and deliberately not a recursive row/column container tree (ADR 0024's decision A9 stands: a container tree buys the same layouts and costs the packer, the reflow pass, and the share SVG a rewrite).

D5 — Menu pin: a Page or one specific Dashboard-tab

CustomNavItemId widens from dashboard:${string} to dashboard:${string} | dashboard-tab:${string} (apps/web/src/server/custom-nav-items.ts). A dashboard-tab:<uuid> pin opens the Page directly onto that tab instead of always landing on the Page's first tab — additive, same UUID validation, same prefix idiom ADR 0020 D3 established (dashboard-tab: is checked before dashboard: since it is a strict superset prefix of it).

D6 — Brand-scoped navigation and org-defined nav groups

org_nav_config (migration 0193): one row per (org, brand), brand_id IS NULL meaning the org's own default. The six nav blobs (menu_labels, menu_order, menu_group_order, hidden_menu_items, pinned_dashboard_ids, nav_custom_items) mirror organizations.* verbatim; a brand row overrides the org default column by column via resolveNavConfig(), never a full replacement. organizations.* stays the ultimate fallback with no backfill — an org that never touches this table renders exactly as before. groups is new: org-defined nav groups ({id, label, labelEn, order}[]) that slot between the code's compiled DASHBOARD_NAV_GROUPS by declared order (mergeNavGroups()), namespaced org-group:<uuid> (ORG_NAV_GROUP_ID_PREFIX) so an org group id can never collide with — or be confused for — a compiled one. A brand override can never surface an item the plugin/role/pillar gate hides — the chain in nav-visibility-gate-chain.md is unchanged regardless of which tier (legacy org column, org default row, brand row) a resolved value came from; a guard test asserts this. org_nav_config rides the plain org_only RLS cohort, registered as a brand-scope exception in rls-exceptions.json for the same nav-cosmetic reasoning org_login_page/org_auth_oidc use — this table can never grant or revoke access.

D7 — Every metric card obeys the filter law; page/dashboard bar renders it

The filter-bar UI (page-level and dashboard-level) is generalised from the audience-only mechanism to every metric card kind. filterbar-scope.py extends its coverage to the new columns.

Consequences#

  • A brand-organised org (HR's eight legal entities, a multi-brand agency) gets its own ordered sidebar per brand with zero code — an org-defined group plus a per-brand override row.
  • A generic (non-Content-Intelligence) BI Page can now declare its own filter bar the same way a client deck always could, without touching content_datasets.
  • The five live production decks are unaffected: their filter bar continues to live on deck_presentation, and dashboard_tabs.parent_tab_id depth stays capped at 2 exactly as before.

Implementation status (declared 2026-09-03)#

Decision Status Evidence
D1 vocabulary + guard Landed 90 i18n keys (batch V1, commit b393b097); deck-tab-vocabulary-guard.test.ts
D2 filter scope law Landed dashboards.filter_bar, dashboard_tabs.filter_bar, dashboard_widgets.filter_scope (migration 0188)
D3 pf* param namespace Landed apps/web/src/lib/page-filter-core.ts, apps/web/src/server/page-filter.ts; page-filter.test.ts
D4 quarter/three_quarters spans Landed apps/web/src/server/deck-span.ts
D5 dashboard-tab:<uuid> menu pin Landed apps/web/src/server/custom-nav-items.ts; menu-custom-item-bilingual.test.tsx
D6 org_nav_config brand-scoped menu Landed migration 0193_org_nav_config.sql; nav-config-resolve.ts + test; org-menu.ts router; RLS exception registered
D7 filter law on every card kind Landed filterbar-scope.py extended; dashboard-widget-filter.test.ts