Skip to content
Rehearsev1.2.0

Comparing base and head

In the shop fixture, a change compared with main gets this answer.

Terminal
$ rehearse compare --base main
2 as on the base · 1 new · 2 changed and said so (2 edited) · 2 changed without saying so · 1 fails on the head · 1 gone
changed without saying so:
The owner sees every item (packages/api/items.hurl:14)
$.items[*].price: 3.5 → "3.50" (3 places)
The weekly stock report lists every item with its price (packages/report/weekly.rehearse.yaml)
weekly.csv column 3 "price": "3.5" → "3.50" (2 places)
fails on the head:
The count is right (packages/api/items.hurl:26)
$.count: 3 → 2
line 30: jsonpath "$.count" == 3 · expected 3, got 2
changed and said so:
The shop names itself (packages/api/items.hurl:8) — its definition was edited
$.name: "Shop" → "The Shop"
A member isn't told the admin page exists (packages/api/items.hurl:21) — its definition was edited
status: 404 → 403
$.error.code: "not_found" → "forbidden"
new:
The owner finds items by name (packages/api/items.hurl:33)
unannounced, by what changed:
$.items[*].price — in 1 scenario
weekly.csv column 3 "price" — in 1 scenario
gone from the head:
The legacy ping answers (packages/api/items.hurl)
8 ids, times and opaque values were set aside before comparing.
Stand-ins: payments (fake, for The payment provider).

rehearse compare runs every scenario on the base and on the head, compares what each saw, and gives each scenario one verdict. The first line counts them. This page explains each part.

Side What it is Default
base The branch production runs: what the change is compared with base in rehearse.yaml (main when unset), or --base <ref>
head The change This checkout as it is now, uncommitted changes included, or --head <ref>

The head’s manifest drives both sides. A comparison reads one rehearse.yaml, the one found from where you run Rehearse, and runs its commands in each checkout. A base that has no rehearse.yaml yet can still be run, so you can record today’s behaviour the day you adopt Rehearse.

The base is a git worktree, prepared once. A ref becomes a detached worktree of its commit under .rehearse/checkouts/<commit>. Rehearse runs prepare there once (installing dependencies, building) and marks it prepared. The next comparison against the same commit reuses it. Rehearse keeps the newest three (budget.checkouts) and rehearse clean removes the rest. Rehearse says when it checks a base out.

Terminal
Checking out main (c68f00d9431f) into …/shop/.rehearse/checkouts/c68f00d9431f

Refs and folders. --base and --head take a ref or a folder. Only a path that starts with ./, ../, / or ~/ is a folder, and a relative one is read from where you run Rehearse. Anything else is a ref, so a folder that happens to be called main never stands in for the branch. A folder inside a git repository means that repository’s top folder. The base and the head can’t be the same checkout.

If the manifest names an overlay, its files are copied into each checkout before anything runs there. See keeping the manifest outside the product.

Scenarios run on the base, then on the head, never both at once. The base runs only the scenarios the head still has.

Some values differ on every run and mean nothing: an id the database made, the time a row was written, a cursor. Before comparing, Rehearse replaces them with a marker on both sides, so only real changes are left.

What Where Becomes
UUIDs and ULIDs any value that is one, and UUIDs inside text ‹id›
Generated ids under a key named id, ending in Id or _id, or starting with correlation: a string that looks generated (a UUID, a ULID, or 16 or more letters and digits mixed, with no spaces) ‹id›
Integer ids an integer under one of those keys ‹id›
ISO date-times any value that is one, and inside text ‹time›
Epoch times an integer over 10⁹ under a key ending in At, _at, Time or _time, or named at, timestamp or ts ‹time›
Relative times in text: “3 days ago”, “about an hour ago”, “in 5 minutes”, “just now” ‹time›
Opaque values a string under a key ending in cursor, token, etag or nonce (any case); a base64url string of 32 or more characters that mixes upper case, lower case and digits ‹opaque›
Order arrays (or a file’s rows) only where a scenario or the manifest says unordered sorted

The rules are tight on purpose, so a real change still shows:

  • roleId: "owner" is compared: owner doesn’t look generated.
  • A hex checksum is compared: it has no upper case, so it isn’t opaque (unless its key names an id or a token).
  • “in 30 days” is compared: a promise about days is meant. Only seconds, minutes and hours ahead are set aside.
  • Array order is compared unless you say unordered.

Pieces and flows render on a fixed browser clock (15 January 2026, 12:00 UTC), so a date on screen reads the same on both sides.

Calls and JSON outputs get every rule. Text (a plain body, an accessibility tree, a file’s cells and lines, logged errors) gets the rules that work inside text: UUIDs, ISO times, relative times and your own values.

The manifest’s setAside adds rules of your own.

rehearse.yaml
setAside:
keys: ['^requestHash$'] # values under these keys are set aside
values: ['build-[0-9a-f]{7}'] # values (or text) matching these are set aside
keep: ['$.expiresAt'] # never set aside: JSON paths, or a file's column names

Each rule is a regular expression. What they set aside becomes ‹set aside›. keep takes a JSON path ($.expiresAt, or $.items[*].sku for every item) or a column name. A file scenario can add its own setAside, with columns that are never compared; see the files guide.

Every comparison lists what it set aside for each scenario, by kind and count (ids, times, opaque, order, custom), counted on the head’s side: one count per value a reader sees. The text ends with the total:

Terminal
8 ids, times and opaque values were set aside before comparing.

Observations are stored with nothing set aside. Rules apply when comparing, so a new rule never needs a new run.

What is left after setting aside is compared. One change in many places is one difference with a count:

Kind Compared A difference reads
call status, content type, body status: 404 → 403, $.items[*].price: 3.5 → "3.50" (3 places)
file exit code, each output by its layout weekly.csv column 3 "price": "3.5" → "3.50" (2 places)
piece the tree, logged errors and axe violations, in each scheme; the screenshot only when asked light tree line 3: "- status: 0 in the basket" → "- status: 0 in your basket"
flow the number of steps, whether each step held, the tree after each, and the errors the page logged step 2 (click “Add one” (button)) line 3: "- status: 1 in the basket" → "- status: 1 in your basket"

JSON paths fold their indices ($.items[3].price becomes $.items[*].price). Text is compared line by line, and named by the head’s line. Two texts too long to align (their line counts multiplied come to over four million) are compared by position instead, so one line inserted there shows as a change to every line after it. A file’s rows are compared cell by cell and grouped by column.

The folders a run sits in are written as placeholders in what Rehearse keeps, so the base (a worktree under .rehearse/) and the head never differ by where they sit. The checkout is {{checkout}}. When rehearse.yaml sits inside the checkout, as it usually does, its folder is written as that place in the checkout, {{checkout}}/<folder>, on both sides. {{manifest}} is used only for a manifest kept outside the checkout, as in the Kurvball example.

Each scenario gets one verdict. When more than one applies, the first in this list wins:

Verdict In JSON Means
fails on the head fails It fails on the head. failsOnBase: true when it fails on the base too
new new The base has no such scenario
changed without saying so unsaid It differs from the base, and nothing said it would
changed and said so said It differs, and the change announced it, or its own definition was edited
as on the base same Nothing differs once ids, times and opaque values are set aside

The verdict is one word, but nothing is lost. Each scenario in the JSON also keeps changed, said ("announced", "edited" or null), edited, failsOnBase, failsOnHead, its differences and its failures. The JSON reference has every field.

A change can say what it changes in two ways. They are kept apart:

Source How Shows as
Announced The scenario is named in .rehearse/announce.yaml beside the manifest, in --announce <file>, or in --said <id> — announced: <why>
Edited The scenario’s own definition changed between base and head — its definition was edited

When both apply, announced wins: the why is what a reviewer wants to read. The line counts the two apart: 4 changed and said so (3 announced, 1 edited). See announcing what a change changes.

“Edited” is decided per scenario, never per file. Rehearse hashes each scenario’s own parsed definition:

Kind Its definition
call its method, URL, headers, query, body, status, asserts, captures and options, and the earlier calls in its file whose captures it uses
piece its export’s statement, and the file’s meta: its default export and the object it names, never its imports
flow its service or piece, start, world, person and steps
file its parsed YAML, and its input file’s contents

So reformatting a file, adding a comment, or adding a scenario beside another says nothing about the others. A slip can’t hide behind an edit to the file next to it. Adding an import for a new story doesn’t edit the stories beside it either.

A scenario read beside the manifest (./…) is the same file on both sides, so it is never edited. Only an announcement says it changed.

The first line counts the verdicts, and what else the comparison found:

Terminal
2 as on the base · 1 new · 4 changed and said so (3 announced, 1 edited) · 1 fails on the head · 1 gone
4 as on the base · 1 changed without saying so · 1 fails on the head (1 on the base too)

The JSON keeps the same in line and in counts: same, said, announced, edited, unsaid, new, fails, failsOnBoth, gone and notRun.

Part Means
gone from the head A scenario the base has and the head doesn’t. Listed apart, never run, no verdict.
not run A scenario that couldn’t run on a side: its service didn’t come up, its world didn’t build, the sign-in failed, or the runner stopped. Listed with the side, the step and what was said. No verdict.
announced, but as on the base An announcement whose scenarios all came out unchanged. Either the change didn’t do what it said, or the announcement is stale.
unannounced, by what changed The changes nobody said, grouped by path, the path in most scenarios first. One cause often shows in many scenarios.
not read A scenario file Rehearse couldn’t read on one side, with its line and why. In a comparison of every scenario, an announcement entry that names no scenario at all (none compared, gone or not run) is listed here too: “The announcement names X, which matches no scenario compared.”

If the base can’t be checked out or prepared, or its services don’t come up, there is nothing to compare with. Rehearse says so once and gives no verdicts, instead of a misleading verdict per scenario:

Terminal
$ rehearse compare --base main
The base didn't come up (up): api stopped before it was ready (exit 1): … Its log: …/shopb/.rehearse/logs/api@4f20e84ecf.log

With --json, the comparison says the same, shortened here to the parts that matter.

Terminal
{
"ok": false,
"base": { "ok": false, "step": "up", "says": "api stopped before it was ready (exit 1): …" },
"scenarios": []
}

step is where it stopped: checkout, prepare, overlay, up or world. If the head doesn’t come up, every scenario is listed as not run on the head.

The base changes rarely; the head changes all the time. So Rehearse keeps each observation of a clean commit, and the next comparison against that commit reads it instead of running again:

Terminal
7 base observations came from the cache (c68f00d9431f).

An observation is kept under .rehearse/cache/<commit>/, by a key made of:

  • the commit;
  • the scenario’s id, its definition, and what else in its file it depends on (a call’s earlier calls);
  • the group it ran with (below);
  • its world and person;
  • the stand-ins replaced with the real one (--real);
  • the kind runner’s version;
  • only the manifest parts it uses: its services, its world’s chain, the stand-ins on its services, prepare, signIn, its kind’s settings, and the overlay’s contents.

Editing an unrelated service or world doesn’t throw the cache away. A new version of a kind’s runner does, and the base runs again.

Rehearse never caches:

  • a checkout with uncommitted changes (the head as you work on it);
  • a run where something around the scenario broke: services that didn’t come up, a world that didn’t build;
  • a call whose service didn’t answer, or timed out;
  • a run on services someone else left up, since Rehearse can’t vouch for their state.

A clean head commit is cached too, so comparing two commits a second time runs nothing. --fresh ignores the cache.

Scenarios that run on the same services in the same world share those services’ state: what one call creates, the next one sees. So such scenarios form a group. Each member’s cache key holds the whole group (its members, their definitions, in the order they run), and a group is read from the cache whole or run whole. If one member misses, every member runs again, together. A scenario that needs no service is a group of its own.

A call always runs after the calls before it in its file, even when you compare only that call, so its captures and its state are the ones it was written against.

A comparison takes every scenario, the scenarios you name, or only those the change reaches.

Terminal
rehearse compare --base main # every scenario
rehearse compare --base main 'packages/api/**' # ids, or globs over ids
rehearse compare --base main --affected # only what the change reaches

--affected takes the files that differ between the base commit and the head (committed, staged, unstaged and untracked) and keeps the scenarios they reach. See affected scenarios.

Each comparison is written to .rehearse/compare/<time>/comparison.json, with each side’s observations beside it. The latest full comparison is also .rehearse/compare/latest.json. A comparison of a few scenarios, or of --affected, goes to latest-partial.json instead, so it never replaces the whole picture. The stage reads both: for each scenario, it shows whichever compared it last.

rehearse compare exits 0 when both sides came up, every scenario ran, nothing fails on the head and nothing changed without saying so. Otherwise it exits 1.