Skip to content

Cross Run History

aryehcitron@gmail.com edited this page Nov 7, 2026 · 52 revisions

Cross-Run History

A report describes one run. The question a failing build actually raises is about the runs before it: is this failure new, or has main been red since Tuesday? Is this the one that flips? Did this scenario get slower last week, or just now? Since 3.9.0 Kronikol answers those from a ledger — an append-only .kronikol/history.jsonl in the repository that every run reads and appends to — and says what it found on every surface it already had: the failures digest, the CTRF document, the run-end pointer, and kronikol query.

Nothing is hosted, nothing needs credentials, nothing runs a server. Fifty runs of a two-hundred-scenario suite measured 228 KB. The design record is plans/CROSS_RUN_HISTORY_PLAN.md in the repository.

Status by release. 3.9.0 shipped the ledger, the verdicts, the digest/CTRF/pointer surfaces, kronikol query history and the kronikol history maintenance verbs. 3.10.0 added the CI gate, quarantine, rename aliases, the doctor and imports from CTRF and Allure. 3.11.0 renders history in the HTML report (a sparkline and verdict beside each scenario, a History section beside the timeline, $flaky in the search), adds merge --history, and dogfoods the ledger on this repository's own CI. The plan is executed in full. 3.21.0 leaves the History section out of the report unless ShowHistorySection asks for it. 4.6.0 takes the sparklines, the verdict pills and $flaky out of the default report as well: the history is drawn on a labs page beside the report, TestRunReport.labs.html, and each view comes back in the report with a switch. 5.0.0 puts the History section back in the default report, as its History tab (ShowHistorySection is on by default); the sparklines, the pills and $flaky stay out of the report unless ShowScenarioHistory asks (In the HTML).

What you get

A second run of a suite whose Pay with an expired card passed last time and fails now writes this at the top of Failures.md:

**History:** 1 broke (against 12 earlier runs on main). Failures are worked through regressions first, …

and under the failure:

History: **broke** — passed in gh:18273645:1 (abc1234), failing now · last runs `PPPPPPPPPPPF`

The run-end pointer and the CI job summary carry the same one line — history: 1 broke, 2 flaky (against 12 earlier runs on main) — and kronikol query failures prints the same history: line under each failure whenever a ledger is there to read. ctrf-report.json sets flaky from the ledger (so a CTRF consumer's flaky table sees what the last runs saw, not only what this run's retries saw) and adds extra.kronikolHistory per test. The labs page beside the report, TestRunReport.labs.html (4.6.0), draws the History section and every scenario's sparkline and verdict, and from 5.0.0 the report's History tab draws the section too.

Every surface says the same thing because the verdicts are computed once, before any output is written, and handed to all of them.

Setup

For a project inside a git repository there is nothing to do: the run finds the repository above its test output and reads and writes <root>/.kronikol/history.jsonl. The first run creates it. Commit it, and add the merge attribute so two branches that both appended merge without a conflict:

kronikol history init

writes the header line and adds history.jsonl merge=union text eol=lf to .gitattributes (idempotent — run it twice and it says so).

Where the ledger is, in order:

  1. ReportConfigurationOptions.HistoryFilePath.
  2. The KRONIKOL_HISTORY environment variable. The value off switches history off for the run — no ledger read, no fragment written, no diagnostic — which is what a test suite that generates reports in-process wants (Kronikol's own test projects set it in test.runsettings).
  3. The nearest .kronikol directory or .git entry above the test output directory, then above the reports directory. The closer marker wins, so a project that keeps its own .kronikol under a repository-level .git uses its own. An ingest (kronikol ingest, IngestPipeline.Run) has no test output: it looks above the directory it is run in, then above the reports directory. Until 4.7.2 it looked above the tool's own folder first, so a tool built inside a checkout read and appended to that checkout's ledger, whatever it was replaying.

Nothing found still writes the run's History.run.json fragment and records a HistoryUnavailable diagnostic naming the fix: git init, or kronikol history init, or HistoryFilePath, or KRONIKOL_HISTORY.

On CI

A CI checkout is discarded, so a run that merely found the repository's ledger does not append to it (WriteHistoryLedger = null, the default: append when the ledger was named explicitly, or when the run is not on CI). It writes History.run.json beside its report instead: one file per run, part of the artifact by construction, and race-free because one process wrote it into its own directory. A step after the test jobs folds them in:

kronikol history gate   <reports-dir>        # 3.10.0: exit 1 on a new failure, before the run is recorded
kronikol history record <reports-dir>...     # every History.run.json under the inputs, in path order

Eight shards of one workflow run share a run id (gh:<run id>:<attempt> on GitHub Actions, ado:<build id>:1 on Azure DevOps) and fold into one ledger line. A run already recorded is skipped as a duplicate, so re-running the step is safe. A re-run of a failed job has a different attempt number and is a different run, so it never erases the failure it re-ran. On a provider Kronikol does not detect, set HistoryRunId from the pipeline's own variables, such as gitlab:$CI_PIPELINE_ID:1.

To read the ledger during the CI run, so that Failures.md in the artifact already carries the verdicts, fetch it from wherever it is kept and set KRONIKOL_HISTORY to the file. (Naming the ledger explicitly also makes the run append to it; set WriteHistoryLedger = false if the fold step is the one writer.)

The recommended shape: an orphan data branch

Where the ledger lives decides who ever sees it in a diff. Committing it to main puts a machine-written line into every pull request's history. An orphan data branch has no shared ancestor with main, so a fetch of it costs nothing and a merge into main cannot happen by accident: the ledger gets its own history and the working tree stays clean. The cost is the one real one: the ledger is not in the checkout, so the page must say which branch holds it and how to read it.

On GitHub Actions, use the kronikol-history action. It is four small actions in one folder, because the fold has to follow every test job of the run:

Phase Where What it does
read each test job, before the tests Fetches the ledger with its quarantine and aliases and names it in KRONIKOL_HISTORY, so the run's own labs page, Failures.md and job summary carry the verdicts. It never fails the job.
gate each test job, after the tests, optional Runs kronikol history gate on each report and puts each reading in the job summary.
save each test job, after the tests Uploads the run's History.run.json fragments as an artifact of their own.
record one job after every test job Folds the fragments into the ledger on kronikol-history and pushes it. The first run makes the branch.

Copy the folder to .github/actions/kronikol-history/, keeping its .gitattributes, and add:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-dotnet@v6
        with:
          dotnet-version: '10.0.x'
      - uses: ./.github/actions/kronikol-history/read
      - run: dotnet test
      - uses: ./.github/actions/kronikol-history/save
        if: ${{ !cancelled() }}

  history:
    needs: test
    if: ${{ !cancelled() }}
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v7
        with:
          sparse-checkout: .github/actions
      - uses: ./.github/actions/kronikol-history/record

The action's README has the rest: a workflow with one test job, which records from the workspace with no artifact; the gate; every input and output; and referencing the folder from a Kronikol release tag instead of copying it (the first tag that holds it is v3.34.0). Kronikol's own ci-summary-preview.yml runs it on every push of main, on the branch kronikol-history.

What it does that a hand-written fold step tends not to, each found by running the steps this page gave before:

  • It makes the branch on the first run, with the ledger, the merge=union attribute and a README. Only a remote that answers "no such branch" starts one: a remote it cannot read is an error, never an empty ledger. The fold step this page gave before failed on every run of a new repository, because its job never fetched the branch.
  • It never rebases. When another run's push lands first, it records again on the branch as it now is, which is safe because a run already in the ledger is skipped. Loops that rebased lost runs when several workflow runs finished together, and on a first run they wrote the same roster lines twice.
  • It reads the quarantine and the aliases with the ledger. They sit beside it on the branch (quarantine.json, aliases.json), and a step that fetched the ledger alone ignored every quarantine.
  • Its git is its own. It folds in a repository of its own under RUNNER_TEMP, never in the job's checkout, so the checkout's version and how it stored its credentials do not matter. The token goes to git as a header through the environment, in no file and on no command line. No credential helper is asked, so a wrong token fails at once and the machine's stored credentials are left alone, and no hook of the machine's runs.
  • Pull requests are not recorded unless record-pull-requests: true. A pull request's run reads against the branch it targets anyway (Pull requests).

To read the ledger locally: git fetch origin kronikol-history && git show FETCH_HEAD:history.jsonl > /tmp/history.jsonl, then kronikol query history ./Reports --history /tmp/history.jsonl.

Three things about the mechanics, each measured rather than assumed:

  • merge=union is read from the working tree, not from the commit. The .gitattributes line lets two branches that both appended merge without a conflict on a local merge, rebase, pull or CI commit-back, and it does nothing for a merge performed server-side, such as GitHub's merge button, which does not read attributes at all. The data branch has exactly one writer (the fold), so no pull request ever touches the file and the case never arises; a ledger committed to main and merged through the web UI will conflict.
  • HistoryWindow does not save repository space. Pruning the oldest lines makes the packed repository larger (measured: 55% larger over four hundred commits), because dropping the head of an append-only file breaks git's delta chains. The window is a read-cost and reviewability control.
  • Artifact retention. Kronikol's own reports artifact keeps one day (CiArtifactRetentionDays), which is right for a report and too short for a fragment waiting on a fold that is re-run the next day. save gives the fragments an artifact of their own, kept seven days: record reads it minutes later, and the week covers a history job re-run after a fix.

Size. The ledger grows with every run, and every lane fetches all of it: each test run reads it whole at its end, and each fold rewrites the tip. A consumer's ledger reached 7.1 MB in its first 12.7 days (1.0 MB gzipped), while git packed its history at about 28 KB a run. Grown to a year's 180 MB, it would be 23.8 MB gzipped for every lane to fetch, and each test run's reading would take 1.4 s and 454 MB of memory, against 0.56 s and 107 MB at 7 MB. record puts the ledger's size in its job summary and warns from 50 MB (warn-ledger-mb). kronikol history prune shrinks the tip, but the runs it drops survive only in the branch's git history, which no reader reads, and the packed repository grows.

Without the action

The same phases written out, for a workflow that cannot call the action. They use only released tools, and they are the action's own logic in two shell steps, so they share its limits and none of its extras (the gate step, the job summary, the size warning). Two steps go in each test job, one on each side of the tests, and one job comes after them. No concurrency group: the record step's loop is the lock, and a group with the default queue cancels a waiting job when a third arrives, which loses that run's line.

# In each test job, before the tests: the ledger and its two companions, so the run's own Failures.md
# carries the verdicts. It never stops the tests: with no branch yet, or no access, they run without history.
- name: Read the history ledger
  continue-on-error: true
  shell: bash
  env:
    TOKEN: ${{ github.token }}
    SERVER: ${{ github.server_url }}
    REMOTE: ${{ github.server_url }}/${{ github.repository }}.git
  run: |
    basic=$(printf 'x-access-token:%s' "$TOKEN" | base64 | tr -d '\r\n')
    echo "::add-mask::$basic"
    export GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=Never GIT_CONFIG_COUNT=3 \
      GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= \
      GIT_CONFIG_KEY_1="http.$SERVER/.extraheader" GIT_CONFIG_VALUE_1= \
      GIT_CONFIG_KEY_2="http.$SERVER/.extraheader" GIT_CONFIG_VALUE_2="AUTHORIZATION: basic $basic"
    repo="$RUNNER_TEMP/kronikol-history-read" out="$RUNNER_TEMP/kronikol-history"
    rm -rf "$repo" "$out"; git init -q "$repo"; git -C "$repo" remote add origin "$REMOTE"
    status=0; git -C "$repo" ls-remote --exit-code origin refs/heads/kronikol-history > /dev/null || status=$?
    case $status in
      0) ;;
      2) echo "No kronikol-history branch yet: the first record starts it"; exit 0 ;;
      *) echo "::warning::could not read kronikol-history (git ls-remote exit $status): the tests run without history"; exit 0 ;;
    esac
    git -C "$repo" fetch -q --depth=1 --filter=blob:none origin refs/heads/kronikol-history
    mkdir -p "$out"
    for f in history.jsonl quarantine.json aliases.json; do
      if [ -n "$(git -C "$repo" ls-tree --name-only FETCH_HEAD -- "$f")" ]; then git -C "$repo" cat-file blob "FETCH_HEAD:$f" > "$out/$f"; fi
    done
    if [ -f "$out/history.jsonl" ]; then echo "KRONIKOL_HISTORY=$out/history.jsonl" >> "$GITHUB_ENV"; fi

# In each test job, after the tests: the fragments, as an artifact of their own. The name must be unique in
# the workflow run, so it carries the job, the matrix entry and the attempt (a reusable workflow called more
# than once needs a part of its own as well). Hidden folders are kept (.logs/kronikol/); a staged rotation,
# which every reader of runs/ ignores, is left out.
- name: Save the history fragments
  if: ${{ !cancelled() }}
  uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  with:
    name: kronikol-history-${{ github.job }}-${{ strategy.job-index }}-${{ github.run_attempt }}
    path: |
      **/History.run.json
      !**/runs/.incoming-*/**
    include-hidden-files: true
    if-no-files-found: warn
    retention-days: 7
# One job after every test job. It needs no checkout: it folds in a repository of its own.
record-history:
  needs: [test]
  if: ${{ !cancelled() && github.event_name != 'pull_request' }}
  runs-on: ubuntu-latest
  permissions:
    contents: write
  steps:
    - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
      with:
        pattern: kronikol-history-*
        path: ${{ runner.temp }}/kronikol-history-fragments
    # Kronikol.Tool needs a .NET 10 SDK to install, which GitHub's hosted images carry.
    - run: dotnet tool install Kronikol.Tool --tool-path "$RUNNER_TEMP/kronikol-tool" && echo "$RUNNER_TEMP/kronikol-tool" >> "$GITHUB_PATH"
    - name: Record the run on kronikol-history
      shell: bash
      env:
        TOKEN: ${{ github.token }}
        SERVER: ${{ github.server_url }}
        REMOTE: ${{ github.server_url }}/${{ github.repository }}.git
        FRAGMENTS: ${{ runner.temp }}/kronikol-history-fragments
      run: |
        basic=$(printf 'x-access-token:%s' "$TOKEN" | base64 | tr -d '\r\n')
        echo "::add-mask::$basic"
        export GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=Never GIT_CONFIG_COUNT=5 \
          GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= \
          GIT_CONFIG_KEY_1=core.autocrlf GIT_CONFIG_VALUE_1=false \
          GIT_CONFIG_KEY_2=core.hooksPath GIT_CONFIG_VALUE_2="$RUNNER_TEMP/kronikol-history-no-hooks" \
          GIT_CONFIG_KEY_3="http.$SERVER/.extraheader" GIT_CONFIG_VALUE_3= \
          GIT_CONFIG_KEY_4="http.$SERVER/.extraheader" GIT_CONFIG_VALUE_4="AUTHORIZATION: basic $basic"
        if [ -z "$(find "$FRAGMENTS" -name History.run.json 2> /dev/null)" ]; then echo "No History.run.json to record"; exit 0; fi
        repo="$RUNNER_TEMP/kronikol-history-record"
        for attempt in 1 2 3 4 5 6 7 8; do
          status=0; tip=$(git ls-remote --exit-code "$REMOTE" refs/heads/kronikol-history) || status=$?
          if [ $status != 0 ] && [ $status != 2 ]; then echo "::error::could not read kronikol-history (git ls-remote exit $status)"; exit 1; fi
          rm -rf "$repo"; git init -q -b kronikol-history "$repo"
          git -C "$repo" config user.name "github-actions[bot]"
          git -C "$repo" config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          if [ $status = 2 ]; then
            kronikol history init --history "$repo/history.jsonl"   # the first run: the header and merge=union
          else
            git -C "$repo" fetch -q --depth=1 "$REMOTE" refs/heads/kronikol-history
            git -C "$repo" reset -q --hard FETCH_HEAD
            tip=$(git -C "$repo" rev-parse HEAD)
          fi
          kronikol history record "$FRAGMENTS" --history "$repo/history.jsonl"
          git -C "$repo" add -A
          if git -C "$repo" diff --cached --quiet; then exit 0; fi   # every run here is on the branch already
          git -C "$repo" commit -q --no-verify -m "Record run $GITHUB_RUN_ID:$GITHUB_RUN_ATTEMPT (${GITHUB_SHA::7}) [skip ci]"
          if git -C "$repo" push -q --no-verify "$REMOTE" HEAD:refs/heads/kronikol-history; then exit 0; fi
          sleep "0.$((RANDOM % 9 + 1))"   # a competing push lands; a branch that has not moved means no race
          now=$(git ls-remote "$REMOTE" refs/heads/kronikol-history)
          if [ "${now%%[[:space:]]*}" = "${tip%%[[:space:]]*}" ]; then
            echo "::error::the push was refused and kronikol-history did not move, so this was not a lost race"; exit 1
          fi
          echo "Push $attempt lost the race to another run; recording again on the branch as it is now"
        done
        echo "::error::every push lost a race to another run; re-run this job, which is safe"; exit 1

Why each part is there:

  • A repository of its own, never a worktree of the checkout. It works with no checkout, with persist-credentials: false, and with any version of actions/checkout: v6.0.0 kept its token in a file a worktree could not see, and a worktree's push then failed on every run.
  • The token as a header, through the environment. It reaches no file, URL or command line. The server's header is emptied first, so a header the machine already holds is not sent beside it. credential.helper is reset, so a wrong token fails at once: a machine's credential helper would otherwise be asked, could wait for a person, and is told by git to erase what it stores.
  • Only git ls-remote's exit 2 means there is no branch. A wrong token, a missing repository and a server that is down all exit 128. Those stop the record step, and a new ledger is started only when the branch is truly absent (kronikol history init writes its header and its merge=union line).
  • A lost race is recorded again, never rebased. On a first run every writer makes its own root, and replaying one onto another duplicates every roster line under merge=union. Recording again on the branch as it now is loses nothing and duplicates nothing, because a run already in the ledger is a duplicate. Eight attempts cover eight record jobs finishing together.
  • A refusal while the branch stands still is not retried. A ruleset, a hook or a token that cannot write does not go away in a second, so the step fails at once and git's message above it says why.
  • The companions. quarantine.json and aliases.json live beside the ledger on the branch, and are read beside it. Without them a quarantined failure trips the gate, and a renamed scenario reads as one deletion plus one new.
  • core.autocrlf=false and no hooks. The ledger's bytes are the tool's, and a policy hook meant for people's commits does not stop the data commit. [skip ci] keeps a push made with a personal access token or an app token from starting another run.
  • The upload leaves a staged rotation out. kronikol history record up to 3.33.0 folds the fragments under runs/.incoming-* as well (3.34.0 leaves them alone), so the record step must never be handed one.
  • Pull requests are not recorded. Their runs are still read against the branch they target.

Both steps were run from this page's own text in the plan's harness (plans/HISTORY_ACTION_PLAN.harness), on Linux with Kronikol.Tool 3.33.0 from nuget.org. They passed a first run, a later run, the record job re-run (nothing new, so no commit), a quarantine kept on the branch (read by the next run and kept by its record) and a record job with nothing to record. Record jobs racing six at a time, in ten races on a first run and ten on an existing branch, lost no run and duplicated no roster line, recording again after 170 lost races. Over HTTP with the token, six more races lost none. A read-only token and a hook that refuses the branch each stopped the step after one push, and the token reached no output line and no file.

Pull requests

Verdicts are computed within a branch stream, and a pull request's runs form their own stream — so read against its own earlier runs, a pull request's first push is a cold start (here a stream with too short a ledger; the app's first-request cost is what the report calls first-call warm-up), when the question it asks is what changed against the branch it targets. So on a pull request build the run reads against that branch without being told (3.13.0): GITHUB_BASE_REF on GitHub Actions and SYSTEM_PULLREQUEST_TARGETBRANCH on Azure DevOps name it, and both are set only on pull request builds, so a push, a schedule and a manual run read their own stream as before. A failure that passed on main is the regression it is. The run's own line still records under its own branch, so the target's history stays the target's. HistoryBranch names any other stream to read against instead (3.12.0; an empty string is the run's own stream even on a pull request build), and HistoryCompareBranch adds a second reading beside the run's own rather than replacing it. kronikol history gate, kronikol query history and kronikol merge --history read the same way on a pull request build when --branch is not given.

Sharded and filtered runs

A run that lacks more than HistoryPartialThreshold (10%) of the previous run's scenarios — one test in the debugger, a --filter, a crashed half — is recorded as partial: nothing is reported absent from it. A scenario the previous run recorded as not a test (N) is none a run can lack: until 5.4.2 a run without the fold or the start-up the run before held was partial for it, and so was every run after it. The heuristic runs when the line is appended, against the ledger, so the shards of one run do not each declare themselves partial. HistoryPartialRun overrides it either way, set on every shard, and a shard's fragment carries only that and the threshold the run set, so the line is judged under HistoryPartialThreshold against its own branch's last full run. Until 5.28.2 a shard that could see the ledger, as under the history action, read itself as partial, the fold kept it, and the whole run's line read partial.

What a partial run is read for (3.23.0). Its pass or fail is a fact about the scenario. Its duration relative to the run and its set of captured calls are facts about the run's conditions: a filtered run is alone on the machine, or pays the cold start with fewer scenarios to spread it over, and with one worker running an ingest's window attribution is suddenly exclusive for everything. They differ in either direction (measured: ten times faster on one suite, a median 1.32 times slower on another, and in that second one every bar stood at 1.9 times the full run's from the mix of scenarios alone). So:

  • Status reads every run. A fix seen in a filtered re-run is the fix: the full run after it has nothing to announce. The P and F rows of filtered runs appear in a scenario's last runs, marked (partial).
  • A full run's durations and behaviour are read against full runs only. A partial run is in no p95 bar and no run speed, and it is not the run a full run's calls are compared with, nor one of the states alternating remembers, nor part of the stretch a call count must be constant over. Before 3.23.0 a partial run in the window could lift a scenario's bar several times over and hide a real slowdown, and a filtered run that captured 74 calls where the full suite captures 22 made the scenario alternating for the next ten runs.
  • A partial run itself still compares its calls with the run before it, full or not (a developer who filtered to one scenario after an edit wants to hear that its calls changed). It reads no slower: its speed is the median of an arbitrary subset, so nothing is scaled to it, and its bar is the plain p95 of what the scenario took in full runs, labelled as that.

The verdicts

Per scenario, computed within the run's branch stream (its branch on CI; runs off CI form the local stream), over the last HistoryWindow (50) runs of that stream recorded before the run's own line:

Verdict Meaning
broke failing now, passing in the previous run that had a verdict — a regression
failing failing now and in the previous run; the evidence says since which run and for how many
always-failing failing in every run of the window; never seen passing
fixed passing now, failing in the previous run
flaky it has failed, recovered and failed again, at or above HistoryFlakyRate (0.1) — or it passed on a retry the runner reported
new not in any earlier run of the stream
slower above the window's 95th-percentile duration by HistorySlowerBy (1.5×) in this run and the previous one, and over it by at least HistorySlowerMinMs (100 ms); every duration is read against its run's speed — the median of the other scenarios' durations in that run — so a slow runner lifts the bar with the readings (3.16.0)
behaviour-changed the same status with a different set of distinct calls than the previous run — or the same calls made a different number of times, once the count had been constant over HistoryMinRuns runs and the new count has held for HistoryCountRuns (2) consecutive runs (3.15.0; confirmed on the second run from 3.20.0): the run that shows the new count reads it out, the next run that still holds it is the verdict and names both. A count that wobbles run to run, or reverts the next run, is read out in the evidence and never tripped on
reordered the same calls in a different order, as many of them; only with HistoryReordered = true, because parallel steps reorder calls run to run. From 3.15.0 to 5.16.x it never fired, as every run counts its calls and the count's check took every such run first; it does from 5.17.0
alternating back on a set of calls it held within the last HistoryAlternatingRuns (10) passing runs, with a different set held in between (3.18.0): two states, both its own, and which one a run sees depends on ordering. A standing state like flaky, never a change, and not a summary count; the first sighting of each set is still behaviour-changed, and a set held only beyond the memory is a change again
unstable-shape the set of calls is new on most runs, so behaviour verdicts are suppressed for it
quarantined on .kronikol/quarantine.json (3.10.0); additive
unknown no verdict: a defaulted result, or a failure with nothing earlier to compare against

Flip rate, not fail rate. A scenario that failed five of ten in one block flipped once — it broke and was fixed. One that failed five of ten alternating flipped nine times — it is flaky. The fail rate is the same and cannot tell them apart. Only a pass or a fail counts as a verdict: skipping a test for a week neither creates nor hides flakiness, and a defaulted result (a scenario whose process died mid-run and took ResultWhenUnknown) is recorded as ?, never as the default, so a crashed worker cannot poison a trend.

Behaviour, not only status. With HistoryShapes on (the default) every scenario's calls are fingerprinted: caller>service method templated-uri status, with GUIDs, hex ids, ULIDs, timestamps and bare numbers in the path templated away and query keys kept but values dropped. An id is a GUID whose groups are joined by hyphens, by underscores (job_09c68d49_adcf_47be_bf9e_fc041cdc4a8e, which is how the BigQuery client names a job) or by nothing; a hex run of sixteen or more; a ULID; or, since 3.22.2, a hex run of 8 to 15 characters holding both a digit and a letter (a short digest, a short commit sha, the hash in app.3f9a1c2b.js). A word spelt in hex letters (facade, deadbeef) has no digit and stays, and so does anything under eight characters (abc123, v2, ff00aa). Bytes captured as text, which is what a raw hash in a cache key becomes (%1D(%EF%BF%BD4...), are {bin} from the delimiter before the first U+FFFD or control-character escape to the end of the path segment. A statement-shaped call (SQL, Cosmos DB, BigQuery, MongoDB and the rest) adds the first 120 characters of the statement, templated the same way, with what it carried as data dropped too: the values of a document, the literals of a query, while keys and quoted identifiers stay (3.14.0; before that a head cut before it was templated could keep the first characters of an id, and a scenario writing a fresh id read as behaviour-changed on every run). The templating rule has a version, recorded on the run line as shapeVersion, and fingerprints two rules made are never compared: the first run after an upgrade that changed the rule reads no behaviour verdict against the runs before it and says so. The version also moves when what a call records moves under it: 4.20.0 records a MongoDB command without the driver's fields in place of its bare filter, so every MongoDB call's statement head changed, and the version went to 5. In 4.20.5 a document's booleans, the signs of its numbers and the length of a list of scalars became data too ({b}, {n}, one element), so a test that generates its data no longer writes a new shape when a flag flips, and the version went to 6. In 5.13.0 a call to an unmapped remote host is named by its host and port, where it was localhost:{port} (see HTTP Tracking Setup), and the version went to 7. That move costs no quiet run: each run made in process also writes, on its line, its fingerprints under the rule before (bridge, below), and a run under 7 compares with a run under 6 through it. The rename reads as no change, while a real change across it still reads behaviour-changed and names the call. Across the move runs compare as rule 6 saw them: two remote hosts on one port still compare as one, and a new host on the port of a renamed one is not a new dependency on the first run across, though its scenario reads changed and names the call. A run rebuilt from a report by kronikol merge --history has no bridge, as a report does not say which names the fallback gave, so there the first run under 7 reads no behaviour verdict, as before. In 5.17.0 a call is read through one operation key, the one the first-call warm-up marks and the component diagram's endpoints read too, and the version went to 8: the path as the data file writes it, unescaped (/a b/ where the request had %20), with an entity a tracker writes where a host would go kept as its first segment (a Service Bus queue or topic, an S3 bucket, an EventBridge bus, a Redis database); a GraphQL request's operation (/graphql query GetUser, an anonymous one by its sorted root fields, query { menu }, and batch for an array of requests), read from a POST's body or a GET's query string; and a statement's head past a prologue of SET statements, or a document's query string rather than the document. That move costs no quiet run either: rules 6 and 7 are kept as functions of the raw call, so a run also writes its fingerprints under each rule its window's runs were made by. A tracker that records a call otherwise from 5.17.0 (an SQL Server batch opening with two SET statements, EF Core's Summarised address, Redis at Raw, an OTLP span whose system holds an underscore) marks it with what it recorded before, so rules 6 and 7 read it as 5.16 did, and a call it did not record before is no call under them, and no change in the count. Across the move runs compare as rule 7 saw them: a change of GraphQL operation on one endpoint made before the move is not seen, as rule 7 did not see it, and one made after it reads behaviour-changed and names the operation. In 5.27.6 the BigQuery and Cloud Storage handlers name the calls they drew as Other or misread, against an emulator or a gateway as against Google, record at Summarised the calls they dropped, and answer a send that throws (Integration BigQuery Extension, Integration CloudStorage Extension), and the version went to 9. That move costs no quiet run either: each call those handlers now record otherwise carries what the release before recorded for it, so rules 6 to 8 read it as it was, a call they dropped is no call under them, and a failed send is unanswered under them. One note is new once, and true: a service every call to which Summarised dropped reads as a new dependency on the first run. At the first run after the move a real change is named as the release before drew the call, as at every bridged move. In 5.27.7 an Oracle call, through the Oracle tracker, Dapper or EF Core, is drawn against the server and the service its data source names, where it named localhost and a database called unknown (Integration Oracle Extension), and the version went to 10: each such call carries the address the release before recorded for it, so rules 6 to 9 read it as it was. In 5.27.9 the Blob Storage and Storage Queues handlers read the container, the blob and the queue after Azurite's account, record at Summarised the calls they dropped, and answer a send that throws (Integration BlobStorage Extension, Integration StorageQueues Extension), and the version went to 11: each such call carries what the release before recorded for it, so rules 6 to 10 read it as it was. In 5.34.3 every tracker answers a call that throws, with the exception's type behind a bang, where many recorded no answer; a made-up 500 (TrackingProxy, gRPC with no gRPC status, MongoDB's client-side failures) and a broker's failure with no status read the type too; and TcpTap records a command whose connection closed before its reply (#232). The version went to 12: each such call carries what the release before recorded for it, so rules 6 to 11 read it as it was: an answer that is new is no answer under them, a status that moved reads as it was, and a call TcpTap did not record is no call. The plan's 45 probed failures each read the same under rule 11 as the published 5.31.1 recorded them. One move no mark bridges: the calls TrackingProxy's deferred queue filed under the next test that sent, after a send that threw, are filed under their own test, and the scenario that had them reads changed once. Two fingerprints are recorded — one over the set of distinct calls (the primary signal; a retry cannot move it) and one ordered — plus the call count. A scenario that still passes but now makes five calls where it made three is behaviour-changed once its count had been constant over HistoryMinRuns runs and the new count has held for HistoryCountRuns consecutive runs (default 2; 3.15.0, confirmed on the second run from 3.20.0). The run that shows the new count reads it out, calls 3 in gh:41:1 to 5 now; a count verdict needs the new count held for 2 runs, and the next run that still holds it is the verdict, naming both: the same calls made a different number of times: calls 3 to 5 in gh:42:1 and now, constant over the 12 runs before. An N+1 regression reads as one, a run later; a count that reverts the next run never trips (measured on a consumer's ledger, ten of thirteen count verdicts did, and the return reads back to the count held over the 12 runs before it), and a count that wobbles run to run — a retry against a throttled emulator, a consumer's work landing in whichever scenario is running — is read out in the evidence and never tripped on. HistoryCountRuns = 1 is the 3.15.0 rule. There is deliberately no base64 rule: measured, it templated route words like customers.

Named, not only counted (3.17.0). The run's distinct calls are written once, in the clear, on a shapes line the run line references, and each scenario carries its calls as indices into it. A behaviour-changed verdict for a different set therefore names what changed: same status, different calls: calls 3 in gh:41:1 to 4 now; new: Test>orders GET /api/orders/{n}/lines 200, with gone: for what disappeared, three of each in the evidence and the full lists on the verdict (NewCalls, GoneCalls; newCalls, goneCalls under kronikol query history --json). Against a run recorded before 3.17.0 the change is still counted, not named.

Flakiness and duration verdicts need HistoryMinRuns (5) verdicts; below that the status verdicts still apply and every surface says how many runs are recorded.

Your own templating rules (3.25.0). Cache-key formats are the application's own, and no built-in rule covers them all: a key holding a tenant, a hash and a period makes its scenario read behaviour-changed on every run, and once that has happened on most of HistoryMinRuns runs the scenario is unstable-shape and every behaviour verdict for it is suppressed, so the noise ends by hiding real changes. HistoryShapeTemplates says what is variable in yours:

options.HistoryShapeTemplates.Add(new(@"(?<=app:_report_)\d+-\w+", "{tenant-period}"));
options.HistoryShapeTemplates.Add(new(@"sess_[0-9a-z]+", "sess_{id}"));

An ordered list of .NET regular expressions and what replaces each match (a replacement pattern, so $1 keeps a group), applied to a call's path and to a statement head before the built-in rules, which then see what yours left. The service card's operations follow the same rules from 5.21.0, read from the report, so a card and history key a call alike. Three things keep it safe to use:

  • A rule edit costs no quiet run (5.17.0). The rules have a hash, recorded on the run line as shapeRules beside shapeVersion, and since 5.17.0 their patterns too (shapeTemplates): a run fingerprints its calls under every earlier set of patterns its window holds as well, and compares through that, so editing, adding or removing a rule reads as no change. That holds in process and through kronikol history record, which bridges the window's patterns from the run's calls as the fragment carries them (rawCalls, below). Only an edit away from rules last used before 5.17.0, whose run lines hold no patterns, costs one quiet run: the first run after it reads no behaviour verdict and says so.
  • A rule sees the path as the data file writes it (5.17.0): unescaped, /a b/ where the request had %20, as the report shows it. A pattern that holds a %XX escape is reported as a HistoryShapeTemplate diagnostic naming what the path holds instead. Before 5.17.0 the rules saw the escaped path; the bridge keeps reading rules 6 and 7 that way.
  • A bad expression cannot fail a test run. A pattern that does not compile, or that runs past 250 ms on some text, is skipped and reported as a HistoryShapeTemplate diagnostic.
  • Shards should be given the same rules. kronikol history record folds shards into one run line. When shards were fingerprinted under different rules of yours, or by different Kronikol versions, it records the run's fingerprints under a rule every shard reaches through its bridges (5.17.0), the older one's through the newer shard's bridge; only when no rule is shared does it record the run without fingerprints, which costs that run its behaviour verdicts and nothing else, and says so. A shard with HistoryShapes off folds beside the others with its scenarios unfingerprinted.
  • The report carries them too (5.19.0). The data files record the rules as shapeTemplates when there are some (Generated-Reports), so a reader of the report keys a call as the run's history did: kronikol query interactions --group-by route, the call pairing of diff --body and compare, and kronikol merge, which keeps them when every shard records the same ones and fingerprints the merged run under them for --history. kronikol ingest --shape-templates FILE gives an ingested run its own (Ingesting-External-Captures).

Two things tell you a rule is missing or wrong. The evidence of a behaviour-changed verdict says the calls differ only in what looks like an id (sess_ab1… → sess_zz9…): a HistoryShapeTemplates rule would make them compare equal when the new and the gone lines pair one to one once every run of letters, digits, hyphens and underscores holding a digit is masked. It is a hint and the verdict stands, because /v2/ becoming /v3/ pairs one to one too. And kronikol query history <report> s3 --calls prints what the templater made of a scenario's calls, so a wrong {id} (two routes collapsed into one line, a real change gone) can be seen rather than suspected. kronikol merge and kronikol ingest take no rules: they build a run's history with fixed options.

Degraded runs (3.24.0). A failure inside a run where everything was slow is weak evidence against the test, and one bad day on a shared CI agent explains a whole cluster of "new flaky tests". The ledger already holds every number needed to say so. A run's pace is the median, over the scenarios that passed in it and usually take at least 10 ms, of duration in the run over the scenario's usual: its median passing duration over the other full runs in the window. Each scenario is measured against itself, so a roster that gained fifty slow scenarios has the pace it had; passing scenarios only, so timeouts do not inflate it; a partial run is in no usual and has no pace. A run whose pace is at or over HistoryDegradedBy (2.0) is degraded. Measured on one suite: 407 healthy runs never read above 1.56, three runs under real CPU contention never below 6.85, and a run merely pinned to one processor with nothing competing read 1.68 and, rightly, was not labelled (its wall time rose 20% and it handed out no false verdict).

  • Pass and fail are never discounted. A failure in a degraded run is a failure: it counts towards the flip and fail rates, and flaky fires as it did. It is labelled: the evidence of a failing scenario says this run was degraded: its passing scenarios took 2.3× their usual, a flaky verdict whose failures all sit in degraded runs leads with that, history sN prints failed 1 (1 in a degraded run), and the failing row carries [run degraded: …].
  • No slower verdict is read in a degraded run, or against one. Under contention the slowdown is nowhere near uniform (one measured run: p25 2×, p50 7×, p90 54×), so reading each scenario against its run's speed cannot absorb it, and every scenario whose previous reading happened to sit over its bar was handed a slower: 5, 20 and 7 of 203 scenarios in three contended runs, all false, none with the rule. Left in the baseline a degraded run costs again, because the p95 of a dozen readings is their maximum: in the healthy run after two contended ones 47 of 198 bars stood more than 1.5× too high. The price is one run of delay for a genuine regression that lands during a degraded run.
  • A reading over its usual is a fact, not a cause. history sN prints (6.4× usual) on any row at or over the factor and at least HistorySlowerMinMs over its usual, failing or not. A failing test is usually slow because it failed (a polling assertion ran to its timeout), so only the run's own label says anything about the machine. A row is read against its usual from two other full-run readings; a run is paced only once at least five scenarios have HistoryMinRuns other readings each, because its label gates a verdict (measured over 394 healthy runs, a run paced against two to four others read 2.0 or more one to three times in a thousand, and against five never). On a younger ledger nothing is said about the run, and the degraded one is labelled after the fact.
  • The limit. Pace cannot tell a slow machine from a suite that really did get twice as slow everywhere (a debug build, a new container). Such a shift reads as degraded until the shifted runs are half the window, the first 25 at the default, and then stops by itself. slower was already blind to a uniform shift by construction, and "passing scenarios took 2.3× their usual" on every run is the first surface that shows one at all. HistoryDegradedBy = 0 switches the whole thing off.

The other state, named (3.23.0). When a scenario is alternating and the previous run held the same set as this one, the diff against the previous run is empty, so the evidence used to name no call at all. It now names the state the scenario alternates with: ...; other set last held in gh:41:1; new there: Api>cache GET /k 404; gone there: Api>cache GET /k 200, from the most recent run in the memory that held a different set. NewCalls and GoneCalls stay the run-to-run lists, and are empty then.

At run level: the scenarios absent (in the previous full run of the stream, not in this one, and this one not partial), the new caller>service dependency pairs, the pass-rate and duration series.

In the HTML (4.6.0)

From 5.0.0 a default TestRunReport.html shows the history the run read in its History tab, and nothing of it in the features: each scenario's sparkline and verdict are on the labs page beside the report, and in the report only with ShowScenarioHistory. From 4.6.0 to 4.x a default report carried no history at all. The labs page was the one place it was drawn, and ShowHistorySection, off by default from 3.21.0, put the History section back in the report beside the Scenario Timeline.

The History tab (5.0.0)

With ShowHistorySection on, the default from 5.0.0, a report whose run read history has a History tab in its report bar (Generated Reports › The other tabs). It holds the History section, open in its tab:

  • the run's reading: the summary line (1 broke, 2 flaky (against 12 earlier runs on main)), the stream, the run id and how many earlier runs are in the window, and the HistoryCompareBranch reading when one is set (on main: 1 broke (against 12 earlier runs on main)). On a cold start it says how many runs it has and how many the statistical verdicts need;
  • the trend of the last runs: the pass rate as a ring per run, drawn like the run band's ring with the rate inside, never 100% while any scenario of the run did not pass, and with a fail arc for a run that failed, each ring keeping its run's tooltip; and the total duration as bars that carry their time (850ms, 44s, 2m 26s, 1h 5m). An Order control above the two cards shows both newest first, the default from 5.10.0, or oldest first, as every page did before. Each card keeps its runs on one line, and a window too long for the card scrolls inside it and opens on the newest run in either order. The control is two radios that the stylesheet reads, so the labs page, which runs no script, orders the cards too; nothing keeps the order, so a page opens newest first;
  • the lists: new failures, failing since, flaky, newly fixed, slower, behaviour changed, new scenarios, quarantined, absent since the previous run, and new caller>service dependencies. Each scenario links to its place on the Features tab, and each kind of verdict pill has its own colour, in the light and the dark theme.

The tab is there only when the run read history, with EmbedHistoryInReport on; ShowHistorySection = false leaves it out. 4.x drew the trend as a bar chart, svg.history-chart-svg with the history-bar-pass, history-bar-fail, history-bar-duration and history-bar-partial classes; a stylesheet or a script that reads them finds none.

The labs page (4.6.0)

What the run read is also drawn on a page of its own beside the report, the labs page: {HtmlTestRunReportFileName}.labs.html, so TestRunReport.labs.html by default and Checkout.labs.html beside Checkout.html. Under its title it says what it is ("Labs: views still being designed. Their layout may change in any release."), and it holds:

  • a header: the report's title with a "Labs" badge and, from 5.0.0, the report's light and dark switch, then the suite, the run id, when the run ended, and, when a report is written, a link back to it;
  • the History section, always open: the same section as the report's History tab;
  • Every scenario, a collapsed table in report order: each scenario's sparkline of its last runs (oldest on the left, this run on the right, one colour stop per run: green passed, red failed, grey skipped or absent; the verdict and each run's commit, date, result and duration in its tooltip), its verdict (stable when there is nothing to say) and the evidence;
  • the Report diagnostics list, always open, when the run recorded a diagnostic (see Diagnostics and Debugging).

The page is written when the run read history (with EmbedHistoryInReport on) or recorded a diagnostic, and only then, and it draws the History section and the table only when there is history. A run whose ledger file does not exist yet reads it as empty and shows its own first run; a run with no ledger to read (history off, or no ledger found) has no history to show. GenerateLabsReport = false turns the page off.

From 5.0.0 the page opens in the report's light or dark theme (Report Themes) and runs only the theme's two scripts; before 5.0.0 it had no script. Each scenario name links into the report by its stable id, TestRunReport.html#sid-<stableId>, which the report opens on load, on its Features tab, as it does a link from Failures.md; with GenerateTestRunReport = false the names are plain text. The page is listed in Run.json and moves with its run under runs/ (Earlier runs), and the run-end pointer lists it after the report. kronikol ingest and kronikol merge write it too.

Each scenario's history, when asked

ShowScenarioHistory = true (4.6.0, still off by default in 5.0.0) draws each scenario's history in its header, as every report that read a ledger did from 3.11.0 to 4.5.x: the sparkline beside the duration badge, a pill for any verdict other than stable (broke, failing, always-failing, fixed, flaky, new, slower, behaviour-changed, quarantined), and the data-history-verdicts attribute the search reads. A parameterised group carries the union of its rows' verdicts and one pill for the worst of them, and each example row carries its own. The sparkline is a single element whose background paints the runs, so two hundred scenarios cost the page two hundred nodes and the filter and toggle budgets stay where they were. It needs EmbedHistoryInReport and a ledger to read.

A report carries the stylesheet rules of the history views only when it draws them, and the verdict search code only with ShowScenarioHistory. To keep the scenario headers 4.5.x drew, set ShowScenarioHistory = true; the History section is the report's History tab from 5.0.0, on by default. From 3.21.0 to 4.x the section was in the report only with ShowHistorySection = true, beside the Scenario Timeline, open when there was something to say.

The search of a report drawn with ShowScenarioHistory takes the verdicts with the $ sigil, or from 5.11.0 with status: (status:flaky), beside the statuses, and they combine: $flaky, $failed && !!$flaky (the regressions), $passed && $flaky (the flaky ones that passed this time), $stable. An execution-result name ($failed, $passed, $skipped) always means the status and is never looked up as a verdict. In a default report the verdict operators match nothing, without an error. See Search and Filter Syntax.

Export Filtered HTML of a report drawn with ShowScenarioHistory keeps the sparklines and pills, which live in the scenario headers it copies, and leaves the History tab behind on purpose, as it does the other tabs and the report bar. A default report's export carries no history.

EmbedHistoryInReport = false keeps history out of the page and the report alike. The ledger is still read and still appended to, and Failures.md, the CTRF document, the pointer and History.run.json are not affected. Specifications.html gets none of it: a specification has no run history.

Which runs a run is read against

The last HistoryWindow runs of the stream that were appended to the ledger before the run's own line. While a run is being generated that is simply the end of the ledger, because its line is written afterwards. It matters when a report is read again later, which is what kronikol query history, kronikol history gate and kronikol merge --history do: the runs recorded since are not the run's history, and it reads exactly as it did when it ran. A run the ledger does not hold reads against all of it.

Before 3.25.1 two things went wrong here (#95). A report that was not the newest run of its suite counted the later runs as earlier ones, so a scenario could read fixed from failures that had not happened yet, and a report older than the window saw nothing but later runs. And the window was the last 50 lines of the suite, whatever their branch, so where pull request runs outnumber runs of the branch they target, that branch had few runs in its own window, or none, and its scenarios read as new. The window now belongs to the stream. kronikol history show still lists the suite's last runs as they are in the file.

Reading it back: kronikol query history

kronikol query history <report>                          # every scenario with a verdict, regressions first
kronikol query history <report> --flaky                  # only the flaky ones (also --new --failing --regressed --changed)
kronikol query history <report> s3                       # one scenario: verdicts, the numbers, its last runs
kronikol query history <report> --branch main --compare-branch feature/x
kronikol query history <report> --min-runs 3      # the bar the suite reports with (HistoryMinRuns); 3.14.0
kronikol query history <report> --alternating-runs 10   # how far back a set of calls counts as a known state (HistoryAlternatingRuns); 3.18.0
kronikol query history <report> --count-runs 2    # runs a changed call count must hold before it is behaviour (HistoryCountRuns); 3.20.0
kronikol query history <report> --degraded-by 2   # the pace at which a run is degraded (HistoryDegradedBy); 0 switches it off; 3.24.0
kronikol query history <report> s3 --calls        # the scenario's distinct calls as the templater wrote them; 3.25.0
kronikol query history <report> --json
kronikol query history --run last-failed          # no report at all: the run a re-run overwrote, from the ledger; 3.26.0
kronikol query history --run previous --sid <id>  # one scenario of it; --window N is how far back it is read against

The ledger is --history FILE, else $KRONIKOL_HISTORY, else the .kronikol/history.jsonl above the report's directory or the working directory. The History.run.json beside the report is preferred as the run's own line (it carries the fingerprints); without it the report itself is read, and the tool says that behaviour verdicts are off. See Querying Reports for the output.

The report is not the run you want (3.26.0). A re-run overwrites the reports directory; the ledger keeps every run. kronikol query history with no report reads a run from its own ledger line: the newest, or --run (an id, a unique part of one, last-failed, previous), against the runs recorded before it. And when a filter comes back empty the answer now says it is empty of this run, names the scenarios that failed earlier in the window, and gives the real reason a scenario that has flipped is not flaky. Both are described under Querying Reports.

Merged reports. kronikol merge <shards> --history <ledger> (3.11.0) reads the merged run against the ledger: the history lines in Failures.md, the summary in the pointer, and since 4.6.0 the labs page beside the merged report (<output>.labs.html), which also lists the shards' diagnostics. From 5.0.0 the merged report has the History tab, as a run's report does; from 4.6.0 to 4.x it carried no history, and before 4.6.0 it drew the History section, sparklines and pills. It never writes to the ledger: folding the shards' History.run.json fragments is kronikol history record's job, because a merge is a render and a render that recorded would count every re-render as a run. Until 5.27.14 a merge read a label that is a verb in another casing as the verb, so Delete came out as DELETE, and identical runs read as behaviour-changed against the Delete the run had recorded. See Merging Parallel Reports.

Maintenance: kronikol history

Verb What it does
record <dir|fragment>... fold every History.run.json under the inputs into the ledger
init create the ledger above the working directory and add the merge=union attribute
show [--suite NAME] [--window N] what the ledger holds: per suite, the runs, the streams, the last run
verify check the file's structure; exit 1 with every finding when it is not sound
prune [--window N] rewrite without the runs outside the window — a read-cost control, not a storage one: dropping the oldest line breaks git's delta chains and makes the repository larger
compact [--window N] rewrite in the current format, every run kept, error text kept for the window
gate <report|dir> [--fail-on LIST] … (a TestRunReport.krkl from 4.30.0) the CI gate: exit 1 on what the ledger says is new — see below
quarantine <sid> --reason TEXT [--by NAME] [--until DATE], --release, --list .kronikol/quarantine.json beside the ledger
rename <old-sid> <new-sid> .kronikol/aliases.json: history recorded under the old id reads as the new one
record … --accept-renames write the renames record suggests
doctor [<reports-dir>...] the ledger, its companions, the merge attribute, what is damaged or expired; with a reports directory (3.27.0), the runs kept under runs/, the newest failing one, and what an interrupted rotation left - answered even when history is switched off
import <report|dir>... [--from-ctrf|--from-allure] [--suite NAME] [--branch NAME] [--run-id ID] runs from reports the run did not write

All take --history FILE. Nothing rewrites the ledger wholesale during a test run; prune and compact are the only such rewrites and both are explicit. The one line a test run does replace is its own, when a retry of the same run appends again (3.27.0, a retry is an attempt).

The gate: kronikol history gate

kronikol history gate ./Reports                                   # exit 1 on a new failure; everything else read out
kronikol history gate ./Reports --fail-on new-failures,flaky      # also trip on flakiness
kronikol history gate ./Reports --max-new-failures 2 --min-pass-rate 0.95
kronikol history gate ./Reports --fail-on duration-regression --slower-by 2
kronikol history gate ./Reports --min-runs 3                     # the bar the suite reports with (HistoryMinRuns)
kronikol history gate ./Reports --alternating-runs 10            # how far back a set of calls counts as a known state (HistoryAlternatingRuns)
kronikol history gate ./Reports --count-runs 2                   # runs a changed call count must hold before it is behaviour (HistoryCountRuns)
kronikol history gate ./Reports --degraded-by 2                  # the pace at which a run is degraded (HistoryDegradedBy); in one, no duration-regression is read and an advisory line says so

A gate that fails on any red cannot tell a regression from the test that has flipped for a month, and a team that cannot tell them apart learns to ignore red. This one trips on what the ledger says is new and reads the rest out loud without tripping.

Category Trips when Default
new-failures more than --max-new-failures (0) scenarios fail now with the broke, new or unknown verdict and are neither flaky nor quarantined on
flaky any scenario the ledger calls flaky (the flip rate is --flaky-threshold, default 0.1) off
duration-regression any scenario slower than the window's p95 by --slower-by (1.5), this run and the last, and over it by at least --slower-min-ms (100 ms) off
behaviour-change any scenario with the same status and a different set of calls off
pass rate --min-pass-rate X and the run's passed ÷ (passed + failed) is below it off

Below the minimum number of recorded runs (five; --min-runs N gives the gate the bar the suite reports with, since 3.13.0) the flaky, duration and behaviour categories are advisory: printed with the word advisory, never tripped on, because the ledger does not have those verdicts yet. A regression and the pass rate are enforced from the first run. The output lists every category with its scenarios, verdicts and evidence, the pass rate, and ends with gate: passed or gate: FAILED (new-failures 1 > 0). Exit 0 clean, 1 tripped, 2 usage — an unknown --fail-on category, a report that cannot be read, or no ledger at all. --branch NAME reads against another stream, as query history does; without it a pull request build reads against the branch it targets, as the run did (3.13.0).

The gate needs the ledger before the run's own line is recorded — it compares the report against the runs that came before it — so on CI it goes between the test step and kronikol history record. A quarantined failure trips nothing in any category.

A retry is an attempt, not a shard (3.27.0)

A test runner's retry extension (--retry-failed-tests), or a second workflow step, runs again in a new process under the same CI run id and in the same reports directory. Until 3.27.0 that lost the failure entirely: the retry's History.run.json overwrote the first attempt's, and history record stored one run of one passing scenario. Folding the two as shards would be worse: a shard fold gives a repeated id a second slot, so the retried scenario would read broke plus a new scenario of the same name, and fixed plus absent in the next run.

The ledger format has had the right home since v1: attempts. With kept runs the first attempt's fragment is under runs/, and:

  • kronikol history record <dir> groups what it finds by reports directory. The fragment on top and the kept fragments with its run id are attempts of one another and are overlaid, oldest first by the run's own clock: a scenario run again keeps its one position, takes the later attempt's result, duration and calls, and counts the attempts. A scenario only one attempt ran is kept as it is. Kept runs with another id are left alone (they were recorded, or not, by the run that wrote them). Fragments in different directories are shards and fold exactly as before. The line reads gh:7:1 Suite 3 scenarios, 2 attempts.
  • The retried run then reads flaky (… passed on retry 2 in this run), which is what the analyzer has always made of attempts, and the next run reads nothing.
  • A pass on retry keeps the failure's error text on its now-passing position, so the message outlives the report. Every surface says whose it is: attempt 2 and, under the row, an earlier attempt failed: … in query history, passed on attempt 2 · … · an earlier attempt failed: … in the sparkline's tooltip (on the labs page, and in a report drawn with ShowScenarioHistory).
  • A run that appends to the ledger itself (any job with KRONIKOL_HISTORY=<file> or HistoryFilePath, and every run off CI) used to have its retry swallowed as a Duplicate, leaving attempt 1's failure on record for a job that went green, then a fixed that never happened. The retry now amends the run's own line: the two are overlaid by the same function record uses and the line is replaced in place, under the writer's lock, every other line keeping its bytes and its order. It is the one rewrite a test run performs, and a narrow one: only the run's own line, written seconds earlier by the same job; a line that is not older than the run is the same attempt written twice and stays a duplicate. Known limit: two matrix legs with the same suite name appending to one shared file are read as a retry and the later leg wins (before, the second leg was dropped). Give each leg its own suite name, which is the documented setup.

Quarantine, renames, the doctor, imports

kronikol history quarantine aaaabbbbccccdddd --reason "flaky since the DB upgrade, ticket 123" --by me --until 2026-12-31
kronikol history quarantine aaaabbbbccccdddd --release
kronikol history quarantine --list
kronikol history rename aaaabbbbccccdddd eeeeffff00001111
kronikol history record ./Reports --accept-renames
kronikol history doctor
kronikol history import ./old-reports/run-41 ./old-reports/run-42
kronikol history import ./ctrf --from-ctrf --suite Checkout
kronikol history import ./allure-results --from-allure --suite Checkout --branch main

Quarantine is .kronikol/quarantine.json beside the ledger, committed like the ledger. A quarantined scenario still runs and still records; it carries the quarantined verdict on every surface and never trips the gate. A --reason is required — the ticket, the sentence a reviewer reads in the diff — and --until expires the entry on a date. The stable id is the sid: the query output prints (kronikol query history <report> s3 shows it); the prefix is accepted.

Renames. A scenario whose stable id changed — it moved feature, or was retitled — would otherwise read as one deletion and one new. rename <old> <new> writes .kronikol/aliases.json and the history recorded under the old id reads as the new one; the ledger is never rewritten. record notices the likely renames on its own — an id present only in the previous full roster whose feature and name match an id present only in the new one — prints them as suggestions, and --accept-renames writes them. Suggested by default, written only when asked. Before 5.17.0 renaming more than a tenth of a suite made the next run read as partial, whose durations are not compared, because the partial check read the previous roster without the aliases; it reads it through them, as import does.

A change in how Kronikol shows a name is no rename (5.9.1). A Gherkin feature's title shown as written, and a word with an apostrophe kept whole (Month's, where 5.9.0 wrote Month S), change no scenario's stable id: the id is still computed from the name as 5.9.0 wrote it, so the history recorded before goes on under the same ids. The same holds for 5.16.5, where a title made from a method's name keeps its words in capitals and a name the test wrote is shown as written: each scenario whose name reads otherwise records the name 5.16.4 showed (stableIdName in the data files) and its id is computed from that. The ledger's list of a suite's scenarios takes the new names from the first run that shows them.

Doctor prints one page: where the ledger is and what KRONIKOL_HISTORY says, format and generator, damaged lines, the suites with their runs and streams, runs recorded without a suite, the merge=union attribute beside it, the quarantine list with any expired entry, the alias file. Exit 1 with doctor: N problem(s) when anything needs a hand; each line says what to run.

Import records runs the ledger did not see. A Kronikol reports directory imports from its TestRunReport.json (or from 4.30.0 its TestRunReport.krkl, the newer when both are there) — the run id from the CI metadata, durations, branch and commit — so a ledger started today can be back-filled from the artifacts kept. --from-ctrf reads a CTRF document from any tool: extra.stableId when the writer set one, otherwise the id is computed from --suite, the test's suite and its name the way Kronikol computes its own; retries becomes attempts, the failure message the error key, keyed as a run keys it (before 4.22.3 by its first line alone, so a Shouldly failure imported and the same failure recorded read as two causes), environment.branchName the stream. --from-allure reads an allure-results directory: the latest attempt per historyId, the attempt count, broken as failed, the feature or suite label as the feature. --run-id and --branch override what the file says. Imported runs carry results, attempts and durations; behaviour verdicts need the History.run.json a Kronikol run writes.

Alongside other tools

CTRF. The ctrf-report.json a run writes sets flaky from the ledger and carries the verdict under extra.kronikolHistory, so a downstream such as ctrf-io/github-test-reporter lists the scenario in its Flaky Tests table (flaky-report: true — the table is off by default). Its flakiness rate, on the other hand, is computed from retries alone: a test that flips without retrying scores 0.00%, so the same PR comment can show a populated flaky list beside an overall flakiness of zero. That is a flaky list entry, not a flaky rate, and the two tables are not contradicting each other. Kronikol never emits a synthetic retries count to move that rate, and never populates insights, which that tool computes itself and overwrites. One more thing worth knowing before relying on that tool's own history: its cross-run identity is the test's display name, which its use-suite-name input rewrites — so turning that input on or off silently resets its history. Kronikol keys history on the stable id, which a rename is explicitly told about (kronikol history rename).

Azure DevOps offers retry-based flaky detection for VSTest users of its own test service; the JUnit XML Actions offer pass/fail trends from artifacts. Neither sees behaviour drift on a passing test, and neither can be read from a checkout. What Kronikol does not build is listed in the plan's §14: no hosted dashboard, no rerun orchestration, no cross-repository aggregation.

Options

All on ReportConfigurationOptions; see Report Configuration.

Option Default Purpose
HistoryFilePath null the ledger, instead of the resolved one
HistoryRunId null the run identity on a CI provider Kronikol does not detect
HistoryWindow 50 runs of the stream looked back over, before the run's own line; also bounds the read cost
HistoryMinRuns 5 verdicts needed before flaky and slower are judged
HistoryDurations true record durations (the slower verdict and the duration trend)
HistoryShapes true record the interaction fingerprints and call counts
HistoryErrorKeys true keep the first line of each failure message (with a Shouldly message's check from its second line, or for Shouldly's text without its source the check and its expected value; ≤ 200 chars) as the cluster key; false keeps a hash only, so no message text reaches the ledger
HistoryFlakyRate 0.1 the flip rate at or above which a scenario is flaky
HistorySlowerBy 1.5 the factor over the p95 that makes a run slower; durations are read against the run's speed (3.16.0)
HistorySlowerMinMs 100 the least a scenario must be over the bar, in milliseconds, before it is slower (3.16.0)
HistoryAlternatingRuns 10 how far back a set of calls the scenario held counts as a known state (3.18.0)
HistoryCountRuns 2 how many consecutive runs a changed call count must hold before it is behaviour; 1 is the 3.15.0 rule (3.20.0)
HistoryShapeTemplates none your own templating rules: an ordered list of (regex, placeholder) applied before the built-in ones, to the path as the data file writes it (unescaped, 5.17.0); hashed onto the run line as shapeRules and, from 5.17.0, recorded as shapeTemplates, so an edit is bridged and costs no quiet run; from 5.19.0 written into the report's data files as well, for kronikol query's route, call pairing and kronikol merge; a bad expression, or one that holds a %XX escape, is a diagnostic, never a failed run (3.25.0)
HistoryDegradedBy 2.0 the pace at or above which a run is degraded: its passing scenarios took this many times their usual. Labelled everywhere, a failure inside one says so, and no slower is read in it or against it; 0 switches it off (3.24.0)
HistoryPartialThreshold 0.10 the share of the previous run a run may lack before it is partial
HistoryPartialRun null say outright whether the run is partial
HistoryReordered false report a reorder of the same calls
HistoryBranch null read against another branch stream; null reads a pull request against the branch it targets (3.12.0, the default 3.13.0)
HistoryCompareBranch null a second stream, read out beside the run's own (3.12.0)
GenerateHistoryFragment true write History.run.json beside the report
WriteHistoryLedger null append to the ledger: null = when named explicitly or off CI; true always; false never
EmbedHistoryInReport true the master switch for history in the run's HTML: the labs page's History section and scenario table, and the report's History tab and scenario history below; false keeps history out of both, and Failures.md, the CTRF document, the pointer, the fragment and the ledger are not affected (3.11.0; the labs page since 4.6.0)
GenerateLabsReport true write the labs page beside the report, {HtmlTestRunReportFileName}.labs.html, when the run read history or recorded a diagnostic (4.6.0)
ShowScenarioHistory false the sparkline, verdict pill and data-history-verdicts attribute in each scenario header of the report, with $flaky and the other verdict operators in its search (4.6.0; still off in 5.0.0)
ShowHistorySection true (false from 3.21.0 to 4.x) the report's History tab (5.0.0); from 3.21.0 to 4.x, the History section in the report, beside the timeline

The file

One header line, roster lines, run lines — each a JSON object on one line, ASCII-escaped, LF-terminated, keys in a fixed order, so the same run serialises to the same bytes on every platform and git sees one line. A roster is the ordered scenario list a run's results are positional against, interned under a content hash of the suite and its ids: the same set is the same key on every branch (so merge=union de-duplicates it) and a different set is a different key. A run references its roster by hash and carries one result character per position — P passed, F failed, S skipped, B bypassed, A skipped after failure, ? no verdict, . absent, N not a test (3.23.0: the scenario an ingest folds unattributed traffic into with FoldUnknownTestsInto; it exists only in the runs where such traffic survived, so it reads no verdict and is never reported new or absent, and it keeps its position because a roster position is the scenario's sN address; a reader from before 3.23.0 takes it as it takes a skip; from 5.2.6 the data files carry it as notATest, so a report kronikol merge writes reads it too, where before the merged report lost it and its history called the scenario passing) — plus attempts, durations, calls, the two fingerprints, error keys (text per line, so a dropped line loses nothing else) and dependency pairs. Since 3.17.0 a run's distinct calls are interned too: a shapes line ({"t":"shapes","hash", "calls":[...]}, keyed by a content hash of the sorted list) that the run line names as shapes, with callSets giving each position's calls as indices into it. kronikol history verify checks the hash, the reference and the indices; prune and compact drop a shapes line no surviving run references. Since 5.13.0 a run may also carry a bridge: its two fingerprints, call sets and dependency pairs under an earlier fingerprint rule, keyed by that rule ("6", or "6+<hash of your rules>"). A member is written only where it differs from the run's own, so a run the rule changes nothing in writes {}, and the bridge's call sets go in a shapes line of their own. A run made in process writes it while runs under that rule are in its window, and kronikol history record keeps it on the same terms; verify checks it as it checks the run's own, and prune, compact and both folds keep it. A tool older than 5.13.0 reads the line and ignores the bridge, and its prune or compact drops it. Since 5.17.0 a bridge also holds calls, each position's call count under its rule, where that differs from the run's own, and the analyzer compares counts under one rule as it compares sets; the keys are "6", "7", "8", "9", "10" and, under your rules, the rule and their hash, and a run fingerprints under every earlier set of your patterns its window holds as well as under every earlier rule. Since 5.14.0 a run that declares its service (ServiceId, Report Configuration › Parties) carries it as serviceId, the line's last member; a run that declares none writes no such member. It is not part of a stream's key, which is still the suite. Both folds keep it only when every shard or attempt has the same one, as kronikol merge does, and kronikol query history takes it from the report. Every released Kronikol skips a member it does not know, so the ledger's version does not move; a tool older than 5.14.0 drops it from the lines its prune, compact or amend writes, and the next run writes its own. Since 5.17.0 a run line names the Kronikol that recorded it (generator), records your templating patterns beside their hash (shapeTemplates), which is what lets a later run bridge an edit of them, and may carry aliases: when Kronikol changes what a scenario's id is computed from, the run writes the ids the earlier rule gave beside the ids it gives, and the analyzer, record and import read them as they read aliases.json, so the change reads as neither a rename nor a partial run. No release has changed an id yet. A line of a kind this Kronikol does not know is read past and kept, where it was counted as damaged; kronikol history doctor counts such lines, prune and compact keep them and the header's writer, and both folds keep the run members they do not know.

The fragment. History.run.json holds one run, with its roster, shapes and bridges, for kronikol history record to fold. Since 5.17.0 it also carries the run's calls before any rule (rawCalls: each distinct call once, and each position's calls as indices into them), so that record, import, gate and query history, which have the ledger, can bridge the patterns its window was fingerprinted under, as a run that reads its ledger does from its logs. rawCalls never reaches the ledger. It holds what a report holds less the bodies: each call's caller, service, method, path and query string as the request had them, GraphQL operation, status, and the first line of a statement, up to 2,000 characters. Measured on BreakfastProvider's lanes it adds 15% to 76% to a fragment (18 KB to 147 KB; 2 KB to 20 KB gzipped), most of it the first lines of SQL statements. A tool older than 5.17.0 folds such a fragment and passes over the member, and record says when a fragment is newer than the tool that folds it: ! a fragment newer than this tool, folded as this tool reads it, with the version to install.

Appends take an exclusive lock with a jittered retry — measured, a plain append from thirty-two processes silently lost a third of its lines on every file system tried — and a writer that cannot win the lock within its budget says so and keeps the fragment. Readers scan every line but parse only the windowed runs per suite; a damaged line (a torn tail from a killed process) is skipped and counted, and the next append starts on a fresh line. A file declaring a newer historyFormatVersion is refused by the reader and the writer alike: an older line in a newer file is a file neither version reads correctly.

What it costs at the end of a run. Reading follows the bytes of the suite's last HistoryWindow run lines, and the analysis is linear in scenarios × window. Measured at 5,000 scenarios over 50 runs, on lines that carry everything a run writes (15.6 MB): about 0.2 s to read and 0.2 s to analyse once the code is compiled, and about 0.7 s and 0.5 s in a fresh process, which is nearer to what the one call at the end of a run pays. On suites of about 200 scenarios an analysis is about 3 ms. Before 3.25.2 the analysis was quadratic in the number of scenarios: 2 to 3 s at 5,000 on every run with history on, and about 7 s through kronikol query history and kronikol history gate (1.1 s now). A suite in the thousands on 3.9.0 to 3.25.1 gets that time back by upgrading; nothing it reads changes.

The ledger never holds a request or response body. It holds scenario names, feature names, source locations, the first line of failure messages (or a hash of it), URI shapes with the variable parts templated away, and branch names and commit shas.

Diagnostics

Kind When
HistoryUnavailable no ledger could be found, the file declares a newer format, it stayed locked past the retry budget, a companion file beside it could not be read, or the append failed; the message names what to do
HistoryPartialRun the run was recorded as partial by the threshold
HistoryShapeTemplate a HistoryShapeTemplates rule did not compile or timed out, and was skipped (3.25.0)
HistoryLedgerDamaged lines were skipped; kronikol history verify names them

A test run never fails over its history: everything that stops it is one of these.

Home · 🔍 Search this wiki Full-text search across every page. The “Pages” list above matches page and heading names, not page content.


Demo


Getting Started

Common Tasks

Integration Guides

Uninstrumentable / polyglot backends

Extensions

Configuration

Features

Reference

Clone this wiki locally