On this page
- Status: Accepted (operator directive, deck-parity round 2, 2026-08-12 → 2026-08-13; shipped to prod).
- Date: 2026-08-14 (recorded after the fact; the mechanism landed commit-by-commit 2026-08-12/13).
- Owners: Platform (Audience CI programme).
- Related: extends §81 and ADR 0023 (taxonomy is catalog DATA) from vocabulary to presentation; companions ADR 0022, ADR 0024, ADR 0025; reconciliation contract §49/§53/§55.
Context#
Five delivered Content Intelligence decks (ACB, IVF Hồng Ngọc, Omo, Pfizer RSV, Heineken C1) must
match the client's ORIGINAL vendor artefact — wording, tab set, KPI row, chart shapes, row counts —
not the platform's defaults. Those differences are editorial choices per client (a deck prints eight
master topics because an analyst chose eight; IVF's cover opens on four KPI tiles the default row
has no tile for). §81 forbids per-client TypeScript, and the generator's data-driven defaults are
the right answer for a fresh org and the wrong answer for a delivered artefact. The first parity
round tried to close the gap inside the generator's heuristics and failed review
(deck-layout-original-parity): heuristics cannot recover editorial intent.
Decisions#
D1 — One JSONB presentation document per dataset
content_datasets.deck_presentation (JSONB, nullable) holds the delivered deck's own presentation
facts. ONE Zod schema owns the shape: deckPresentationSchema
(apps/web/src/server/deck-presentation.ts, .strict()), documented field-by-field in its
docstrings — verbatim wording (widgetTitles/widgetSubtitles/columnLabels/tabLabels/
tabSubtitles/unscoredCaptionVi), receipted cuts (suppressWidgetKeys/suppressTabs/
widgetTopN), scope and axis declarations (segmentAxisDimKey, overviewDimKeys,
eligibleOnlyDims, windowShareDims, entityScopeDimKey, hierarchy, evidenceColumns), shape
overrides (chartOverrides, overviewTrend), the cover KPI row (kpis), and the narrative block
classification (blockKinds: static|insight). The generator consumes it at PLAN time; every
suppression/cut remains visible in the deck receipt.
D2 — Presentation declares WHICH numbers, never the numbers
A kpis entry names a stat kind (AUDIENCE_STAT_KINDS: mentions, dim_value_count,
sentiment_score, top_platform, top_platform_share) plus its parameters
(dimKey, minValueMentions) and verbatim label. The FIGURE always comes from the
audience_stat_tile resolver over §49 readers at render time. A figure typed into the document
would be a fabricated KPI (§32/§35) and is unrepresentable in the schema.
D3 — Write path validates loudly; read path degrades safely
contentDecks.updatePresentation is the ONE write path (ADR 0031); the handoff file lands through
scripts/onboarding/apply-deck-presentation.ts, a transport over that procedure holding the same
expectedUpdatedAt lock, and rejects an invalid document. The read path (parseDeckPresentationLenient,
2026-09-02) STRIPS unknown top-level keys and refuses only a document whose known fields are invalid, so a
schema evolution never bricks a regen; the brand mask reads brandMask.enabled off the raw document and
fails closed, so an unreadable sibling field can never un-mask a public share. The writer PRESERVES blockKinds when the handoff document omits it — that map is co-owned
by scripts/onboarding/seed-insight-markdown.ts, which writes it from each seed's kind:
frontmatter in the same run that publishes the prose, so key and ref can never drift.
D4 — Even derived dimensions are DATA
A vendor rollup the corpus does not carry (Heineken's 6 master topics over 18 sub-topics) is
materialized as a real catalog dimension + values + one bridge row per mention by
scripts/maintenance/derive-rollup-dimension.ts from a spec JSON — never a mapping the generator
knows. The corpus then answers through the SAME readers as every native dimension.
D5 — Parity is oracle-anchored, not eyeballed
scripts/onboarding/verify-ci-deck-ground-truth.ts compares the DB's readers against numbers
extracted from the client's OWN delivered artefact (external oracle files, §55; operator-local,
gitignored) at TOLERANCE=0. v3 also compares the declared KPI row through the SAME
audience_stat_tile resolver prod renders — never a formula re-derived in the runner (§49). Every
SKIP is named with its rule; a vendorVariance records an adjudicated counting-rule disagreement
while still pinning our side exactly. This is the Tier-B delivery gate (never CI; see the area
map's gate section).
Consequences#
- Client #6 onboards with a spec + taxonomy + presentation document and zero TypeScript — the §81 promise now covers what the deck says and shows, not only what it counts.
- The presentation document is part of the delivery artefact set: regenerating a deck without
re-applying presentation silently reverts to platform defaults. The regen order is therefore
fixed and runbooked (
docs/runbooks/ci-deck-delivery.md). - New editorial needs extend the SCHEMA (new optional field + docstring + generator consumption), never a per-client branch. A field that would carry a literal figure is rejected on review (D2).
Implementation status (declared 2026-08-14)#
| Decision | Status | Evidence |
|---|---|---|
| D1 schema + column | Landed | deck- (v1, strict); content_ (packages/); generator consumption across content- |
| D2 KPI row via resolver | Landed | AUDIENCE_ + audience_ (widget-config/registry + datasets registry); prod decks IVF/OMO/HEI render declared rows |
| D3 write/read split | Landed | apply- (transport over update, preserves blockKinds); parseDeckPresentation strips unknown keys; mask fails closed |
| D8 bilingual wording | Landed | 2026-09-02: rows carry name_/label_/subtitle_/title_ (migration 0184) and the document carries deckNameEn/tabLabelsEn/tabSubtitles/widget so a regen keeps them; editor saves write through under the same lock; localized resolves by locale, Vietnamese is the source of truth |
| D3 amended 2026-08-20 | Landed | A SECOND writer, ADR 0031: content shares this one's schema and orphan resolver (deck-); blockKinds preservation is now a property of field patching, not a special case |
| D4 derived rollup dims | Landed | derive-; HEI master_ (30,169 bridge rows, 6/6 values match the vendor deck exactly) |
| D5 oracle-anchored parity | Landed | verify- v3 (counts + KPI row); prod ×5: 267 checks / 0 fail (2026-08-13); KPI branch closes the §53/§55 class-of-bug debt |
| D1 amended 2026-09-03 | Landed | P2-10 — the document is v2: one entry per ADDRESS (widgets[widget, tabs[tabKey], blocks[blockRef], plus deck and the non-keyed top level) instead of fifty flat fields, ~20 of them a parallel widget* map. A new per-client convention is now a LEAF on one of those shapes, so it inherits the key space, the orphan sweep and the patch semantics instead of costing a field + a sweep line + two audit entries. migrate upcasts a stored v1 document losslessly and every reader consumes v2; parity is pinned byte-for-byte against the pre-change generator plan (_), and the two stored prod documents' shapes round-trip v1 → v2 → v1 (deck-). Stored rows are upcast in place by scripts/ |