Repository navigation
test(ts): split lang into a fixture per module and key reject's refusals by item - #474
Merged
Merged
Conversation
Quest-Claim: 4d479db2366da09c
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
reject's expected errors, and its census's spans in census.txt, now key each refusal by the item it points into and its offset from there, sorted, so cases added to different items merge cleanly. Its source splits into a module per kind of construct and taplo keeps its roots sorted. The census's totals, which every reject case changed, move to a small census fixture of refusals translation keeps for good. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#471's removed reject cases leave strs.rs, with its roots and expected lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
November 3, 2026 04:01
kixelated
enabled auto-merge
November 3, 2026 04:26
This was referenced Nov 3, 2026
kixelated
added a commit
that referenced
this pull request
Nov 3, 2026
A harness that names its cases (`lang`'s fixtures, `stock`, `codec`, `task`'s steps) now draws each case's random inputs from a stream seeded by its name, so adding, removing, or reordering a case changes no other case's inputs. `stable.ts` checks it. Also deletes quest/m0/checks/fixture-layout.md, which #474 delivered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
langwas one crate of 31.7k lines with one case list, onecaller.ts, and one snapshot of its cases, andrejectkeyed each expected error by line number in onelib.rs, with every root appended to one list and a census whose totals change with any case. Two PRs that each add a case appended to the same lines, so they conflicted: of 71 merge-queue conflict ejections in four days, 43 were inlangand 28 inreject, and gate failure #374 wasreject's line numbers shifting within a batch. A targetedlangrun also translated all oflang.Approach
fixtures/lang/is now a fixture per module: 66 crates, each with its owncases,ts.toml,expected/, andcaller.tswhen its cases name inputs.fmt,generics, andshapesshare types, so they stay together inshapes. They shareharness.rs(the case picker),lang.ts(the caller and its input helpers), the translation build dir, and the wasm target dir.fixtures.rsdeclares one test per fixture, sojust ts test lang::intstranslates and runs onlyints.differential.tstakes a caller'sops, the bytes that pick each case, and scales the random-input count by them, so each case still gets 151 random inputs. The full-width u64 inputs it used to make for the first 8 ops, which wereints' ops, move toints/caller.tsasboundaries().reject/src/splits into a module per kind of construct.expected.txtkeys each error by the item it points into and its offset from there (strs.rs:cow_matched+2:4), with closure spans keyed the same way, and keeps them sorted. The roots ints.tomlare module-qualified, and a.taplo.tomlrule keeps them sorted (just checkfails on unsorted roots,just fixsorts them).bindandcrates, whose refusals sharerejected(), get the same keys.rejectis still tested. It lowers generic items that no root reaches, which finds refusals translation never reaches, such as inconfig::genericandrebound::generic_park_rebound. Its spans are now snapshotted inreject/census.txt, keyed and sorted likeexpected.txt. The census's totals and tables, which changed with every reject case, move to a newfixtures/censuscrate of a few refusals that should stay refusals, so they change only when the census report itself changes.sysrootuses that crate too, since it depends onbytes.Demonstration: one script made two branches from each layout. Each branch adds one
langcase (inintson one branch,strson the other) and onerejectcase (pointers on one, fmt on the other), with snapshots regenerated by the real driver.mainlang/src/harness.rs,lang/expected/harness.ts,reject/src/lib.rs,reject/ts.toml,reject/expected.txt,reject/census.mdreject,reject_census,censusand bothlangsnapshots unchangedTranslating one
langmodule in that script took 3-8s, against 3-4 min for all oflangonmain.Expected snapshot changes:
counts_Noisyis nowNoisy, and onecopied()ofBumpedinitersis elided now that theiterscrate alone decides howBumpedis copied. Each module's behavior is still checked against native Rust.reject's messages name types by module path, for examplepointers::Halves, because those types moved into modules. Apart from location and module prefixes, the errors matchmain's one for one (checked with a script).Impact
just cion the final head: 131s wall, of which thefixturestest binary took 112s for all 78 tests. Onmain, the onelangtest alone took 7.5 min wall and about 11 CPU-min. The 66langtests take about 9 CPU-min and run in parallel.src/*.rsfiles follow by git's rename detection. Folds from the back, and a crate's own folds #463's edits tolang/caller.tsmove tolang/ends/caller.ts, and itsreject/src/lib.rscases move into the matching module, with roots module-qualified. fix(ts): drop a string search's or retain's closure where std does #471, fix(ts): translate by_ref of a mutable reference to an iterator held in a local #475, and feat(ts): translate Arc and Rc of dyn Iterator, and dyn FusedIterator #478 have landed and are merged in here: fix(ts): drop a string search's or retain's closure where std does #471's removed reject cases leavestrs.rs, fix(ts): translate by_ref of a mutable reference to an iterator held in a local #475'siters::lentcase moves to theitersfixture, and feat(ts): translate Arc and Rc of dyn Iterator, and dyn FusedIterator #478'sdynscases regenerate in thedynsfixture.Alternatives
langcrate and split only its case list and caller into per-module files: this removes the list conflicts, but each case still changes the one shared snapshot of its cases, and a targeted run still translates everything.rejectas before with item keys: its totals and per-construct counts still change with every case, so any two reject PRs would still conflict. Dropping it would lose coverage of generic lowering.reject's roots by hand instead of through taplo: nothing would enforce it, and appends at the end would come back.Follow-ups
goandffireject fixtures key errors by line number the same way. No merge conflicts have been counted there, so no quest was planned.Review
Round 2: Codex, gpt-6.1-sol, medium effort,
quest review --base origin/mainon headba6d201091d01ba0361a1b994e8136ca580b1c05: no findings. Round 1 oncb659c55also had none.🤖 Generated with Claude Code