Repository navigation
Description
Problem
run_ltm_pipeline in src/simlin-engine/src/analysis.rs (around line 161) does:
let compiled_sim =
crate::db::compile_project_incremental(db, source_project, &canonical_name).ok()?;On any compile failure it .ok()?s to None, and analyze_model then returns an empty ModelAnalysis (no loops, intact model snapshot) with no explanation. The rustdoc on analyze_model documents this as intended ("Returns gracefully on simulation failure (empty loop fields, model snapshot intact)").
This was a benign graceful-degradation pattern until GH #486 landed the hard-fail compile guard for LTM + non-Euler integration (assemble_simulation returns an Err when ltm_enabled and the effective method is RK2/RK4 with stocks present). Now analyze_model on an RK4 model returns "no loops" silently -- the actionable, specific Euler error from the assemble path is discarded by the .ok()?, so the caller cannot tell "this model genuinely has no loops" apart from "this model could not be compiled for LTM analysis."
Why it matters
Diagnostic/UX gap. The MCP analyze surfaces are the primary consumers:
src/simlin-mcp-coreread_model.rs(around line 108)src/simlin-mcp-coreedit_model.rs(around line 320)
An AI agent or CLI caller asking "what loops does this model have?" on an RK4+LTM model gets an empty result and no hint that the real issue is the non-Euler integration method. The error is genuinely actionable (switch to Euler, or disable LTM) but is thrown away.
Components affected
src/simlin-engine/src/analysis.rs(run_ltm_pipeline,analyze_model)src/simlin-mcp-core/src/tools/read_model.rs,edit_model.rs(consumers)
Possible approaches
- Have
run_ltm_pipeline/analyze_modeldistinguish "compiled, no loops" from "failed to compile" and surface the compileErrstring (or a structured diagnostic) instead of collapsing both to an emptyModelAnalysis. - At minimum, propagate the assemble-stage
Errmessage intoModelAnalysisso the MCP analyze surfaces can show it.
Severity
Low-medium (UX / diagnostic visibility; not a correctness bug -- the result is empty, not wrong).
Discovery context
Identified during an LTM-hardening session reviewing the interaction between the GH #486 non-Euler hard-fail guard and the pre-existing graceful-degradation in analyze_model.
Part of epic #488.
Activity
LTM hardening: close out the top tracked gaps from epic #488 (#668)
engine: surface LTM compile errors through ModelAnalysis (GH #660)