# Price realization and net revenue retention: protocol

A second question on the same synthetic company, the same generator, the same seed and the same dbt
project as `DESIGN.md`. Sections 1 to 8 are the declaration. They were written after a first look at
the clean totals (list value, discounts by type, the cohort's ARR at the starting and ending points)
and before any model, check or control code for this round existed. `tests/test_realization.py` pins
their sha256; a later change goes in a new section at the end headed `## Amendment N: <what changed>`.

Nothing in `DESIGN.md`, `results.json`, `results-v1.json` or the seven planted faults changes. This
round writes its own results file, `results-realization.json`.

## 1. Question

1. How much of list price does the company actually realize, by segment and sales motion, and which
   discounts take the rest?
2. How much ARR did the customers that existed at the start of a year keep by its end (net revenue
   retention), and how much before any growth (gross revenue retention), using the expansion,
   contraction and churn definitions the monthly ARR bridge already uses?

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

## 2. Terms and the period

- **Measured year:** the last 12 of the 18 reported months. The 18 months allow one trailing
  12-month window that ends at the last month, and five earlier ones used only for the naive
  comparison in section 5.
- **Starting point:** ARR on the last day before the measured year. **Ending point:** ARR on its last
  day. These are the only two points in time this round names.
- **List value:** what a year of service would cost at list price: seats in effect times the price
  list's seat price (annualised), the contract tier's annual list value, and metered runs times the
  price list's run price, for every day of the measured year a line was in service.
- **Realized value:** the same service at the price actually charged: list value less every discount,
  less credits issued in the measured year. **Realization** is realized value as a share of list value.
- **Cohort:** every customer key (the key the ARR bridge tracks: the workspace, or the CRM account when
  it has no workspace link) with ARR above zero at the starting point. New customers, and customers
  with zero ARR at the starting point who come back during the year, are outside the cohort.
- **NRR:** the cohort's ARR at the ending point as a share of its ARR at the starting point.
- **GRR:** the cohort's starting ARR less contraction, churn and usage falls, as a share of its
  starting ARR: what it kept before any expansion, return or usage growth. Every term comes from the
  bridge below, so a reader can rebuild GRR from it.

## 3. Discount types

Only types the generator applies, named from its code:

| Step | Where it lives | Applies to |
|---|---|---|
| Contract discount | `discount_pct` on CRM contracts whose opportunity is new business or a renewal (renewals keep the discount) | sales-led |
| Migration discount | `discount_pct` on the contract that moves a self-serve customer to sales-led (opportunity type migration) | sales-led |
| Self-serve discount | `recurring_discount_pct` on card subscriptions | self-serve |
| Credits | goodwill and service credit notes on contracts, issued in the measured year | sales-led |

Not discounts here, and left out of the waterfall: refunds (they return money for days not served,
which are not in list value either), proration (part periods), ramp steps (each tier carries its own
list value in the CRM), the annual seat price (the price list lists it as its own price) and
onboarding fees (not recurring). Metered runs carry no discount.

## 4. Models

A second dbt project, `realization/dbt`, reads the main warehouse after `make build` and writes the
schema `realization`. It is separate so the main project's code, its test list and the frozen
results stay exactly as they were. Models:

- `int_price_daily`: one row per seat plan or contract per day of the measured year, with list value
  and each discount, computed from the price list, the seat changes and the contract tiers.
- `fct_price_realization`: per motion and segment, list value, each step of section 3, and realized
  value. Realized recurring value is read from the main project's daily ARR spine (`int_arr_daily`),
  not from `int_price_daily`, so the two paths meet only in a test.
- `fct_nrr_bridge`: for the cohort and, separately, the customers outside it: starting ARR, each move
  of the monthly bridge summed over the 12 months (`int_arr_bridge_rows`), usage change split per
  customer into rises and falls, and ending ARR read from the ARR model (`int_customer_arr_monthly`).
- `fct_nrr_windows`: defined NRR and naive NRR (each customer's billing documents in the month times
  12, the way the main page's naive ARR is built) for every 12-month window inside the 18 months.

Segment is the CRM account's segment (large or mid market). Self-serve and usage have no segment.

## 5. Checks

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_waterfall_ties_to_arr_spine` (dbt) | identity | per motion, list value less the discounts from `int_price_daily` differs by more than US$0.01 from the realized recurring value read from the ARR spine |
| `assert_nrr_bridge_closes` (dbt) | identity | for the cohort or the customers outside it, starting ARR plus every summed move differs by more than US$0.01 from the ending ARR read from the ARR model |
| `assert_nrr_ties_to_company_bridge` (dbt) | identity | the cohort and the customers outside it, added together, differ by more than US$0.01 from the company bridge (`fct_arr_bridge`, all motions) summed over the year, in any move, or from company ARR at the starting or ending point |
| `assert_discounts_within_price_book` (dbt) | can fail | a contract discount above 25%, a migration discount above 10%, or a self-serve discount other than 0% or 20% (the price book, declared here) |
| realization against the generator (Python) | can fail | any waterfall value differs by more than US$0.01 from the generator's own calculation from its records |
| NRR against the generator (Python) | can fail | starting ARR, any bridge line, ending ARR, NRR or GRR differs from the generator's own calculation (US$0.01; ratios 0.0001), with customer keys built from the CRM links as recorded |

Plus `unique` and `not_null` on each mart's keys. The two generator checks exist only because the data
is synthetic: a real company has no generator. Its nearest equivalent is a sample of signed order
forms and price lists checked against the warehouse.

Reported but not a check: the cohort NRR with every CRM account linked to its true workspace, which
the generator knows and the warehouse cannot.

## 6. Positive controls and predictions

Each control runs once on a fresh copy: data controls edit only the extracts and rebuild both dbt
projects on a fresh DuckDB file; code controls edit one line of a copy of `realization/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 |
|---|---|---|---|---|
| `contract_discount_above_price_book` | data | the lowest-id new-business contract in service at both the starting and ending points has its discount set to 40%, consistently in the contract, the opportunity amount, every recurring invoice and the payments that follow them | price book; realization against the generator; NRR against the generator | the three identities |
| `card_left_active_after_migration` | data | the main study's first declared fault, reused unchanged | realization against the generator; NRR against the generator | price book; the three identities |
| `list_ignores_seat_changes` | code | `int_price_daily` prices every day of a seat plan at its first seat count | waterfall ties to the ARR spine; realization against the generator | NRR checks; price book |
| `bridge_drops_returns` | code | `fct_nrr_bridge` leaves the reactivation move out of its lines | NRR bridge closes; NRR ties to the company bridge; NRR against the generator | realization checks; price book |
| `outside_means_first_arr_in_year` | code | `fct_nrr_bridge` counts as outside the cohort only customers whose first ARR ever is inside the year, dropping those who come back | NRR ties to the company bridge | NRR bridge closes; realization checks; price book; NRR against the generator |

Unscored: the main study's missed fault, `discount_wrong_consistent`, is also run through these
checks. It is reported for information only, since these checks were written after that miss was
known.

## 7. 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-realization.json` whatever they show; no prediction or control changes after its result.

## 8. What this design cannot show

The same author wrote the generator, its discount rates, the price book, the checks and the
controls. A held prediction shows each check can fail and fails where expected; it does not show
how often these checks would catch real pricing errors. Realization figures describe the
generator's chosen discount tables, not a market. One seed, one draw: differences between segments
can be chance. The cohort keys depend on CRM links, so an unlinked migration reads as a churn plus a
new customer.
