Skip to content

benchmarks(errors): run cases in parallel, reuse unchanged results, skip runtime after a static catch - #215

Merged
JuroOravec merged 16 commits into
mainfrom
benchmarks/errors-faster-runner
Oct 20, 2026
Merged

JuroOravec merged 16 commits into
mainfrom
benchmarks/errors-faster-runner

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

Makes the error benchmark's full run about 6 times faster, and lets later runs reuse earlier output for cases that did not change. Stacked on #214; merge that first.

Measured

A full run of all six frameworks (37 mistakes, 222 cases) with --no-cache took 326 s, against about 31 minutes for the same cases one at a time. Every cell, outcome, strict and lenient result, indirect mark and clean-app flag matches #214's published run. A rerun with nothing changed reuses every case and takes seconds.

What changes

  • Cases run side by side. run --jobs N defaults to half the CPUs, at most 8. Each clean app still runs alone before its cases start. Records come out in the same order however cases finish. Nuxt runs one case at a time (max_jobs = 1), because every nuxt dev picks its hot-reload port from the same small range.
  • Server ports. The runner used to release a port before the server bound it, so two servers could get the same one. Ports now come from a fixed range and stay reserved until the server stops; a server that still hits "address in use" is retried on another port.
  • The runtime check is skipped when a static check already reported the mistake as an error. The table shows the earliest catch, so the runtime result could not change those cells. A static warning alone still runs the runtime check, because the errors-only column needs it. A skipped case records runtime_skipped with the tool that caught it. In this run, 82 of 222 cases were skipped.
  • Stored output. The runner stores each case's raw tool output, browser recording and server log. A case runs again only when something that could change that output changed: its edits, its framework's clean app and settings, the installed versions, the runner code, or the Playwright, Node, Python or OS versions. Parsing and scoring run again every time, so a change to the scoring never needs a new run. --no-cache runs everything; use it for a run you publish. CITRY_ERRORS_CACHE moves the folder.
  • A bug that is already on main. .gitignore ignored the .python-version files that the citry and Django apps list among their install inputs, so a fresh checkout failed while preparing those two frameworks. Both files are now committed, with a .gitignore exception.

Tests

163 runner tests cover parallel ordering, port reservation, the skip rule, the stored-output key, damaged and partial entries, and stopping a run partway. An independent reviewer checked the code and, separately, the prose, and a second reviewer checked the fixes.

🤖 Generated with Claude Code

JuroOravec and others added 13 commits October 20, 2026 20:05
…amed journeys

The browser check's clicks become named journeys in each framework's
framework.toml, under [runtime.journeys]. The existing clicks are the
default journey, recorded at the same three points as before (after the
load, after the steps, after a reload). Every other journey starts from a
fresh load in a new browser context and records the page once. New `fill`
and `press` steps let later PRs drive forms and keyboard flows, and each
step accepts only the keys its action uses.

The page record also keeps border color, alt, id, aria-* attributes and
the disabled state, so a mistake that changes only those reads as
"silently wrong" rather than "never" (both still count as missed). Runs
of 16 or more hex digits in ids and aria values are blanked before the
comparison, because Citry mounts an interactive page into an element
with a random id on every render.

No existing cell is expected to change: the only "never" cells (m09) edit
only the button type text. The published results change only after the
next full run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds 13 mistakes to catalogue.toml before any case is written, so the
wording is fixed before a result is seen: m29-m35, m38-m42 and m47, the
part 2 mistakes that need no change to the reference page. 11 are
neutral and 2 (m41, m42) come from Citry's own rule list, which leaves
27 of 37 neutral.

The entries are the plan's drafts with two changes:
- m32 sends `"1"` instead of `"one"`, and says that a framework that
  turns the text into a number counts as prevented, following the
  decision on open question 3.
- m30 sends the card's task count instead of its position, because the
  reference page gives a card no position, and says the mistake does not
  apply where the event carries no value.

The catalogue header and the design doc's fairness rules now name the
maintainer's hand-off list (section 2 of the plan) as a neutral source,
as the plan requires for these entries to count as neutral.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds a case for each of m29-m35, m38-m42 and m47 in Citry, Django,
Jinja, FastHTML, Next.js and Nuxt, as edits to each baseline.

Not applicable, with the reason in each port.toml:
- m30 everywhere but Citry: the card's hide event carries no value,
  because the page's listener already knows which card it belongs to.
- m34 everywhere but Nuxt: Citry reads $state, the HTMX stacks swap in
  HTML, and Next's server action returns a bare number.
- m40 in FastHTML: the value is written into the script's text, so the
  browser code reads no name.
- m41 in Next.js and Nuxt: the API base is a plain string, and JavaScript
  has no path type to reach for.
- m47 in Citry, FastHTML and Nuxt: the page names no template or
  component file.

Prevented: m32 in Django, Jinja and FastHTML. HTMX sends form fields,
which are always text, and the server turns the field into a number, so
"1" and 1 send the same request.

Fixes made while running the cases, each to make the case express its
mistake, not to change its result: the Django and Jinja m42 edits wrote
a literal backslash-n into the file (a TOML literal string), which broke
Jinja's app.py; the Django m35 edit left extra blank lines that djLint
reported (H014), a finding unrelated to the missing fill.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eview

An independent review of the new cases found one wrong claim: the m41
not-applicable reasons for Next.js and Nuxt said JavaScript's URL class
takes only an absolute address, while it also accepts a relative path
with a base address. The reasons now say that a relative setting has no
base to resolve against.

The other changes are wording only and change no edit: the m32
prevented reasons for Django and Jinja open with why the mistake cannot
be written, and several comments say plainly what the case does.

The README's reference-page table now lists the new mistakes next to
the page part each one uses, and Citry's framework notes point to m29
and m42, which now measure the two related forms the notes describe as
unreported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…istakes

A full run of all 37 mistakes in all six frameworks, from commit
1fb5ac267, replaces the 2026-10-20 results (the earlier run of the same
day stays in git history). It is also the first published run with the
named journeys and wider page comparison from PR 1b; none of the 144
existing cells changed, as the plan expected.

Before the app runs (errors plus warnings, of the mistakes that apply):
Citry 21 of 35, Next.js 27 of 32, Nuxt 16 of 33, FastHTML 14 of 29,
Django 3 of 33, Jinja 2 of 31. Citry misses 10, up from 4: the parent's
misspelled listener (m29), an event payload of the wrong type (m30), a
misspelled DOM event (m31), a wrong-typed or missing payload field (m32,
m33; rejected with a 422 the page never shows), and a secret sent through
js_data() (m42), which no framework reports.

Also:
- the README's notes on single cells explain m30/m34, m32, m35, m38 and
  m42, and say #207 does not list the new gaps yet;
- the docs page's "Catching errors" section and its data file match the
  run;
- the plan marks PR 2 done and records 1b's full run;
- wording fixes from an independent prose review in the catalogue
  header comment (no entry changed), the design doc, the plan and
  Citry's framework notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The run used 1fb5ac267; rebasing onto main gave the identical tree the
hash 60e9fc2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`citry-errors run --jobs N` (default: half the CPUs, at most 8) runs the
cases of every framework side by side. Each clean app still runs alone,
before any case, so the comparison point is not measured under load.
Records keep the framework and catalogue order whatever order the cases
finish in.

Dev servers get ports from 20000-31999, below the range the operating
system uses for outgoing connections, and a port stays reserved in the
process until its server stops, so two workers never share one. A server
whose port another program took is started again on a new port.

A framework can cap its own cases with `max_jobs` in framework.toml;
Nuxt runs one case at a time, because every `nuxt dev` picks its
server-side hot reload port from the same 21 ports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…take as an error

The report keeps only where a mistake is first reported, and a static
error decides both the errors-only and the errors-and-warnings column, so
the browser check cannot change such a cell. Those cases now skip it, and
their record names the tool in `runtime_skipped`. A static warning alone
still runs the browser check, because the errors-only column can still be
decided there. In the 2026-10-20 run this would have skipped 63 of 134
browser checks, about 38% of the run's time.

The report and the docs data script already put these cases in the
static-error bucket, so no case shows as unscored.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t change

`citry-errors run` now stores each case's raw output under
.benchmarks/errors/results/: what every tool printed, unparsed, and the
browser check's record and server log. A later run reuses the stored
output when the case's inputs hash the same, and runs only new or changed
cases. The hash covers the case's port.toml and copied files, every file
of the framework's folder (framework.toml without its notes and
max_jobs), the runner code that makes raw output (execute.py, runtime.py,
work.py, config.py, cache.py, the runner's lockfile), the Node and Python
versions and the working copy's folder.

Parsing, comparing and scoring run again on every run from the raw
output, so changing them needs no rerun. The page comparison moves from
runtime.py to compare.py for this reason. Whether a case skips its
browser check is decided again too, so a case whose static catch stops
counting gets its browser check on the next run.

Output that says more about the machine than about the case is not
stored: a stage that timed out or was killed, a server that never
answered, a clean app with problems, and anything finished after Ctrl-C.
An entry's key file is written last, so an entry a run stopped writing is
ignored. run.json lists the clean apps and cases reused whole.
`--no-cache` runs everything and stores the fresh output, and a lock
keeps two runs off one cache folder. CITRY_ERRORS_CACHE moves the folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…red output

The README explains --jobs, max_jobs, the stored output and --no-cache,
with the Jinja and FastHTML timing. The design doc lists how the runner
behaves on a port clash, a worker error, Ctrl-C, a half-written entry, a
second run on the same folder and a stale stored output, and its cost
section gives the measured times. Section 8 of the plan replaces the
one-case-at-a-time estimate with the new one.

Progress lines from workers are written one at a time, so lines from
cases that finish together no longer run into each other.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…el runs and stored output

Stored output:
- Nothing of a framework is stored in a run whose clean app had a
  problem. A broken environment fails every case the same way, and that
  output would otherwise be reused after the environment is fixed.
- A browser check whose journey stopped early is not stored, because a
  step that ran out of time can come from a busy machine.
- The key also covers the installed Playwright, what each framework's
  environment installed (its venv's pyvenv.cfg, npm's package record),
  the framework folder's location, and the variables CI, FORCE_COLOR,
  NO_COLOR, NODE_ENV, NODE_OPTIONS, PYTHONWARNINGS and TERM.
- A damaged entry is treated as not stored instead of stopping the run.
- `prepare` takes the same lock as `run`, and the lock file keeps the
  running process's id when a second run is refused.

Parallel runs:
- After Ctrl-C a running case stops before its next tool or browser
  check, so the run ends without waiting for builds that have not
  started. Ctrl-C while the workers start is handled too.
- run_all rejects a zero job count or limit, and an error working out a
  task's framework fails the run instead of ending a worker silently.
- Ports come from 20000-24677, below the ports Vite and nuxt dev pick for
  hot reload. Django's "That port is already in use" also triggers a
  retry on another port.
- The development server starts from a fresh copy of the case, so the
  browser check sees the same files whether the tools ran in this run or
  their output was stored by an earlier one.

Docs: the README, design doc and plan describe these, correct the retry
count, the Nuxt row and the cache-key list, and give the measured rerun
time (8 seconds for Jinja and FastHTML, which repeats the 4 browser checks
whose journey stops on an error page).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tored output

- The Ctrl-C test waits until both workers are on a case and checks that
  both gave up their case before run_all returned; it was racy before.
- A stored entry that cannot be read for any reason, including a
  malformed runtime.json, is ignored with a one-line message naming it.
- A framework's location in the checkout is part of its key only when a
  command names a file there ({framework} or {repo}), so two checkouts
  sharing one cache folder reuse each other's output for the others.
- The toy check stage leaves a file in the working copy, and the toy
  browser check fails if it sees it, which proves the server starts from
  a fresh copy. New tests cover the stop check before each tool and the
  lock file keeping the running process's id.
- Comments and docs: only nuxt dev searches 24678-24698; Ctrl-C waits for
  tools and browser checks already started; a missing server log reruns
  only the browser check; the rerun time names Jinja and FastHTML.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s apps name

The citry and Django framework settings list .python-version among the
files that decide when an install is out of date, but the repository's
.gitignore ignored it, so a fresh checkout failed in prepare.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…doffs

# Conflicts:
#	docs/design/error_prevention_benchmark_plan.md
Base automatically changed from benchmarks/errors-handoffs to main October 20, 2026 21:35
@JuroOravec
JuroOravec merged commit 3f7ed8e into main Oct 20, 2026
1 check passed
@JuroOravec
JuroOravec deleted the benchmarks/errors-faster-runner branch October 20, 2026 21:52
JuroOravec added a commit that referenced this pull request Oct 20, 2026
main matches the merged #215, which this branch already contains, so the
files are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant