You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ltm: emit compile-time error when ltm_enabled is true and integration is non-Euler #486
The 2023 flow-to-stock link-score formula assumes Euler integration: PREVIOUS(flow) - PREVIOUS(PREVIOUS(flow)) aligns the numerator to the causal interval that drove the stock change from t-1 to t. Under RK2/RK4 this alignment breaks and link scores become mathematically nonsensical. Nothing currently prevents a user from setting integration_method = RK4 and ltm_enabled = true; they get numbers that look plausible but are wrong.
Verification
RK4, Rk4, RungeKutta4, and integration_method appear nowhere in ltm_augment.rs, db_ltm.rs, or the LTM path through db.rs. There is no compile-time or runtime guard.
Locations
src/simlin-engine/src/ltm_augment.rs:762-784 -- the Euler-only flow-to-stock formula
src/simlin-engine/src/db.rs -- SourceProject carries ltm_enabled and ltm_discovery_mode but no integration_method awareness in the LTM path
Suggested fix
Emit a hard compile-time diagnostic (Error severity) when:
project.ltm_enabled(db) == true
AND the model's sim specs select a non-Euler integrator
The error message should reference the Euler assumption explicitly so users understand why the combination is rejected. This is a correctness guardrail; LTM scores under RK2/RK4 should not silently mislead.
Severity
medium (silent correctness when both options are enabled)
Fixed in PR #668 (merged as f9f850d). assemble_simulation now rejects LTM on non-Euler models with an Euler-assumption message, resolving the effective method exactly as the VM does (main model's sim_specs override, else project specs) and only when the assembled sim (root + transitively instantiated submodules) has stocks. Surfaces through simlin_sim_new, the wasm compile (WasmGenError::Unsupported), and pysimlin. Pinned by test_ltm_main_rk4_submodel_stock_is_rejected / test_ltm_submodel_rk4_override_main_euler_is_accepted (both red-verified) among others. The over-rejection of loop-free-stock models is tracked separately as #663.
Activity
LTM hardening: close out the top tracked gaps from epic #488 (#668)
bpowers commentedon Jun 2, 2026
Fixed in PR #668 (merged as f9f850d). assemble_simulation now rejects LTM on non-Euler models with an Euler-assumption message, resolving the effective method exactly as the VM does (main model's sim_specs override, else project specs) and only when the assembled sim (root + transitively instantiated submodules) has stocks. Surfaces through simlin_sim_new, the wasm compile (WasmGenError::Unsupported), and pysimlin. Pinned by test_ltm_main_rk4_submodel_stock_is_rejected / test_ltm_submodel_rk4_override_main_euler_is_accepted (both red-verified) among others. The over-rejection of loop-free-stock models is tracked separately as #663.
engine: surface LTM compile errors through ModelAnalysis (GH #660)
engine: narrow non-Euler LTM guard to flow-to-stock scores
doc: fully specify conveyor semantics + reference prototype
libsimlin,pysimlin: surface analysis_error on discovery results
engine: LTM fidelity fixes from the paper audit (#1062)