# Scenarios

> One recipe, many datasets — named scenarios set rates for nulls, orphans, duplicates and other conditions; 21 archetypes to choose from.

Section: Recipes · Type: concept · Last updated: 2026-09-13

A scenario is a named set of rates on the recipe: null_rate, broken_fk_rate, duplicate_rate, typo_rate and the rest. Pick the name at generation time and the same recipe yields clean data, sparse data, or data with exactly the defects a test needs. The engine’s playbook lists 21 archetypes in 3 groups — everyday, tricky-but-valid, broken-on-purpose — each with what it produces, why a test wants it, and what the proof then shows.

## The picture

Recipe (one file) → Scenario (named rates) → Generate (--scenario name) → Clean | Broken on purpose

The same recipe, generated under a different name, gives a different dataset with the defects declared.

## Scenario keys

- break_scopes, broken_fk_rate, business_rule_violation_rate, compliance_violation_rate, date_anomaly_rate, defects, distribution_drift_rate, duplicate_rate, invalid_format_rate, migration_anomaly_rate, mode, name, null_rate, outlier_magnitude, outlier_rate, rows, typo_rate

## Planted defect kinds

- backdate, blank, broken_fk, invalid, miscalc, overlap

## Archetypes — everyday

- Clean, in-distribution data — Everything valid, nothing missing, mixes as declared.
- Byte-identical output for CI — A pinned seed, so the same recipe produces the same bytes on every machine forever.
- Columns that only exist for some rows — A field present only when its condition holds, blank otherwise — not randomly blank.
- Numbers and mixes that differ per segment — A different range or a different mix for each tier, channel or cohort.
- Every legal path through a state machine — and the illegal one — Statuses that are the end of a real walk, with the impossible transition declared as never.

## Archetypes — tricky but valid

- No rows at all — A scenario with zero rows, so every downstream path meets an empty input.
- Limits and extremes — Numbers and dates pushed to their declared minimum and maximum.
- Missing optional data — Blank cells wherever a field is genuinely optional, propagating through computed columns.
- More rows than anyone tested with — The same shape at a much larger row count.
- A few parents owning most of the children — Long-tailed fan-out instead of an even spread — one customer with 400 orders while most have two.
- Rare extreme numbers — A small share of values far outside the normal range.

## Archetypes — broken on purpose

- Orphans — children pointing at parents that don't exist — A share of foreign keys pointing nowhere.
- The same row twice — Repeated rows, and combinations that must never repeat.
- Values that don't parse — Malformed emails, dates, identifiers and checksums, plus character-level typos in text.
- One specific bad row, every run — A named row, field and failure kind — broken deterministically rather than probabilistically.
- Totals that don't add up — Parent totals and file trailers that disagree with the detail rows beneath them.
- Rows that break a rule the system claims to enforce — Deliberate violations of a declared cross-field invariant.
- The mix shifting away from what was declared — A measurably different distribution from the baseline.
- Dates that shouldn't be possible — Out-of-window, out-of-order and impossible dates.
- Regulated identifiers in the wrong place — Rows that put sensitive identifiers where policy says they must not appear.
- The mess a legacy migration leaves behind — Trailing whitespace, sentinel values, inconsistent casing, placeholder dates — the fingerprints of a backfill.

## Two scenarios on one recipe

```json
{
  "scenarios": [
    {
      "name": "clean"
    },
    {
      "name": "messy",
      "null_rate": 0.05,
      "broken_fk_rate": 0.02,
      "duplicate_rate": 0.01,
      "typo_rate": 0.03
    }
  ]
}
```

node packages/sdk-node/bin/worklens.js generate recipe.wl.json --scenario messy

## Common questions

**How do I plant one specific bad row every run?**

Use defects on the scenario with a kind (backdate, blank, broken_fk, invalid, miscalc, overlap) and a count. Planted defects are deterministic under the seed and listed in the receipt, so a test can assert on exactly them.

**Where do I pick the scenario?**

On the run, not in the recipe: --scenario on the CLI, scenario on generate_from_graph and the other MCP tools, or the scenario menu in the studio. A recipe with no scenario chosen generates clean.

## Related

- [Rules & constraints](https://theworklens.com/docs/recipes/rules): What must hold on every row — ranges, uniqueness, date order, conditional presence, and constraints across columns.
- [Generate](https://theworklens.com/docs/cli/generate): worklens generate — recipe → data. Read from the CLI’s own header, with every option it accepts.
- [How validation works](https://theworklens.com/docs/validate/how-it-works): Two layers of checking: the recipe before a run, and the data after it — what each layer looks at and what neither can see.
- [Limitations](https://theworklens.com/docs/validate/limitations): The 9 things the engine will not do, each with why and what to do instead — the same list an AI agent is told.

_← Previous: [Derived fields](https://theworklens.com/docs/recipes/derived-fields) · Next: [Generate](https://theworklens.com/docs/generate) →_

_Archetypes come from the playbook the MCP server serves; keys and defect kinds from the engine vocabulary. Source: get_recipe_schema (scenario_playbook) + recipe-vocab.json._

_Canonical: https://theworklens.com/docs/recipes/scenarios · This copy: https://theworklens.com/docs/recipes/scenarios.md_
