Classic-format I/O hardening: tolerant parsing, full-precision printing, NeverStarted named - #375
Open
ofloveandhate wants to merge 4 commits into
Open
Classic-format I/O hardening: tolerant parsing, full-precision printing, NeverStarted named#375ofloveandhate wants to merge 4 commits into
ofloveandhate wants to merge 4 commits into
Conversation
…parators The native SystemParser accepts only the bare input body (variable groups + functions). A leading CONFIG...END; block, or the INPUT/END; separators that System.to_classic_input() itself emits, made it fail -- so parse.system(sys.to_classic_input()) did NOT round-trip and every caller had to hand-split the text first. Wrap parse.system in the Python layer to strip a leading CONFIG block and unwrap INPUT/END; before handing the body to the native parser; a raw body (what the parser already accepted) is passed through unchanged, so this only widens what parses. Now parse.system(a_system.to_classic_input()) just works. Regression tests: parse tolerates all three forms, and the full to_classic_input -> parse.system round-trip. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
to_classic_input() writes complex coefficients as (re,im), but the FunctionParser only accepts (re+im*I) -- so a complex-coefficient system's own text did not round-trip (parse.system(sys.to_classic_input()) failed for any system with complex coefficients, e.g. a randomized tracking system). Rewrite (re,im) -> (re+im*I) in the parse wrapper so the round-trip holds for every system, real or complex (scientific notation included). Regression test covers eval-match round-trip + scientific-notation coefficients. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Complex::print streamed mp values at the ostream default -- 6 significant digits -- so every printed system with computed real coefficients was a ~1e-6 impostor of the true polynomials (found when a records bundle's crit-curve det system replayed differently than the in-run system; the System itself always held exact coefficients -- only the printer truncated). str(0) prints every digit the stored value carries, bare for real, (re,im) pair for complex; parse.system reconstructs the identical binary value (regression test asserts exact round-trip for real and complex coefficients). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…his path was never tracked' The enum bound every value except NeverStarted = -1, so a path whose metadata was never filled printed as the anonymous 'SuccessCode(-1)' -- exactly the code showing up on preimage-curve regeneration moves in half of all whitney gauntlet runs. Now it says what it means: the path never started. Co-Authored-By: Claude Fable 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.
Four small fixes to the classic-format I/O layer and one binding name, all surfaced by the cellular-decomposition reliability work driving b2 as an engine:
parse.systemtolerates a CONFIG section andINPUT/END;separators — real-world Bertini-1 input files carry them; the parser now skips the config block and separators instead of failing.parse.systemreads(re,im)complex coefficient literals — the classic complex spelling parses to exact coefficients.Complex::printviastr(0)) — previously ostream defaults truncated to ~6 digits, so a System round-tripped through classic format silently lost its coefficients (caught when saved decomposition bundles disagreed with the systems that produced them).SuccessCode::NeverStartedgets its name in the bindings — the anonymousSuccessCode(-1)that meant "the endgame never ran because the pre-endgame track failed"; naming it enables honestpre:<cause>failure attribution downstream.🤖 Generated with Claude Code