# Test run ledger operations

> Enable testRunLedger, then use ed invoke. Reports are explicitly selected local files; the extension does not run tests, scan repositories or fetch remote data.

- Canonical URL: https://getedith.pro/docs/cli/test-run-ledger
- Updated: 2026-12-02

Enable `testRunLedger`, then use [ed invoke](https://getedith.pro/docs/cli/invoke). Reports are
explicitly selected local files; the extension does not run tests, scan
repositories or fetch remote data.

## Import a JUnit file and compare two runs

```sh
ed invoke testRunLedger testRunLedger.import --timeout 120 --json '{"repository":"/tmp/synthetic-repo","label":"Before","reports":["/tmp/before.xml"]}'
ed invoke testRunLedger testRunLedger.import --timeout 120 --json '{"repository":"/tmp/synthetic-repo","label":"After","reports":["/tmp/after.xml"]}'
ed invoke testRunLedger testRunLedger.runs --json '{"repository":"/tmp/synthetic-repo"}'
ed invoke testRunLedger testRunLedger.compare --timeout 120 --json '{"repository":"/tmp/synthetic-repo","baseline":"BASELINE_RUN_ID","current":"CURRENT_RUN_ID","threshold":1}'
```

Each import prints a run summary; its `id` is the run ID that `compare` and
`delete` take. `runs` lists the same summaries in import order.

## Operations

| Operation | Payload | Result |
| --- | --- | --- |
| `testRunLedger.import` | `repository`, `label`, `reports` array | Summary of the stored run |
| `testRunLedger.runs` | `repository` | Up to the newest 200 run summaries, oldest first |
| `testRunLedger.compare` | `repository`, `baseline`, `current`, optional `threshold` | Comparison of two run IDs |
| `testRunLedger.delete` | `repository`, `id` | `{"deleted": "<run id>"}` |
| `testRunLedger.repositories` | `{}` | Stored repositories with `repository`, `runs` and `lastImportedAt` |

## Payload validation

Every payload is a JSON object of at most 64 KiB. An unknown operation is
rejected before the payload is read and the error names the valid operations.
A payload that is not a JSON object, or has a missing or relative `repository`,
fails with `Send a JSON object of at most 64 KiB with an absolute repository path.`

- `import` needs an existing repository folder, a label of 1 to 200 characters
  after trimming, and 1 to 32 distinct absolute report paths. Each report must be
  a readable regular file; pipes, devices, missing files and a second path to
  the same file (symbolic or hard link) are rejected.
- `runs`, `compare` and `delete` match the repository path stored at import, so
  they keep working after the folder is moved or deleted. Use the `repository`
  value from a summary or from `repositories` for such folders.
- `compare` needs two different run IDs of that repository and a finite,
  nonnegative `threshold` in seconds (default 1).
- `delete` needs a run ID of that repository. It removes the run and its report
  snapshots; original reports are never touched.

Repository paths are resolved with `realpath`, so `/tmp/repo` and
`/private/tmp/repo` name the same repository.

## Results

A run summary contains `id`, canonical `repository`, `label`, `importedAt`,
`sources`, `warnings`, `failures`, `skipped`, `knownDuration`,
`missingDurations` and `testCount`. Dates use Foundation's seconds since
2001-01-01 UTC. Sources contain `originalPath` and `localPath`, an exact local
XML snapshot. Test results contain `id`, `suite`, `className`, `name`, `status`,
optional `duration`, `message`, zero-based `source` index and one-based
`ordinal` within that report. Optional values are omitted.

A comparison contains the `baseline` and `current` run summaries,
`failureDelta`, `skippedDelta`, `knownDurationDelta`, `changes`, `unchanged`
and `omitted`. A change contains `id`, `before` and `after` (every occurrence
of that identity in each run, empty when not observed), `transition`, optional
`durationDelta` and `durationRegression`. Changes list every test whose
transition is not `unchanged`, every duration regression and every test that
still fails. `unchanged` counts the passing or skipped tests left out. Changes
are ordered new failures, recoveries, status changes, ambiguous, added, not
observed, then the rest; if a reply would pass 7 MiB, the trailing changes are
dropped and counted in `omitted`.

A regression requires a positive increase at least equal to the threshold and
known durations on both sides. Transitions are `newFailure`, `recovered`,
`statusChanged`, `unchanged`, `added`, `notObserved` or `ambiguous`. Errors count
as failures. New failing identities are `added`; only an observed non-failing
test becoming failed or error is `newFailure`. A missing test never implies
recovery. Skipping a failed test is `statusChanged`, not recovery. Only passing
proves recovery.

Identity is a JSON array of the nested suite names, class name and test name.
Matching names in different classes or suites remain distinct. Exact duplicate
identities retain every occurrence and source, but their comparison is
ambiguous; no transition or duration regression is inferred. File names and run
labels do not affect identity.

## Reports and limits

Imports accept UTF-8 JUnit `testsuite` or `testsuites` XML, including
namespaces, nested suites, CRLF line endings and a byte order mark. Document
type declarations, entity, element, attribute and notation declarations, and
XML declarations naming another encoding are rejected. HTML inside failure
output or CDATA is fine. Truncated XML retains fully closed cases and records a
warning. Declared count mismatches are warnings, the first 20 per report.
Missing and invalid durations remain unknown. Aggregate duration sums known case
times, which can overlap during parallel execution; it is not wall time.

The message attribute and body of each failure, error and skipped element are
joined with line breaks, up to 8,192 characters per test. When a run's messages
pass 2 MiB of UTF-8, each is shortened on a character boundary to an equal byte
share, at least 256 bytes, and a warning says so. A run keeps at most 50 warnings.

Limits are 32 reports, 10 MiB per report, 32 MiB and 20,000 completed tests per
run, 16 MiB of stored run metadata, 128 XML nesting levels and a 200-character
label. A failed or cancelled import publishes no partial run, and an import
interrupted by a crash is cleaned up the next time the extension starts. At the
same start, a run whose `summary.json` is damaged gets it rebuilt from `run.json`,
and a run folder where neither file can be read is removed.

Snapshots and derived data stay in the extension's `test-run-ledger` data
folder. No upload or automatic sharing occurs. CLI output includes local paths
and report messages; review it before sharing.

## Get Edith

Edith is a native Mac app for macOS 14 or later on Apple silicon with 100+ extensions, the `ed` command line and an MCP server. $35 once for one Mac, plus $7 for each additional Mac, with no subscription and a 30-day refund.

- [Buy Edith](https://getedith.pro/pricing): $35 once for one Mac, plus $7 for each additional Mac
- [Download Edith](https://getedith.pro/download): the installer, or Homebrew
