# From list price to revenue and renewals: protocol

A further question on the same synthetic company, the same generator, the same seed and the same three dbt projects
as `DESIGN.md`, `DESIGN-realization.md` and `DESIGN-lifecycle.md`. Sections 1 to 9 are the declaration. They were
written after reading the published pages and the generator's code, and after counting (not measuring) the
contracts: 108 contracts, of which 23 reached a renewal decision inside the simulated period, 11 of them with a
discount of 15% or more and 12 with 10% or less. No model, check, control or analysis code for this round existed
when they were written, and no figure in sections 7 and 8 had been computed. `tests/test_pricing.py` pins their
sha256; a later change goes in a new section at the end headed `## Amendment N: <what changed>`.

Nothing in the earlier protocols, their results files, their dbt projects or their pages changes. This round writes
its own results file, `results-pricing.json`, and its own page.

## 1. Questions

The price realization page measures list price against what customers paid, by segment and motion, and the cohort's
retention bridge; the lifecycle page splits that bridge by motion. Neither answers these:

1. **To revenue.** For each motion and segment, how does the measured year's realized value (list price less
   discounts and credits) become the revenue the study recognises, line by line, and does that walk tie exactly to the
   study's own walk from ARR to recognised revenue and to its revenue model?
2. **Price or volume.** In the cohort's retention bridge by motion (the lifecycle page's), how much of expansion and
   contraction came from price (list changes at renewal, scheduled ramp steps, the price difference when a seat plan
   moves to a contract, and discount changes) and how much from volume (seats)?
3. **Discounts and renewals.** Do contracts signed at a deeper discount renew more often here, and how many renewal
   decisions would a company need before such a link could be seen at all?

Gross margin stays out of scope: the generator has no costs, and inventing them would not be honest.

## 2. Terms

- **Measured year, starting point, ending point, cohort, list value, realized value:** exactly as in
  `DESIGN-realization.md` section 2 (the last 12 of the 18 reported months; ARR on the last day before it and on its
  last day; customer keys with ARR above zero at the starting point).
- **Recognised revenue:** the main project's revenue model (`fct_revenue_monthly`, the version 2 recognition policy)
  summed over the measured year's 12 months, split by motion and segment at the line it comes from: card subscriptions
  to self-serve, contracts (recurring, onboarding fees and credits) to sales-led by the account's segment, usage rows
  to usage.
- **Deep and shallow discount:** a contract's discount at signing, 15% or more (deep) or 10% or less (shallow). The
  generator's discount table (0, 0, 5, 10, 10, 15, 20, 25) splits there.
- **Renewal decision:** a contract whose service ends before the last day of the data. It **renewed** when a contract
  of opportunity type renewal on the same CRM account starts the day after it ends.

## 3. The walk from realized value to recognised revenue (question 1)

Per motion and segment, over the measured year, each line computed from its own source:

| Line | What it is | Source |
|---|---|---|
| Realized value | list value less discounts and credits | `realization.fct_price_realization`, read as published |
| Day weighting | daily ARR weighted as one twelfth of a year per month (each day 1/(12 x days in its month)) instead of 1/365 per day | `int_arr_line_monthly` against the daily spine `int_arr_daily` |
| Month length | each charge recognised over its own billing period instead of at the ARR rate (the study walk's line of that name) | `int_arr_line_monthly` |
| Straight-lining | the version 2 policy's contract revenue less each charge over its own period | `int_contract_revenue` against `int_contract_recognition` |
| Usage timing | usage revenue recognised in the year's usage months less usage invoiced for periods starting in the year | `int_usage_rows` against the invoice lines |
| Onboarding fees | one-off fees, recognised under the version 2 policy | `int_contract_revenue` |
| Recognised revenue | the revenue model's streams for the 12 months | the main project's revenue models |

Credits are in both realized value and recognised revenue (the same notes, issued in the year), so they need no line.

## 4. Price and volume in the retention bridge (question 2)

For each cohort customer key, motion (self-serve or sales-led) and month of the measured year in which the monthly
bridge records expansion or contraction, compare the customer's lines in that motion at the previous and the current
month end (for the month a seat plan moves to a contract, the previous month's seat plan lines). With list ARR L and
realized ARR R at each end, and realization r = R / L:

- **list effect** = (L1 less L0) x r0, the change at the old realization;
- **discount effect** = (R1 less R0) less the list effect, that is L1 x (r1 less r0).

The list effect is filed by cause, from the lines' identities:

| Cause | Motion | When |
|---|---|---|
| Seats | self-serve | the same subscriptions at both ends |
| Plan replaced | self-serve | the subscriptions differ (a new plan replaced an old one) |
| Ramp step | sales-led | the same contracts at both ends |
| Renewal list change | sales-led | the contracts differ, not a move from a seat plan |
| Move to a contract | sales-led | the month a seat plan moves to a contract |

The discount effect is filed by the same cause. Expansion is reported as the sum of positive moves and contraction as
the sum of negative ones, exactly as the monthly bridge records them, so each motion's components add up to the
lifecycle page's bridge by motion (`lifecycle.fct_nrr_bridge_by_motion`, read as published). Usage has no list price
change (the run price is fixed), so usage change is volume by definition.

For contracts the data holds only an annual list value, so a renewal's list change cannot be split into price per
seat and seats. The page says so where it reports it.

Reported, not checked: each motion's net revenue retention without its price causes (ending ARR less the list and
discount effects of ramp steps, renewal list changes and moves to a contract, over starting ARR).

## 5. Discounts and renewals (question 3)

**The company's own book.** Every renewal decision in the data, by deep and shallow discount: decisions, renewals,
renewal rate, and the difference (deep less shallow) with a 95% interval (Newcombe's hybrid score method from two
Wilson intervals). "A link is seen" when the interval's lower end is above zero.

**How often a link could be seen.** A generator-only sweep, in the manner of `DESIGN-sensitivity.md`: the same
generator with one change, renewal probability set by discount depth (deep 0.85 + g/2, shallow 0.85 less g/2), for
planted gaps g of 0, 10, 20 and 30 points, 200 seeds each (seeds 60001 to 60200, the same seeds for every gap). The
renewal decision draws its random number exactly as the generator does and compares it with the discount's
probability instead of 0.85, so g = 0 is the study's own generator. Each simulated company's renewal decisions over
its whole history are scored with the same rule. Reported per gap: the share of companies in which a link is seen, the
share in which the interval excludes zero in either direction, the median number of decisions per group, and the
count of companies with no decision in a group (scored "not seen").

**Size needed.** Decisions per group for 80% power at a two-sided 5% level, for each planted gap, from the usual
two-proportion formula: n = (1.96 x sqrt(2 p q) + 0.8416 x sqrt(p1 q1 + p2 q2))^2 / g^2, with p1 and p2 the planted
rates, p their mean and q = 1 less p.

The sweep runs no dbt. It refuses to write unless its generator at g = 0 and the study's seed reproduces the clean
company's renewal decisions exactly.

## 6. Models and checks

A fourth dbt project, `pricing/dbt`, reads the main warehouse, the realization schema and the lifecycle page's bridge
by motion, and writes the schema `pricing`. The runner builds the main project, the realization project and, from the
lifecycle project, only `fct_nrr_bridge_by_motion` (it reads no product events). Models:

- `int_line_month_end`: one row per seat plan or contract per month end from the starting point to the ending point,
  with list ARR, discount, realized ARR, customer key and segment;
- `fct_price_to_revenue`: section 3's walk per motion and segment;
- `fct_retention_price_volume`: section 4's split per motion;
- `fct_renewal_decisions`: one row per renewal decision (contract, segment, discount, deep or shallow, renewed).

Each check is labelled before it runs as an identity (it holds by construction for any input data, so only a code
error can break it) or as one that can fail on data.

| Check | Kind | Fails when |
|---|---|---|
| `assert_walk_closes` (dbt) | identity | per motion and segment, realized value plus the walk's lines differs from recognised revenue by more than US$0.01 |
| `assert_walk_ties_to_study_walk` (dbt) | identity | summed over motions, month length, straight-lining, onboarding fees, credits or recognised revenue differs by more than US$0.01 from the study's ARR-to-revenue walk and revenue model summed over the 12 months; or realized recurring value plus day weighting differs from the study walk's ARR, ramps, seat changes, starts and ends lines summed |
| `assert_split_adds_to_bridge` (dbt) | identity | per motion, the expansion or contraction components differ by more than US$0.01 from the lifecycle page's bridge by motion |
| `assert_renewal_terms_within_policy` (dbt) | can fail | a renewal carries a deeper discount than the contract it renews, or a list value below 94% or above 125% of that contract's last tier (the renewal policy, declared here; it mirrors the generator's rule, which rounds list values down to US$100) |
| walk against the generator (Python) | can fail | per motion and segment, realized value, onboarding fees or recognised revenue differs by more than US$0.01 from the generator's own calculation from its records |
| split against the generator (Python) | can fail | per motion, any component differs by more than US$0.01 from the generator's own calculation, with customer keys built from the CRM links as recorded |
| renewals against the generator (Python) | can fail | any contract's decision (decided or not, renewed or not, deep or shallow) differs from the generator's records |

Plus `unique` and `not_null` on each model's keys. The generator checks exist only because the data is synthetic. In a
real company the nearest equivalent is a sample of order forms, renewal quotes and the revenue schedule checked against
the warehouse.

## 7. Positive controls and predictions

Each control runs once on a fresh copy. Data controls edit only the extracts and rebuild every project on a fresh
DuckDB file; code controls edit one line of a copy of `pricing/dbt` and run it on the clean warehouse. Each raises an
error if it touches nothing.

| Control | Kind | What changes | Predicted to fire | Predicted silent |
|---|---|---|---|---|
| `renewal_discount_raised` | data | the lowest-id renewal contract that starts inside the measured year, belongs to a cohort customer and is in service at the ending point has its discount raised by 10 points, consistently in the contract, the opportunity amount, every recurring invoice and the payments that follow them | renewal policy; walk against the generator; split against the generator | the three identities; renewals against the generator |
| `renewal_booked_as_new` | data | the lowest-id renewal contract whose predecessor's decision is in the data has its opportunity type set to new | renewals against the generator | every other check |
| `split_drops_discount` | code | `fct_retention_price_volume` sets the discount effect to zero | split adds to the bridge; split against the generator | the walk checks; renewal checks |
| `walk_drops_straight_lining` | code | `fct_price_to_revenue` sets straight-lining to zero | walk closes; walk ties to the study walk | walk against the generator; the split and renewal checks |
| `renewal_window_off_by_one` | code | `fct_renewal_decisions` looks for the renewal on the day the contract ends instead of the day after | renewals against the generator | every other check |

Predictions about the results, each scored on the page:

1. Every walk closes and ties to the study walk on clean data (identities).
2. Company-wide, recognised revenue differs from realized value by less than 5% of realized value.
3. Straight-lining and onboarding fees are positive; self-serve has neither, and self-serve recognised revenue is
   within 1% of its realized value.
4. Day weighting is smaller than 0.1% of realized value in every row.
5. The discount effect is exactly zero on renewals and ramp steps (the generator keeps each contract's discount at
   renewal, so this holds by construction) and nonzero only on moves to a contract.
6. Seats account for at least 95% of self-serve expansion.
7. Ramp steps and renewal list changes together account for more than 80% of sales-led expansion.
8. Sales-led net revenue retention without its price causes is below 100%.
9. In the company's own book, the deep less shallow renewal gap's 95% interval includes zero (the generator draws
   renewals independently of discount, so this holds by construction unless chance says otherwise).
10. With no planted gap, a link is seen in no more than 5% of the 200 simulated companies.
11. A planted 10-point gap is seen in fewer than 20% of companies, and a 30-point gap in fewer than 80%.
12. A 10-point gap needs more than 200 decisions per group for 80% power.

## 8. Scoring

The clean run must pass every check. A control holds when every check predicted to fire fails and every check
predicted silent passes. A dbt test that errors counts as neither. Results go to `results-pricing.json` whatever they
show; no prediction or control changes after its result.

## 9. What this design cannot show

The same author wrote the generator, its discount table, its renewal rule, the checks and the controls. The price and
volume split describes the generator's choices: renewals keep their discount and their list price moves between 95% and
125% by rule, so the share of retention that price explains is set by those rules, not measured from a market. The
renewal comparison on the company's own book is null by construction; its use is to show the interval, and the sweep's
use is to show how many decisions a real company would need. One seed for the company itself, one draw. The cohort keys
depend on CRM links, so an unlinked move to a contract reads as a churn plus a new customer.

## Amendment 1: the starting ARR tie includes usage; one scoring rule stated

Written while writing the models and checks, before any stage of the runner ran and before any figure in sections 7
and 8 was computed.

- The study walk's first line (ARR over 12) includes the usage run rate, and its usage-against-run-rate line takes it
  back out. So the last comparison of `assert_walk_ties_to_study_walk` adds usage on both sides: realized value plus
  credits, day weighting and usage timing on this round's side (which is realized recurring value plus day weighting,
  and recognised usage), against the study walk's ARR, ramps, seat changes, starts and ends, and usage-against-run-rate
  lines summed. Section 6's other comparisons are unchanged.
- Prediction 5 is scored strictly: every discount effect other than the moves to a contract is zero, in both motions
  (a self-serve plan that replaces another counts).
- The runner (`pricing/run.py`) runs in stages, each with a done-marker: the clean run, each control, the sweep in four
  chunks (one per planted gap), then assembly, which scores the predictions by the rules above.
