On this page
- Status: Accepted (2026-07-31) — after a 4-stream research pass (measure-spine internals, CRM/lead/conversion data model, how comparable products define conversions, admin-playbook UX) and an operator directive.
- Date: 2026-07-31
- Context owner: Platform / Decision Engine (MSO)
- Related: ADR 0021 (plan↔measurement bindings), ADR 0026 (metric semantic layer), ADR 0018 (marketing audit plane), ADR 0004 (off-take loop). CLAUDE.md §2 §32 §35 §49 §53 §60.
The incident / directive (why this ADR exists)#
The Measure Spine (§60) measured a decision's outcome only on commerce orders
(measureActualForMetric supports gmv_vnd|orders|aov, reading SUM(orders.gmv_vnd) /
COUNT(orders)). A previous analysis concluded that a marketing-only org (e.g. YouNet Media,
which has no orders — its funnel ends at MQL/leads) therefore "cannot close the measure→learn
loop," so marketing findings stay diagnostic alerts.
The operator corrected this, and is right: the measurable outcome is a CONVERSION, and a conversion
is not always an order. For a marketing org a conversion is a Lead / Deal / Contract (with
value); ad platforms themselves let you define the target conversion as money-value, order-count,
or a registration count. Hard-wiring measurement to orders is the defect. The user must be able to
DEFINE which event counts as the org's conversion, exactly as GA4 "key events", Google Ads
"conversion actions", Meta "custom conversions", and HubSpot "deal stages" all do.
Decision#
A conversion is a definable, per-org measure — and the Measure Spine measures a decision's outcome
against the org's chosen conversion, not against orders.
D1 — Conversion = a curated, measurable metric the org points at (GA4 "key event" model, not free SQL)
Each org (brand override is a future evolution — see Consequences) selects its primary conversion
from a curated allowlist of measurable conversion metrics, each of which maps to a REAL
single-source reader that already exists (§49 — no new ground truth, no per-conversion if):
| conversion slug | meaning | source (single-source reader) | value mode |
|---|---|---|---|
gmv_ |
commerce revenue (VND) | orders. (unchanged) |
value |
orders |
commerce order count | COUNT(orders) (unchanged) |
count |
aov |
avg order value | orders (unchanged) |
value/count |
leads |
MQL count (junk excluded) | crm_ via marketing- (§49) |
count |
deals |
won-deal count | crm_ (stage_) |
count |
deal_ |
won-deal value (VND) | crm_ |
value |
The allowlist is a compiled registry CONVERSION_METRICS (slug → { label vi/en, valueMode: 'count'|'value', reader }). Adding a conversion = add a reader + one registry row (a deliberate,
reviewable change), NOT arbitrary user-authored SQL over event tables (rejected as an over-engineered
security surface — see Alternatives). This is the GA4 "pick a key event", not "write a query".
Value-vs-count is explicit (the universal switch every ad platform exposes): a count-only
conversion (leads — YNM's MQL carries no opportunity_vnd) renders count + cost-per-conversion;
CPA/ROAS-with-value render only when valueMode='value' and spend is present, gated behind a mode
discriminator (§32/§35) — never a fabricated value.
D2 — Storage: one per-org pointer where the decision-engine settings already live
market_intel_settings already holds the org's decision-engine config (the verdict thresholds
resolveVerdictThresholds reads). Add conversion_metric_slug varchar(64) NULL there. NULL
= the historical default gmv_vnd (commerce), so every existing org is byte-identical after the
migration. YouNet Media is set to leads.
D3 — Generalize the Measure Spine ADDITIVELY (commerce path unchanged)
The hard-wiring lives in exactly two places (offtake.ts:552 + offtake-loop.ts:3810). Introduce
ONE resolver resolveConversionActual(orgId, brandId, metricSlug, window) that returns the
measured actual for the decision's window:
- commerce slugs (
gmv_vnd|orders|aov) → the existingordersSQL +measureActualForMetric, behaviour byte-identical (commerce reconciliation must not move); leads→ themarketing-leads.tssingle-source MQL count over[exec_start, eval_date]ICT (§34/§41), brand-scoped — NEVER a second lead count;deals/deal_value→crm_dealssingle-source over the window.
computeOutcomeVerdict is already metric-agnostic (§60a) — unchanged. VALIDATION_METRIC_SLUGS
- the rule
measureSpecSchemaenum widen to include the new conversions, so a playbook rule may declaremeasure.metricSlug:'leads'. A decision with no owner target still abstains (honest).
D4 — Honesty: pre/post on a defined conversion is DIRECTIONAL, not causal
Measuring leads before/after a decision, absent a holdout, is descriptive pre/post — the honest-
measurement ladder (pre/post < holdout < geo). It is labelled by evidence tier (L-low), never sold as
identified causal lift; it abstains when there is no defensible baseline (the existing basis/
incremental abstain, §32/§35). This closes the learning loop (calibration of forecasts vs
outcomes) without overclaiming incrementality.
D5 — Governance (the class-of-bug guard, §53)
- The root Marketing-pillar invariant "Lift is always measured on
orders" is revised by this ADR to "a decision's outcome is measured on the org's DEFINED conversion; commerce lift stays onorders." (packages/metrics/CLAUDE.md updated.) - Commerce reconciliation
#16d/#14ckeep theirgmv_vnd-only +ordersrecompute intact (leads decisions are scoped out by metric). A NEWdata-reconciliationassertion verifies aleadsdecision'smeasured_value == the marketing-leads single-source MQL countfor its window (headline == source, §51/§53).conversion-metric-single-source.py(audit:all) asserts everyCONVERSION_METRICSslug has a reader and every reader is the §49 single source (no second count).
D6 — Marketing findings become MEASURABLE decisions (revises ADR 0018 D4, opt-in)
Now that a marketing outcome is measurable on the org's conversion, a marketing
audit finding CAN be a decision an owner approves and the Measure Spine grades —
so audit_alert becomes action-bearing (ACTION_BEARING_ACTION_VI). This is
opt-in: createMarketingAuditProposals mints proposals ONLY for an org that
DEFINED a conversion (else mode: 'conversion_not_configured', zero decisions),
so ADR 0018 D4's read-only alert posture stays the DEFAULT. Each proposal is
measured on the org's conversion with a directional target = the org's
conversion in the SCAN window (the "before" level); after the owner executes, the
Measure Spine compares the post-window conversion (honest pre/post per D4, never
causal). The owner-triggered scanAndPropose mutation (owner-gated, audit-logged
mso.decision.propose, §64) turns the diagnostic scan into inbox proposals. So a
marketing org's loop now closes: scan → suggestion → decision → measure → learn.
Alternatives considered (the debate, recorded)#
- Free-form measure spec (source table + arbitrary predicate + aggregation), à la dbt
conversionmetric. The most general form (research stream 4). Deferred, not adopted now: arbitrary user predicates over event tables is a large correctness + security + RLS surface, and YNM (and every near-term tenant) is fully served by the curated allowlist. Recorded as the next evolution step in the roadmap; the registry is shaped so a futuresource+predicate+aggregation+valueCol+windowspec slots in behind the same resolver. - A
primary_conversionper ad-platform/campaign. Ad platforms' own target conversion is already ingested data (ad_spend_daily.conversions|leads|conversion_value_vnd) — that is the platform's optimization target, a DIFFERENT concept from the org's decision-measurement conversion. Kept distinct; not conflated. - Measure marketing on platform-reported conversions. Rejected — platform conversions are
platform-attributed and not cross-summable (CLAUDE.md marketing pillar); the org's OWN CRM
(
crm_leads/crm_deals) is the first-party truth, same posture asordersfor commerce. - Leave marketing as alerts (the prior conclusion). Rejected by the operator and on merit — it hard-wired a commerce assumption into a domain-general engine.
Consequences#
- A marketing org's decisions become measurable on its own conversion (YNM: MQL), so the full signal → scan → playbook suggestion → decision → measure → learn loop closes for marketing — honestly labelled as directional pre/post until a holdout exists.
- Every existing commerce org is unchanged (
NULLslug =gmv_vnd; commerce reconciliation frozen). - Adding a conversion is a curated registry + reader change (reviewable), not user SQL.
- Owed by D5: the new reconciliation assertion + the coverage audit + the revised CLAUDE.md invariant.
Implementation status (landed 2026-07-31)#
| Decision | Status | Evidence (as shipped) |
|---|---|---|
| D1 conversion registry | Landed | CONVERSION_ (packages/) — 6 slugs, value-vs-count valueMode, source + labels; exhaustive slug tuple |
| D2 storage pointer | Landed | market_ (migration 0132, NULL=gmv_vnd → every org byte-identical) |
| D3 measure-spine resolver | Landed | resolve (offtake-loop.ts) — commerce byte-identical; leads via buildMqlCountSql (§49); deals/deal_ via won crm_; measure/authoring widened to CONVERSION_ |
| D4 honesty labelling | Landed | incremental-basis abstain applies to every source first; no CRM feed → abstain (null), never a fabricated 0 |
| D5 governance | Landed | reconciliation #16e (measured == independent source recompute) + #16d scoped to commerce; conversion- in audit:all; CLAUDE.md marketing invariant revised |
Acceptance proof (gate DB, 2026-07-31). A marketing org with conversion_metric_slug='leads',
12 non-junk MQL in crm_leads over the window, and an activated leads decision (target 10):
measureActivatedDecisions measured 12 (the MQL single-source count) → computeOutcomeVerdict
(metric-agnostic) → verdict partial, varianceBp +1667 (16.67%, above the 15% hit threshold).
decision_outcomes written. The commerce path is untouched (same orders SQL + measureActualForMetric).