# Subscription lifecycle definitions (part three)

How far do activation, expansion, churn and payback move with the definition chosen, and how wrong does a naive retention
curve get when recent cohorts have not had time to churn? Part three of the online retail study. Unlike the
[win-back study](README.md) and [lifecycle accounting](README-lifecycle.md), it uses no dataset: its accounts are synthetic,
drawn by `retail/subscription.py` from rates set in `protocol-saas.json`, so that the true behaviour is known. Open
`subscription-lifecycle.html` for the page.

## How the run was fixed in advance

1. `DESIGN-saas.md` and `protocol-saas.json` set the generator's rates, the definitions, the four retention estimators,
   the payback rule, the 20 seeds per scenario and the account to trace before any reported seed was run.
2. The protocol's SHA-256 is pinned in `saas_pipeline.py` (`PROTOCOL_SHA256`). `run` refuses unless the protocol matches
   the pin and, inside a git checkout, is committed unmodified.
3. The rates were set before that, reading only monthly logo churn by cancel date and net revenue retention.

## Reproduce it

Python 3.12 with NumPy (the draws use only `Generator.random` on fixed seeds, turned into other distributions in the
code). No key and no network.

```
python -B saas_pipeline.py check     # draws all 40 runs again; must match results-saas.json byte for byte
python -B saas_added.py check        # the analyses added after the results; must match results-saas-added.json
python -B render_saas.py             # writes subscription-lifecycle.html from results-saas.json and the protocol
python -B -m pytest tests -q -p no:cacheprovider
```

`make saas` runs the four in order.

## Files

- `retail/subscription.py`: the generator, the definitions, the payback rule and the four estimators (naive, mature
  cohorts only, Kaplan-Meier, a discrete-time hazard model fitted by iteratively reweighted least squares).
- `saas_pipeline.py`: the pinned run and its replay check.
- `results-saas.json`: every seed's figures and the mean, lowest and highest seed per scenario, plus the traced account.
- `saas_added.py`, `results-saas-added.json`: analyses added after the results, on the same seeds with the protocol
  unchanged: payback read from observed margin per account, the true revenue path per account acquired, accounts active
  again after a first activity churn, and the base case with the idle-month and seat-add rates moved.
- `render_saas.py`, `tests/test_subscription.py`, `tests/test_render_saas.py`: the page, the measures on small
  constructed accounts whose answers follow from their construction, the censoring positive control, and the check
  that every figure on the page traces to the results.

## Limits

The product and its behaviour are synthetic and every rate is an assumption: the size of each gap is a property of
those rates. What carries to a real product is the method. The generator and the estimators have one author, so the
value-based activation definition is close to the truth by construction and the hazard model's sign-up month term
matches the kind of drift built into the improving scenario.
