Let the project shape the bit-exact gate's inputs through recast_inputs.py - #31
Open
second5t wants to merge 3 commits into
Open
Let the project shape the bit-exact gate's inputs through recast_inputs.py#31second5t wants to merge 3 commits into
second5t wants to merge 3 commits into
Conversation
A subprogram whose domain is a relation between its arguments -- a packed triangular workspace whose extent is n(n+1)/2, a pivot vector that must be a permutation, a mode that must be 1 or 2 -- cannot be drawn independently per argument, and the redraw rules only report how often that failed. The project now says what it accepts: a `recast_inputs.py` at the source root defines `prepare(unit, subprogram, inputs, rng)`, which returns one trial's draw shaped into the domain, or None to leave it to the generated rules. It lives in the source tree, so the report's identity covers it with nothing new to digest. A shaped draw is the project asserting the reference takes it, and is judged that way: the reference runs first, and if it raises or produces a NaN the verification stops with InputProfileError naming the file, subprogram and trial -- that is the profile's fault, never the candidate's, and it is never drawn again. A candidate that raises on a shaped draw the reference took has failed the translation, no redraw. A profile that does not import, defines no prepare, edits the draw in place and returns None, or renames the arguments stops the gate the same way. Replays never run the profile: recorded inputs are already in the domain, and letting anything edit them would rewrite the exam. The candidate-side `_PREPARE_INPUTS` hook is gone; the emitted module is what is being judged and does not get to choose its own inputs. Metrics carry `input_profile` and the `shaped` subprograms, and each subprogram reports how many trials were shaped. On the MINPACK corpus a 70-line profile takes dogleg and r1updt from 10 of 10 trials reshaped to 165 and 351 bit-exact points at their real packed extents, with every subprogram at zero redraws. (cherry picked from commit 28bfc8e13106b12e014929670a62fd13dcc02c5c) Signed-off-by: 2st <mouseisnotalwaysmouse@outlook.com>
The profile was loaded through a SourceFileLoader, which cached its bytecode as __pycache__/recast_inputs.cpython-311.pyc beside it. The root is a checkout whose cleanliness is checked -- the training lab refuses to onboard a dirty tree, and its prepare-inputs command refused to commit the profile because the engine's own self-check had littered the worktree. Compile and run the source by hand into a fresh module namespace instead. (cherry picked from commit 21367454aa6aa13832782c16e7fc3fc2e6e534c2) Signed-off-by: 2st <mouseisnotalwaysmouse@outlook.com>
The verifier catch that turns a plugin crash into a unit failure also swallowed InputProfileError -- the project's recast_inputs.py shaping a draw the reference refuses. That is the profile's fault, not the unit's: recorded as a failed verdict it reads as a translation defect and sends a repair agent after the engine for a mistake in the corpus checkout. The error now escapes the walk as every other operator error does, through the unit and run "aborted" events. Signed-off-by: 2st <mouseisnotalwaysmouse@outlook.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.
What this is
The bit-exact gate draws its inputs uniformly, and for a subprogram whose domain is narrower than that (MINPACK's
dogleg/r1updt: extents that must be sorted, packed, positive) every draw is either redrawn or compared only after its free extents were moved. The training lab found that no engine change fixes this without lying about the source; the project has to say what its inputs look like.recast_inputs.py— arecast_inputs.pyat the root the run was given, withprepare(unit, subprogram, inputs, rng), receives one trial's draw by argument name and returns it shaped into the source's domain (orNoneto leave it alone). A shaped draw is an assertion that the reference takes it and is judged as one: never redrawn, a candidate that refuses it has failed, a reference that refuses it means the profile is wrong (InputProfileError). Metrics say how many points were shaped. Tests intests/test_bitexact_draws.py.recast_inputs.pywithout writing bytecode into the project root — compile + exec instead of import, so no__pycache__lands in a corpus checkout (the checkout is content-addressed by the run).aa03480turns a verifier crash into a unit failure so one plugin bug does not end the walk; that catch also swallowedInputProfileError, which would have recorded a mistake in the corpus checkout as a translation defect and sent a repair agent after the engine. It now escapes through the unit and runabortedevents like every other operator error. Test intests/test_run.py.The first two commits are the training lab's, cherry-picked onto
main(one trivial conflict:PROCEDURE_DTYPEkept as main spells it) and re-signed. Verified there end to end: with a MINPACK profile all 22 subprograms are compared at zero redraws (dogleg/r1updtincluded); without one the same engine fails those two exactly as before. Not included: the lab's agent-authored repair forfortran-utilssorting(companion modules staged next to the candidate, generic interfaces reaching private specifics) — pending human audit, separate PR if wanted.Checks run locally (uv, Python 3.11, gfortran 13)
ruff check .clean;mypyclean (109 files);tools/check_signoff.py origin/main..HEADclean.pytestwithdev fortran translate verify: 900 passed, 20 skipped.tools/check_hygiene.py .: the same 4 lines asorigin/main(docs/roadmap.md,src/recast/fortran/constants.py), nothing from this branch.ruff format --check .: the same 2 Markdown files asorigin/main, untouched here.🤖 Generated with Claude Code