Repository navigation
benchmarks(errors): write each case as edits to the clean app - #211
Merged
Merged
Conversation
A case's port.toml can now describe its mistake as `[[edits]]` entries (`file`, `old`, `new`). Each `old` must appear exactly once in the clean baseline file, every `old` is looked up in the clean text so edit order does not matter, and overlapping edits are rejected. `validate` checks every edit against the current baseline and names each case whose `old` text is missing or repeated, so a change to the reference page shows which cases need a look. Full-file `files` copies stay available for a case that rewrites a file completely; a case cannot both copy and edit one file. The `mistake.contains` check now runs on the edited text. All 134 ported cases were converted by a one-off script that diffed each copy against its baseline file, and the copies were removed. No case kept a full copy. Proof: for every converted case, applying its edits to the baseline gives the old copy from 67f0876 byte for byte (citry 24, django 23, fasthtml 21, jinja 21, next 22, nuxt 23). The conversion and proof scripts are not committed: they only make sense while the old copies exist, and git history keeps those for a re-check. Also adds the approved plan for parts 2 and 3 as docs/design/error_prevention_benchmark_plan.md, and documents the edit format and its error modes in the README and the design doc. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…line Loading a port.toml now rejects an edit `file`, a `files` path or the copy it names when the text could point elsewhere: an absolute path, a `.` or `..` name, a backslash, a drive letter, a control character, an empty name, or a name ending in a dot or space (which Windows drops). It also rejects a copy that is a symbolic link leading out of the case folder, and one file named twice with different letter case or Unicode form, which macOS and Windows treat as one file. Each error names the port file and the path. `validate` additionally resolves every baseline path and names the case when a symbolic link leads out of the baseline, or when the path lies in a folder the working copy leaves out, such as node_modules, which would otherwise pass validate and fail partway through a run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
force-pushed
the
benchmarks/errors-case-edits
branch
from
October 20, 2026 17:10
1ebc2bb to
4ef57e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2, step 1a of the error-prevention benchmark plan (#158). Stacked on #205; merge that first.
Why
Each case used to keep a full copy of every file it changed, with only the mistake line different. Adding anything to the clean app, which the next part-2 PRs do, would have meant rewriting about 90 copies by hand. A copy nobody updated would quietly keep testing the old app.
What changes
port.tomlnow lists its mistake as[[edits]](file,old,new). Eacholdmust appear exactly once in the clean app's file, and two edits may not overlap. Full-filefilescopies still work, for a case that rewrites most of a file.validatenames every case whoseoldtext is no longer in the clean app. After a change to the clean app, it lists the cases that need a look..., uses a backslash or a drive letter, or leads out through a symbolic link is rejected. Before this, a case could write outside its working folder.docs/design/error_prevention_benchmark_plan.md, with the decisions from Benchmarks: compare which mistakes each framework catches, and when #158.Proof
No benchmark run is needed: applying each converted case's edits to the clean app gives byte-for-byte the same file as its old copy (at 67f0876), for all 134 cases (Citry 24, Django 23, FastHTML 21, Jinja 21, Next.js 22, Nuxt 23). Each case's mistake line is unchanged too. The one-off conversion and proof scripts are not committed; git history keeps the old copies if the proof needs re-running.
Runner tests: 72 passed.
validate: clean. The Windows path rules (drive letters, backslashes, names ending in a dot or space) are covered by tests but were not run on Windows.🤖 Generated with Claude Code