Skip to content

Record initialization failures when stepping a solver - #37

Open
ugin-man wants to merge 3 commits into
tscircuit:mainfrom
ugin-man:koyo/capture-setup-failure-20260909
Open

Record initialization failures when stepping a solver#37
ugin-man wants to merge 3 commits into
tscircuit:mainfrom
ugin-man:koyo/capture-setup-failure-20260909

Conversation

@ugin-man

@ugin-man ugin-man commented Sep 8, 2026

Copy link
Copy Markdown

When _setup() throws during step() or solve(), the exception currently escapes before the existing failure handler. The solver remains failed = false with error = null, and a subsequent step() retries initialization. step() also initializes a solver that was already marked solved or failed.

Move initialization inside the existing step exception handler and check terminal state before initialization. Keep the post-setup terminal check, so setup may still finish or reject a problem without consuming an iteration. Rethrow the original exception and leave direct explicit setup() calls and final-acceptance behavior unchanged.

Nine regression/control tests cover setup exceptions through step/solve, no automatic retry, already terminal solvers, terminal states set during setup, successful one-time setup and existing step exceptions.

Verification

At head d3a16d9183de027b280c8754f8c9be62bc677794, all three upstream checks passed:

The initial CI run passed tests/typechecking and requested only assertion formatting; the follow-up commit resolves that check.

Local verification: the exact BaseSolver source was checked against Git blob e071bf8c1fe3e2fb4eae73bbaa4e282871d15f02. With Node 22.16.0 type stripping, the new cases yielded 5 failures / 4 passes before, and 9 passes after. The local test copy only changes the bun:test import to node:test and adds .ts to the source import, using the same Node assert assertions without production mocks. The graphics-debug import is type-only. No build or browser test is claimed.

Base: a72b99f60680ffbe56a4c72e113ca52c9469921e; independent of pending #30, #35 and #36. Prepared with ChatGPT assistance and the account owner's authorization. No manual human testing is claimed.

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

@ugin-man is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

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