Skip to content

engine: incremental compiler panics on C-LEARN #363

Closed

Description

@bpowers

The incremental compiler panicked on C-LEARN instead of returning an error, and several callers (the compiler benchmark, a cross-validation test loop, LTM analysis, layout) wrapped it in catch_unwind.
That does not help in WASM, where a panic aborts.

Status

Fixed on main.
The panic (a PREVIOUS with a subscript in code generation) became a typed error in #592, and C-LEARN now compiles and runs in the default test suite.
None of the listed catch_unwind wrappers remain.
The remaining catch_unwind calls are in tests: corpus sweeps that guard against importer panics, and tests of assertions that are meant to panic.

Pointers

  • src/simlin-engine/tests/integration/simulate.rs: simulates_clearn

Activity

  1. bpowers commented on May 19, 2026

    @bpowers
    OwnerAuthor

    Re-verification (element-cycle-resolution Phase 6 Task 3)

    Per the Phase 6 plan, #363 was re-verified after the element-level lagged-read strip in the symbolic SCC graph landed (Task 3 Part B). The plan's thesis was that the cycle gate's false CircularDependency was masking #363's deeper-pipeline panic; with the gate now clean, the panic should reproduce if it still exists.

    Outcome: #363's panic does NOT reproduce. The incremental compiler returns a clean typed Result::Err on C-LEARN — it does not panic, unwrap, or expect-blow-up anywhere in the incremental path.

    Evidence (debug build, RUST_BACKTRACE=1/full):

    • compile_project_incremental on test/xmutil_test_models/C-LEARN v77 for Vensim.mdl returns Err(NotSimulatable, "failed to compile fragments for variables: ...") — a clean error, no panic.
    • A direct diagnostic harness calling compile_project_incremental + assemble_simulation on C-LEARN passes (no panic, no backtrace; both return Err cleanly).
    • The element-cycle gate itself is now clean: has_circular_dependency = false, model_dependency_graph: has_cycle=false, the 22-member recurrence SCC resolves in both the dt and init phases.
    • The only panic observed is the Phase 6 Task 1 structural-gate test's own panic!("AC7.1 ...") assertion on compile_result.is_err() at tests/simulate.rs:3610 (frames entirely in the test harness) — that is correct AC7.5 test behavior, not an engine-internal panic.

    Conclusion: #363's incremental-compiler panic on C-LEARN was masked by the cycle gate and/or already eliminated by prior element-cycle-resolution phases. It does not reproduce now that the gate is clean. The residual C-LEARN compile failure is a separate, clean-error assemble_simulation fragment-compile gap (synthetic temp-arg helpers + a few real arrayed vars), filed as #580 — that is not a panic and not #363.

    Leaving #363 open (not closing) pending owner direction: the catch_unwind removal/audit it tracks (Phase 6 Task 2 retires the one residual test-only C-LEARN catch_unwind; the historical bench/analysis/layout sites were already removed on this branch) and a final no-panic confirmation once #580 lets C-LEARN compile end-to-end may still warrant tracking under this issue.

  2. added
    engine
    bug
    on Jun 8, 2026
  3. changed the title [-]Incremental compiler panics on C-LEARN model (catch_unwind workaround)[/-] [+]engine: incremental compiler panics on C-LEARN[/+] on Oct 12, 2026
  4. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: already fixed on main.

    The codegen panic site now propagates a typed Err (src/simlin-engine/src/compiler/codegen.rs:935-950, from #592 / 81cdcb1) and C-LEARN compiles and runs un-wrapped in the default suite (simulates_clearn, tests/integration/simulate.rs:4011). No catch_unwind remains in benches/, src/analysis.rs, src/layout/ or src/db/; the remaining ones are test-only (importer guards in analysis_reads_tests.rs, tools/loops_tests.rs, tools/corpus_tests.rs; panic-assertion tests) plus libsimlin's VDF-open guard (src/libsimlin/src/results.rs:90), which is unrelated to the compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions