Make the formatter's meaning guard honest, and fix the two defects it was hiding - #222
Open
MelbourneDeveloper wants to merge 3 commits into
Open
Make the formatter's meaning guard honest, and fix the two defects it was hiding#222MelbourneDeveloper wants to merge 3 commits into
MelbourneDeveloper wants to merge 3 commits into
Conversation
`runCompiler` spawned every child with an open stdin pipe and never ended it, so a program that reads input — `input()`, or anything waiting on EOF — blocked forever on a pipe nobody writes to, and the run only ended when the caller cancelled it. The child's stdin is now closed immediately after spawn, which is what the `runCompiler closes child stdin so input reaches EOF` test asserts. `tests/regressions/basics/files/test_output.txt` and `test_stale_reason.txt` are written by `file_io_json_workflow.test.osp`, not inputs to it. .gitignore already says why a committed copy is wrong — "a stale copy is a test input nobody wrote on purpose" — but only anchored the repo-root paths. Both are removed and their in-corpus paths ignored, fully anchored so no bare name can hide a real fixture elsewhere.
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.
osprey fmtwas a silent no-op on 58 of the corpus's ~250 files, and nothing could notice: when the meaning-preservation guard rejected the formatter's own output,format_sourcereturned the input verbatim, which is indistinguishable from "this file was already formatted".crates/osprey-fmt/tests/corpus.rsasserted idempotency against that, so the assertion was partly self-fulfilling.A rejection is now the error
osprey_fmt::DECLINED, and the corpus test collects every failing file rather than stopping at the first. Turning it on exposed two separate defects.The guard compared source positions.
Program's derivedPartialEqincludesPosition, so any reindentation that moved a positioned node failed the guard that exists to permit it. 56 of the 58 diverged on nothing butline/column. The guard now comparesosprey_ast::canonical::without_positions, one shared position-blind rendering that also replaced the two hand-copiedscrub_positionshelpers inmodule_equiv.rsandcross_flavor_equiv.rs. Being exact where those were sloppy, it immediately caught an asymmetry they had masked: Default records a span on a nestedfnTypeExprin a signature and ML does not.The scanner reindented the inside of multi-line string literals.
scan.rsscanned line by line and lost the "still inside a string" fact at the newline, so continuation lines were treated as code — indentation rewritten, interior double spaces collapsed. That changes what the program prints; the only thing that ever stopped it reaching disk was the silent bail.scan_sourcenow merges the physical lines a literal spans into one logical line, so the literal moves as a unit and only the line that opens it is indented.Extension stdin hang.
runCompilernever closed the child's stdin, so a program reading input blocked until the run was cancelled. Fixed in source against the test that pins it.Also: the positional-table scoping guard gained two mutation-proven tests;
make benchwas re-run across 22 cases × 11 languages andwebsite/src/benchmarks.mdrewritten to what the fresh data supports (three claims on it were false — Osprey wins no CPU or memory row, at 11.59× Rust and 13.14× C; ARC is above C in 21 of 22 cases, median 1.06×). Plan 0019 is retired and deleted.Verification
make cigreen end-to-end (deslop 0.27.0 installed locally to run the duplication gate rather than skip it), plus every other job CI runs: the fullrustjob, thewasmjob (126 corpus programs vs native goldens), website E2E (93), bank e2e (17), extension tests (269), and the webcompiler API test.Two gaps I could not close on this host, both stated rather than skipped:
windows-latestonly; the closest local equivalent is the three-backend corpus, which passes.webcompiler/test.shagainst the server started directly under Node, which passed; the container build and its memory limits are untested locally.Defects found and deliberately left open
let r = xs [0]silently parses as two statements instead of an index — one space changes the program's meaning with no diagnostic.ackermannonwasm32prints nothing where native prints 8189 (excluded from benchmark timing, so published numbers are unaffected).Both are recorded in the retired plan row in
docs/plans/README.md.