Skip to content
MSO CloudDocumentation

ADR 0007 — Demo posture: identity masking, trust tiers, self-correction, validation agenda (ACCEPTED)

On this page
  • Status: Accepted for display masking; amended 2026-07-15 to retire customer-derived demo archives; amended 2026-09-18, superseded in scope by ADR 0051 (see "Amendment 2026-09-18")
  • Date: 2026-06-25
  • Related: ADR 0006 (MI Expert Views — shipped), ADR 0006 §F10 + socialheat-sample-data.md (social plane), CLAUDE.md §44 (store verbatim / mask at display), §32/§35 (no fabricated KPI), §57 (MI guarded by e2e), §58 (chat market gating). Story: docs/MSO-UCIP-Roadmap/mso-08-demo-storyboard.html, mso-09-screen-mockups.html.

2026-07-15 security amendment: display masking remains accepted as defense in depth, but it is not anonymization. The historical masked export/import utilities are quarantined and fail closed because they disabled database enforcement and moved customer-derived data through local archives. External demos must use synthetic fixtures. Tenant recovery uses ADR 0011 and its artifacts must never be repurposed as demo data.

Shipped surfaces (file map).

  • D1 — display-only identity masking (§44). Single source maskLabel() + createMasker() in packages/ui/src/mask-label.ts (kinds: self-brand / brand / competitor / shop / product / creator / org). Resolved per-request by getDemoMask(orgId) (market-intel-trends.ts) from the new market_intel_settings.demo_mask column (migration 0067). Applied SERVER-SIDE at the tRPC return boundary across market-intel.ts (overview / benchmarkTriad / livestream / competitors.{list,suggestions,searchShops} / socialReport), market-intel-trends.ts (competitorTrends / creatorMomentum / productOpportunities), market-intel-signals.ts (signals), offtake.ts (models / signals / decisions — brand alias + free-text scrub; calibration masks only the RETURNED name, never the lookup input), the chat plane (chat/tools/market.ts via the same exported helpers + chat/breakdowns.ts + the system-prompt guard in chat/tools.ts + getDemoMask in api/chat/route.ts), AND the chrome org/brand switcher ((dashboard)/layout.tsx). Toggle UI on /admin/orgs/<slug>/market-intelligence (SUPER ADMIN only; updateDemoMask hard-fails a non-super-admin). Amended 2026-08-05 by operator directive — it previously sat on the org-facing /market-intelligence/data page for owner/org-admin. Masking is a posture the platform sets ABOUT a tenant, not a preference the tenant sets for itself: whoever runs the demo controls what its audience sees, so an org admin must not be able to stage or unmask their own org. Categories are NOT masked (generic market vocabulary).
  • D2 — trust tiers. TrustTierBadge (packages/ui/src/components/trust-tier-badge.tsx) — proven / illustrative / to_validate; legend on the diagnostic report; the social panel tags buzz→đơn proven, the sample SocialHeat figures illustrative.
  • D3 — SocialHeat report plane. social_intel_* migrated (0066), seeded by scripts/seed-socialheat-demo.ts (generator re-anchored to the 2026 timeline; Spearman 0.564 preserved); marketIntel.socialReport + market-social-report-card.tsx (bị ghét? / buzz→đơn? / độ phủ) under D1 masking + D2 tiers.
  • D4 — self-correction beat. seedDemoSelfCorrection() (in offtake-loop.ts, §60-compliant single writer) seeds ONE over-confident MISS + lesson; visible on the Measure Spine (TRƯỢT −29.6%) and the calibration track-record.
  • D5 — levers as ACTIONS. LEVER_ACTION_VI map; decisionTextVi/buildOptions/rationaleVi + the proposed-inbox text reframed so a proposal reads as a controllable action and the buzz lever is the INPUT SIGNAL ("Tín hiệu dẫn:").
  • D6 — validation agenda. market-validation-agenda-card.tsx — the 8-week co-build plan at the end of the diagnostic report.
  • Social Intelligence deep-view (follow-on, approach A). A dedicated PROVENANCE surface — /market-intelligence/social (market-social-view.tsx) + a "Social" tab — answering "phân tích này từ đâu ra?": a provenance card (the off-take buzz→đơn lead-lag the loop learned, as aligned sparklines + corr/lead/confidence, with CTAs INTO the Decision Inbox + Measure Spine) plus the full reused social-report evidence. Bidirectional links: the MI report's social panel → deep-view; the Decision Inbox → deep-view. It is the social-evidence LENS of MI (reuses the market_intelligence page gate), NOT a parallel top-level section — keeps social as the evidence behind decisions, 3rd-party/estimate-labelled, identity-masked at source. e2e-guarded in market-intel.spec.ts.
  • Multi-sàn "vì sao" (extension). The diagnostic spine is now the TOTAL business across all sàn (Shopee + TTS + Lazada — the dominant Shopee was previously hidden behind a TTS default): decomposition aggregates 1P across platforms (ownDecompInputs/ownTrafficViews accept 'all'), and a new marketIntel.platformContribution + market-platform-contribution-card.tsx ("Sàn nào kéo/đẩy?") localizes the total move BY sàn (per-sàn ΔGMV that sums to 100% of the total Δ, mix shift, main-driver pill). Pure 1P; platform labels are generic (not masked). The market estimate (Kalodata) stays per-sàn — Shopee is structurally category/product/shop only (F0), so it gets full diagnostic coverage via the 1P multi-sàn analysis, never fabricated market columns (§32/§35).
  • Historical distributable-demo path — retired. The 2026-06 masked archive implementation and its verification evidence are preserved as incident history, not operator guidance. The commands now fail closed; synthetic fixtures are the only supported demo-data source.

1. Context#

Next week the team presents the MSO concept as a live demo on UCIP. Two hard framing rules from the founders:

  1. It illustrates that the method (analyse → decide → learn) is REAL and realizable on UCIP — it is NOT a claim of past work for a named client.
  2. Every identity must be masked — brand, product, competitor, shop, creator — so a viewer cannot tell whose data it is.

From the decision-systems review (recalibrated for a demo-to-persuade that opens a co-build): the buzz→sales mechanism is internally proven; the playbook is grounded in Buzzmetrics practice + expert interviews; SocialHeat numbers shown are sample data illustrating a proven method. The differentiator vs "another AI dashboard" is epistemic honesty + a visible learning loop — so the demo should foreground that, not hide it, and must avoid over-claiming causation (which would break credibility in week 3 of the co-build).

2. Decision#

Add a thin demo-posture layer over the already-shipped MI/MSO surfaces. No new analysis engines; this is masking + labelling + one seeded self-correction + a co-build CTA.

3. Build items (do in order; each shippable)#

  • D1 — Identity masking mode (display-only, §44). A demoMask switch (org setting market_intel_settings.demo_mask + URL/role override). When ON, ALL brand/product/competitor/shop/creator display names are replaced by deterministic, stable aliases via one shared maskLabel() helper (single source): self-brand → "Nhãn A"; competitors → "Đối thủ B/C/D…" by rank; SKUs → "SP-01…"; creators → "Creator #1…"; shop/org names hidden. Underlying rows stay verbatim (§44 — masking is display-only; never write masked values). Applies to every MI page, the MSO decision/measure surfaces, AND chat output. Acceptance: e2e asserts no real identity string renders on any MI/MSO/chat surface when demoMask on; the toggle flips live without reload issues.

  • D2 — Three trust-tier badges. Every datum/section on the diagnostic report carries a tier: proven (mechanism kiểm nội bộ, e.g. buzz→đơn), illustrative (số mẫu / sample), to_validate (giả thuyết chờ kiểm trên data khách). A one-line legend. An illustrative number must NEVER render without its badge (extends §35 honesty). Acceptance: social panel + recommendation + any seeded-sample figure show the correct tier.

  • D3 — Wire the SocialHeat report plane (ADR 0006 §F10). Migrate social_intel_{snapshots,topics,brands,topic_months} (pnpm --filter @yng/schema db:generate), run the generator + scripts/seed-socialheat-demo.ts, add marketIntel.socialReport (brandProcedure) and the 3-question social panel in the diagnostic report: (a) có bị ghét không? (self-brand sentiment + verdict), (b) buzz có kéo đơn? (off-take correlation + demand-topic growth), (c) độ phủ (SOV + 12-month trajectory + unmet needs). Rendered under D1 masking + D2 tiers. Acceptance: panel renders masked + non-empty (e2e); numbers match the generator's verification.

  • D4 — Self-correction beat (demoable). Seed at least ONE decision whose outcome missed, with a recorded lesson, so the lever's confidence/weight visibly drops on the track-record / Measure surface. The demo must show the loop correcting itself, not only winning — this is the single most persuasive proof for a skeptical buyer that the loop is real. Acceptance: Measure/track-record shows ≥1 miss → down-weight, alongside the wins.

  • D5 — Levers framed as ACTIONS, not raw buzz categories. On the suggest/decide surfaces, present controllable actions (kích hoạt creator / loại nội dung / bundle / độ sâu promo / ngân sách), mapping observed social signals → suggested actions. Never ask the user to "đẩy objectmention". _Acceptance: Decision Inbox proposals read as actions; the off-take buzz lever is shown as an input signal, not as the thing to "push".

  • D6 — Validation-agenda panel. A small panel (demo home or end of the diagnostic report) showing the 8-week co-build plan (connector → baseline → randomized lever + holdout → measure incremental → learn). Frames the demo as method-proof + an invitation to co-build, not a finished oracle. Copy in mso-08 closing. Acceptance: panel renders; links the demo to a concrete learning agenda.

4. Invariants & guards#

  • §44: mask at display, store verbatim — maskLabel() is the only place names are aliased; no masked value is ever persisted.
  • §32/§35: 1P KPIs never fabricated; every illustrative/sample number carries the illustrative tier badge (D2).
  • is_sample=true on all seeded demo rows; reversible.
  • §57: guard the new/altered surfaces behaviourally (e2e: masked render, social panel non-empty, ≥1 self-correction visible) — not a reconciliation assertion.
  • DoD: pnpm run verify + pnpm --filter @yng/web build green; db:generate migration committed; browser-verify the masked demo end-to-end.

5. Out of scope — maturity ladder (AFTER the customer commits, NOT demo work)#

The full causal/decision stack from the review is the post-commit roadmap, deliberately excluded from the 1-week demo: per-lever causal tiers + holdout everywhere it's randomizable; decisions by expected value + value-of-information; multi-hypothesis posteriors; effect sizes/CIs + multiple-testing control; hierarchical pooling across brands; pre-commit decision hygiene. Sell these as the maturity ladder; do not build them now.

6. Full-flow QA review + the masking boundary (2026-06-25)#

This section preserves the June 2026 review evidence. Its former archive-based demo guidance is superseded by the 2026-07-15 amendment above.

An adversarial expert walkthrough of every demo screen under the live demoMask toggle. Verdict: all 7 MI tabs (overview/trends/competitors/creators/products/livestream/social), the MSO loop (off-take overview / Decision Inbox / Measure Spine), and the Social deep-view render masked + coherent with zero brand-identity leaks (Org DEMO, Nhãn A, Đối thủ B–Z, SP-NN, Creator #N, Live #N). Four issues found + fixed:

  • The masking boundary (the one structural finding). D1 demoMask is display-only over the MI/MSO/chat/chrome surfaces — it does NOT cover the 1st-party report pages (/reports/sku-performance, creator-performance, livestream-performance) or the directory/dashboard surfaces, which read product/creator names straight from reports.ts/directories. A customer tenant, masked or not, must not be presented externally as demo data. Use synthetic fixtures whose entire navigation surface is safe by construction.
  • Historical exporter defect. The retired exporter initially allowed third-party creator names/handles to survive its token scrub. A later residue assertion reported 2,810/2,810 creator aliases, but that did not establish anonymization or make archive distribution safe. This incident is one reason the exporter is now quarantined.
  • Decomposition scope label. The spine aggregates ALL sàn but the Sàn selector reads "TikTok Shop" — a skeptic could think the spine is TTS-scoped. Added a Tất cả sàn / All channels badge on market-decomposition-card.tsx (driven by decomposition.scope === 'all').
  • Self-correction now reads as calibration, not failure. The track-record showed Tỷ lệ trúng 0% (a miss + a partial, no win) — a skeptic sees "the loop is never right". seedDemoSelfCorrection() now seeds ONE companion WIN alongside the miss (a recalibrated late-May decision at 62% confidence whose measured is REAL orders and landed +3% vs forecast). Same §60b single-writer, is_sample, idempotent. Result: Tỷ lệ trúng 33% with a monotonic calibration curve (claimed 0-20% → 0% actual; claimed 60-80% → 50% actual) — the "epistemic honesty + visible learning loop" the demo sells, far more credible than 0%.
  • Demand-topic alias collision. A SocialHeat demand topic read "Cấp ẩm (dòng chủ lực Brand A)" — literal "Brand A" (topics render verbatim, not masked) clashing with the SOV self-brand alias "Nhãn A". Dropped the brand ref → "Cấp ẩm (dòng chủ lực)" in the generator; regenerated + reseeded (Spearman 0.564 preserved).

Re-verified: pnpm run verify green (verify:data 17/0 — frozen oracle 120,489,955 intact; fabricated-multiplier / offtake-single-source / i18n-sync all green), 14/14 market-intel.spec.ts e2e (the one cold-compile flake passes warm). Live demo_mask reverted to false (opt-in default).

7. Slop purge + decision-loop integrity (operator feedback, 2026-06-25)#

Operator review rejected on-screen META copy and asked for a credible decision loop. Two workstreams, both shipped.

(a) AI-slop purge — the product shows analysis + data, never commentary about the demo/sales/build process. Removed entirely: the D6 validation-agenda panel (MarketValidationAgendaCard + its va*/validationAgenda* i18n + the maturity-ladder close "Sau khi khách đồng ý: nấc trưởng thành…"), the "Giới hạn trung thực" honest-limits essay panel (honestGap*), and the inline trust-tier essay tooltips (trustTier*Info — terse proven/illustrative/to-validate badges KEPT). Trimmed essay tails to terse functional copy: mso.measureDescription ("Không số nào mồ côi"), mso.diagHint ("Mô tả hiện trạng không phải dự báo"), mso.calibrationHint ("đủ tin để xem bức tranh"), marketIntel.socialReportInfo/socialViewDesc, actionQueue.description ("Lớp ACT+LEARN"), the commerce-performance header ("để kiểm thử dữ liệu mẫu"), plugins.decisionIntelligence.description tagline. New class-of-bug guard: extended scripts/audit/no-ai-slop-copy.py (§38) with demo/sales-process/roadmap META tokens (co-build / maturity ladder / multi-hypothesis posterior / holdout everywhere / cùng xây / nấc trưởng thành / minh hoạ phương pháp / sau khi khách đồng ý …) so the agenda copy — which slipped past the old token list — can't creep back.

(b) Decision-loop integrity (4 asks). (1) Recommendations grounded in REAL history — the off-take proposal rationale now references the brand's most recent measured outcome ("Tham chiếu lịch sử: lần gần nhất (6.6'26) đẩy Bài đăng KOC lệch vừa (lệch 19%)"), read from recs and emitted ONLY when a real row exists (no fabrication). (2) Richer decision detail — the DecisionDetailDrawer now renders the previously-hidden contextSnapshot (corr / confidence / weeks / discount cap), the options trade-off table (Impact·Cost·Speed·Risk, ★ recommended), calibrationBucket + incrementalValue. (3) Owner-confirmed verdicts (§safety) — new decision_outcomes.confirmed_verdict/confirmed_by/confirmed_at (migration 0068); the machine verdict is a PROPOSAL until an owner/admin confirms via offtakeRouter.confirmOutcome (owner-gated requireOwnerOrOrgAdmin + rate-limited + .update, NOT .insert → the §60b single-writer seam approve already uses); trackRecord counts only confirmed_at IS NOT NULL. Demo seeds confirm the history (latest per brand left PENDING — confirmSeededDemoOutcomes) so the track-record is populated AND the confirm flow is demoable. (4) Validation-due ping — pingOfftakeValidationDue writes an in-app alert_events row (deduped via SELECT-then-insert, §25; alert_events is NOT a §60b table) when a decision's campaign-week window (ICT, §34) elapses while still unconfirmed; runs in the weekly outcome-review worker + the demo seed; confirmOutcome acks the ping. Re-verified: pnpm run verify 17/0 (#14a/b/c MSO + oracle intact), pnpm --filter @yng/web build green, 14/14 e2e, browser-verified (MI report slop gone; track-record 50% confirmed + "1 chờ xác nhận"; drawer confirm flow live — June 1 confirm set confirmed_by + acked the ping).


Paste for Claude Code: Read docs/adr/0007-demo-posture-and-masking.md and execute D1→D6 in order on top of the shipped ADR-0006 surfaces. D1 (identity masking via one maskLabel() helper, display-only per §44) and D3 (wire the social plane: db:generate + seed + marketIntel.socialReport + the 3-question panel) first. Keep §32/§35/§44/§57 invariants; everything seeded is_sample. Each item: pnpm run verify + browser-verify the masked demo before the next. Do not build the §5 roadmap items.

Amendment 2026-09-18 — superseded in scope by ADR 0051#

The demo_mask boolean, its positional maskLabel() scheme and its two standing rules (a masked value is never persisted and never reused as a lookup key) are unchanged and remain the PLATFORM posture a super admin sets about a tenant. What changed is that it is no longer the only masking an org has: ADR 0051 adds a tenant-curated term registry with per-role scope, and both now resolve through ONE posture (@yng/mask resolveMaskPosture) that every surface carries. The blanket wins over the registry and both lose to an explicit override; an org with no registry rows behaves exactly as this ADR describes. The DEMO_DISPLAY_MASKING environment flag this ADR's display masker relied on is ratcheted to a shrinking list of call sites, and the hardcoded customer term list that decided filename sensitivity is deleted. The boundary finding recorded in section 6 — that masking did not cover the 1st-party report, directory and export surfaces — is closed by ADR 0051 D3 and its per-surface leak tests.