Case study

TestReceipts

A command-line tool that compares two failed test runs and hands an AI assistant the evidence, with measured token savings.

Research prototype

TestReceipts is a command-line tool I built to help AI assistants investigate failing tests. Give it two CI runs, one from before a change and one from after, and it hands back the evidence: which failure messages appeared, which disappeared, and where they came from. It doesn't call a model to do any of that.

  • 41.5%median token savings against an assistant building the comparison with an existing parser
  • 27.2%against an existing ready-made comparison query
  • 72investigations across 12 run pairs from 8 projects
  • 54 of 54labeled evidence groups found in 20 archived build logs

The problem

When a test run fails, an assistant usually has to find the reports, download them, and write code to compare one run with the next. That costs tokens, and it's easy to get subtly wrong. TestReceipts does that part itself and returns only the evidence, so the assistant can spend its effort on what changed.

What it does

  1. You give it two supported CI run URLs, one before a change and one after.
  2. It finds the test reports, matches exact failure details across both runs, and returns the differences and report references as JSON, along with anything that's missing or uncertain.
  3. Your assistant investigates what changed. You can save the captured evidence and repeat the comparison offline.

It needs no Python, Node, or compiler at runtime. Live support currently covers public Kubernetes Prow and GCS runs with supported JUnit XML reports.

In one real pair of failed runs it found one new and one disappeared failure message across 105 test records per run. It also reported that the comparison was not complete, because both reports had ambiguous test identities. A message that disappears doesn't prove a fix, and a missing report never means passing tests. I'd rather the tool say that than guess.

Does it actually save tokens?

I measured it. The study ran 72 investigations: 12 pairs of historical CI runs, three approaches, two repetitions each. The same model setting, questions, and answer format were used throughout, and every investigation started in a fresh workspace. Against an assistant assembling the comparison with an existing parser, the TestReceipts workflow used a median of 41.5% fewer tokens. Against an existing ready-made comparison query, 27.2% fewer.

"Tokens" here means total input plus output, including cached input. These are not dollar-cost savings.

Fewer tokens on first use, compared with two ways of doing the same comparison Median paired savings across 12 historical run pairs. Higher is better; left of the dark line means TestReceipts used more tokens.
  • Compared with: An assistant building the comparison with an existing parser

    Median 41.5% fewer tokens. Per-pair range 17.4% to 49.7% fewer. Exploratory 95% interval 30.5% to 48.2% fewer.

  • Compared with: An assistant using an existing ready-made comparison query

    Median 27.2% fewer tokens. Per-pair range 12.5% more to 44.3% fewer. Exploratory 95% interval 10.3% to 31.6% fewer.

Every pair, including the bad one

A median hides the spread. Against the ready-made query, individual pairs ranged from 44.3% fewer to 12.5% more. The worst, a kubernetes-sigs/controller-runtime run, used more tokens than the query it was supposed to beat, and 2 others were within 3% of even. Against the parser-assembly baseline it was ahead on every pair.

All 12 run pairs, not just the median Token savings for each historical run pair, from the median of two attempts per approach. Hatched bars mark a pair where TestReceipts used more tokens than the baseline.
  • kubernetes/kubernetes Run pair U01

    Compared with building it with an existing parser: 42.2% fewer tokens

    Compared with the ready-made query: 40.1% fewer tokens

  • kubernetes-sigs/kueue Run pair U02

    Compared with building it with an existing parser: 48.3% fewer tokens

    Compared with the ready-made query: 33.7% fewer tokens

  • kubernetes-sigs/cloud-provider-azure Run pair U03

    Compared with building it with an existing parser: 44.8% fewer tokens

    Compared with the ready-made query: 29.5% fewer tokens

  • etcd-io/etcd Run pair U04

    Compared with building it with an existing parser: 30.7% fewer tokens

    Compared with the ready-made query: 17.8% fewer tokens

  • kubernetes-sigs/controller-runtime Run pair U05

    Compared with building it with an existing parser: 17.4% fewer tokens

    Compared with the ready-made query: 12.5% more tokens

  • kubernetes/kops Run pair U06

    Compared with building it with an existing parser: 30.3% fewer tokens

    Compared with the ready-made query: 20.7% fewer tokens

  • kubernetes-sigs/prow Run pair U07

    Compared with building it with an existing parser: 49.7% fewer tokens

    Compared with the ready-made query: 29.4% fewer tokens

  • kubernetes/kubernetes Run pair U08

    Compared with building it with an existing parser: 31.2% fewer tokens

    Compared with the ready-made query: 2.8% fewer tokens

  • kubernetes-sigs/cloud-provider-azure Run pair U09

    Compared with building it with an existing parser: 49.2% fewer tokens

    Compared with the ready-made query: 28.1% fewer tokens

  • kubernetes-sigs/lws Run pair U10

    Compared with building it with an existing parser: 40.8% fewer tokens

    Compared with the ready-made query: 44.3% fewer tokens

  • kubernetes-sigs/controller-runtime Run pair U11

    Compared with building it with an existing parser: 29.7% fewer tokens

    Compared with the ready-made query: 0.2% fewer tokens

  • kubernetes/kops Run pair U12

    Compared with building it with an existing parser: 48.2% fewer tokens

    Compared with the ready-made query: 26.3% fewer tokens

Show the token counts behind these bars
Median total tokens per run pair (input plus output, including cached input). Source: evidence/go-url-first/summary.json.
Run pairTestReceiptsParser assemblyReady-made querySaving vs parserSaving vs query
U01 · kubernetes/kubernetes 63,980 110,780.5 106,886.5 42.2% fewer 40.1% fewer
U02 · kubernetes-sigs/kueue 68,690.5 132,909 103,682.5 48.3% fewer 33.7% fewer
U03 · kubernetes-sigs/cloud-provider-azure 59,137.5 107,216.5 83,836 44.8% fewer 29.5% fewer
U04 · etcd-io/etcd 68,633 99,090 83,470.5 30.7% fewer 17.8% fewer
U05 · kubernetes-sigs/controller-runtime 88,915.5 107,604 79,027.5 17.4% fewer 12.5% more
U06 · kubernetes/kops 66,091.5 94,768.5 83,362.5 30.3% fewer 20.7% fewer
U07 · kubernetes-sigs/prow 59,102.5 117,401.5 83,734 49.7% fewer 29.4% fewer
U08 · kubernetes/kubernetes 92,910.5 135,015.5 95,557 31.2% fewer 2.8% fewer
U09 · kubernetes-sigs/cloud-provider-azure 74,685.5 147,156.5 103,932.5 49.2% fewer 28.1% fewer
U10 · kubernetes-sigs/lws 71,804 121,327 128,905.5 40.8% fewer 44.3% fewer
U11 · kubernetes-sigs/controller-runtime 82,713 117,680 82,898.5 29.7% fewer 0.2% fewer
U12 · kubernetes/kops 68,095.5 131,393 92,430.5 48.2% fewer 26.3% fewer

One more thing in the fine print: 23 of the 24 attempts assigned to the TestReceipts workflow actually ran its comparison. In the other, the agent ran testreceipts --help and then chose the Python helpers that the protocol permitted. That attempt's full cost is included, so these are workflow results, not 24 for 24 TestReceipts-only runs.

Finding evidence in a build log

Version 0.4.0 added log-context. Point it at a local build log and a literal failure message, and it returns JSON with the matching line numbers, nearby failure summaries, and the supporting evidence around them, such as assertion values, compiler errors, or a timeout on the same operation. Multiple matches, missing files, and skipped oversized lines are reported explicitly.

Evidence recovered from failed build logs For each of 20 archived logs, one question and the specific lines needed to answer it. Bars show the share of those labeled evidence groups each tool returned.
  • All 20 archived logs 54 labeled evidence groups

    TestReceipts found 54 of 54

    The Python script found 14 of 54

  • Original four logs 4 logs, 12 evidence groups

    TestReceipts found 12 of 12

    The Python script found 6 of 12

  • Later four logs 4 logs, 19 evidence groups

    TestReceipts found 19 of 19

    The Python script found 1 of 19

  • Two additional runs 2 logs, 4 evidence groups

    TestReceipts found 4 of 4

    The Python script found 2 of 4

  • Six failure-density logs 6 logs, 11 evidence groups

    TestReceipts found 11 of 11

    The Python script found 2 of 11

  • Four additional builds 4 logs, 8 evidence groups

    TestReceipts found 8 of 8

    The Python script found 3 of 8

All 20 logs informed development of the tool, so this is not a held-out test. It also does not measure tokens; log-search token savings have not been measured.

The cost: more surrounding lines

Distinct lines returned outside each question’s labeled evidence. Lower is leaner, but the script returned fewer lines partly because it found less.
  • TestReceipts returned 171 extra lines

  • Reusable Python search script returned 104 extra lines

Show the per-suite counts
Evidence groups found and extra lines returned, by replay set. Source: evidence/build-logs/teardown/results.json.
Replay setLogsGroupsTestReceipts foundScript foundTestReceipts extra linesScript extra lines
Original four logs 412 126 3519
Later four logs 419 191 4124
Two additional runs 24 42 1413
Six failure-density logs 611 112 5531
Four additional builds 48 83 2617
Total 2054 5414 171104

What I'm careful not to claim

  • The token results cover first use only. Repeated use, an already-prepared comparison script, live-network speed, other models, and modern MCP integrations are not measured.
  • The inputs were historical runs I had already inspected, not fresh held-out samples. With only 12 pairs, the intervals are exploratory.
  • A human review of the agents' written explanations is still pending.
  • Passing the fact checks doesn't mean the underlying CI suites passed.
  • The build-log comparison used logs that informed the tool's development, and it doesn't measure tokens.

Where it stands

TestReceipts is an unsigned, MIT-licensed proof of concept written in Go, currently at version 0.4.0. The source is public, but I haven't published a packaged release on GitHub, so for now you build it from source. The repository includes the per-attempt scores, the exact inputs and expected facts, and an audit that rebuilds the study summary from the raw records. The status and caveats on this page are as of the pinned commit below.

The charts on this page are generated from a snapshot of those results pinned to commit 7ec176b. Read the full token study, the build-log replay, or the release notes.