> Agent-ready spec from Diff of the Day (2026-12-02, idea 4). Give this file to your coding agent (Claude Code, Codex, Cursor) and ask it to build the P0 requirements first.

# Spec: Type checker race

## Problem Statement
Python type checkers differ in speed and in what they report, and a switch is hard to judge from a blog post. Astral says its Rust checker ty is ready for production, but your own code decides if it is faster and if its findings are useful.

## Goals
- Time the old checker and ty on one repo, cold and warm, with 5 runs each.
- Report peak memory for each tool.
- Sort findings into only ty, only the old checker, and both, with counts.
- Label 40 sampled findings as real or noise and report the share of each.

## Non-Goals
- Changing your CI: the race only informs a decision, since a switch needs a team review.
- Fixing the findings: the goal is to compare tools, not to clean the code.
- Comparing editor features: only the command line is measured to keep the race simple.

## User Stories
- As an engineer, I want a time and memory table so that I know if ty is worth a trial.
- As a reviewer, I want sampled findings labelled so that I can judge the noise level.
- Edge case: as an engineer, I want a file that one tool cannot parse to be listed and counted, so that a crash does not hide a gap in coverage.

## Requirements
### P0
- A runner that executes each checker 5 times cold and 5 times warm and records time and peak memory.
  - [ ] Results are saved as a CSV file.
  - [ ] The runner states the tool versions.
- A normalizer that turns each tool output into file, line, rule and message, and a diff into three groups.
  - [ ] The three group counts add up to the total unique findings.

### P1
- A sampler that picks 20 findings from each only-group for labelling.
  - [ ] The sample is the same on a re-run when the seed is the same.
- An edit-and-check timer that applies a small edit and runs each tool.
  - [ ] The timer reports median seconds per tool.

### P2
- A Markdown report that joins timings, groups and labels.
  - [ ] The report fits on one page.

## Success Metrics
- Median warm time and peak memory per tool.
- Count of findings in each group.
- Share of sampled only-ty findings labelled real.

## Open Questions
- Does your repo use plugins or stubs that ty does not read yet?
- Which rule names map between the two tools?
- Is the repo big enough for the speed gap to matter?

## Timeline
One evening: runner and timings first, then the diff, then the sample and report.

## Agent Instructions
- Suggested stack: Python, the subprocess module, the two checkers installed in a clean environment (ty can be installed with uv).
- Build order: Runner, timing CSV, output normalizer, diff, sampler, report.
- Safety: Run on a clean checkout, not on uncommitted work; do not upload code to a service; do not apply any automatic fix; keep results out of the repository.
- Done when: The report shows timings for both tools, the three finding groups with counts, and 40 labelled findings.

## Sources
- https://astral.sh/blog/ty-1.0
