Skip to main content

Every Claim Has a Source

Why This Matters

A developer who receives “product bug, caused by the pricing refactor” will ask: how do you know? If TestPilot cannot point to the exact log line and commit, the verdict will not be trusted, and it should not be.

Evidence with a source

Every piece of evidence in a finding carries where it came from:

{
  "quote": "\"discount\":0,\"total\":100.00",
  "source": "log",
  "reference": "run-1042/t-002 line 2",
  "tool": "read_log"
}

Check quotes in code

The system prompt asks for exact quotes; your code checks them:

function unsupported(finding: Finding, ctx: RunContext): string[] {
  return finding.evidence
    .filter((e) => !ctx.sourceText(e.reference).includes(e.quote))
    .map((e) => e.quote);
}

A finding with an unsupported quote gets one retry with feedback (“this quote does not appear in the referenced source”), and is otherwise marked as needing review. This single check removes a whole class of invented evidence.

Keep sources through hand-offs

When findings pass from specialist to coordinator to bug writer (lesson 38), the references travel with them. The bug writer may rephrase, but every claim in the bug report must map to a referenced piece of evidence. If it cannot, it does not go in.

When sources conflict

The log says the sandbox was down at 14:03; the health check says it was up at 14:10. Both are true. Show both, with their times and references; never blend them into “the sandbox was unstable”. A conflict between sources is evidence in itself.

A bug report a developer can verify in a minute

Title: Discount code accepted but not applied to cart total (after 8f3c2a1)

Expected: total €90.00 for a €100.00 cart with WELCOME10
Actual:   total €100.00                         [log: run-1042/t-002 line 2]
Evidence: discount API accepted the code        [log: run-1042/t-002 line 1]
          stable in 20 previous runs            [history: t-002]
          PricingService refactor in 8f3c2a1    [commit 8f3c2a1]

Every line can be checked by clicking or grepping.

Exercise

Add source references to the finding schema and the quote check to the validation. Write a test where the model invents a log line and check that the finding is flagged.

Compare with solution/lesson-60-reliability, which covers lessons 54–60 (see docs/exercises.md, module 7).