Skip to content

Classic-format I/O hardening: tolerant parsing, full-precision printing, NeverStarted named - #375

Open
ofloveandhate wants to merge 4 commits into
developfrom
feature/parse-tolerant-config-input
Open

Classic-format I/O hardening: tolerant parsing, full-precision printing, NeverStarted named#375
ofloveandhate wants to merge 4 commits into
developfrom
feature/parse-tolerant-config-input

Conversation

@ofloveandhate

Copy link
Copy Markdown
Contributor

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.system tolerates a CONFIG section and INPUT/END; separators — real-world Bertini-1 input files carry them; the parser now skips the config block and separators instead of failing.
  • parse.system reads (re,im) complex coefficient literals — the classic complex spelling parses to exact coefficients.
  • float coefficients print at FULL precision in classic input (Complex::print via str(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::NeverStarted gets its name in the bindings — the anonymous SuccessCode(-1) that meant "the endgame never ran because the pre-endgame track failed"; naming it enables honest pre:<cause> failure attribution downstream.

🤖 Generated with Claude Code

ofloveandhate and others added 4 commits July 21, 2026 11:25
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant