Repository navigation
Description
Summary
SearchGraph in src/simlin-engine/src/ltm_finding.rs excludes zero-score (and NaN) edges from each per-timestep search graph, justified by an in-code completeness claim that is too strong. Three comments assert variants of "any loop that ever matters has all-nonzero links at the step where it does, and remains discoverable there":
src/simlin-engine/src/ltm_finding.rs~L204-208 (SearchGraph::from_edges): "Any loop that ever matters has all-nonzero links at the timestep where it does, and remains discoverable there."src/simlin-engine/src/ltm_finding.rs~L1277-1281 (step_adj): "any loop that ever matters has all-nonzero links at the step where it does -- where it remains discoverable (GH ltm-finding: strongest-path discovery infeasible on large arrayed models (element-level blowup) #647)."src/simlin-engine/src/ltm_finding.rs~L3071-3074 (test_inactive_loop_found_at_active_stepdoc): "Discovery runs at every timestep, so per-step exclusion of inactive edges loses no loop that ever matters."
The claim is false for a "baton-passing" loop whose links are each active at different times but are never all simultaneously nonzero at any single (sampled) timestep. The exclusion is correct per-step (a loop with a zero-score link genuinely has loop score 0 there), but the completeness conclusion does not follow: there is no requirement that all of a real loop's links be simultaneously nonzero at some timestep.
Why this matters
- Correctness of attribution / overstated guarantee. The comments imply discovery is complete with respect to "loops that ever matter," which is not what the algorithm delivers. A class of dynamically-real loops is silently invisible to discovery while exhaustive mode reports them.
- A test enshrines the gap with a misattributed cause.
discovery_decoupled_stocksinsrc/simlin-engine/tests/simulate_ltm.rsassertsfound.len() == 2(the two self-loops) and its comment blames the removedbest_scorepruning ("the strong self-loop paths set high best_scores on shared nodes ... pruning the weaker cross-stock path"). The real cause is the zero-edge exclusion plus non-overlapping link activity, not best-score pruning. The comment is stale/wrong.
Empirical demonstrations
-
test/decoupled_stocks/decoupled.stmx-- exhaustive structural analysis finds 3 loops (two self-loops plus the cross loopstock_1 -> flow_2 -> stock_2 -> flow_1); discovery finds only 2. The cross loop is missed becausestock_1 -> flow_2is nonzero only at step 4 whilestock_2 -> flow_1is nonzero only at steps 6-10 -- the two links never overlap at any saved step, so the cross loop has no single timestep where all its links are nonzero. -
Sub-
save_stepgating -- a model withdt = 0.25,save_step = 1.0, and a cross loop gated byPULSE(0.5, 0)firing at an unsaved sub-step: the gated link's score reads0.0at every saved step, so discovery misses the loop entirely while exhaustive reports it. This second aspect (sampling atsave_steprather thandt) is the part ltm: discovery misses loops active only between saved steps #309 already covers; demonstration (1) is independent ofsave_stepand would persist even at fulldtresolution.
Component(s) affected
src/simlin-engine/src/ltm_finding.rs(the three comments,SearchGraph::from_edges,step_adj/discover_step)src/simlin-engine/tests/simulate_ltm.rs(discovery_decoupled_stocksexpectation + misattributing comment)
Scope note (not a regression vs the published method)
This is not a regression relative to the Eberlein & Schoenberg per-step discovery method -- per-step discovery inherently shares this property (a loop is only ever surfaced at a step where it is fully active). The ask here is to soften the in-code "loses nothing" claims and document the limitation, not to change the algorithm.
Suggested resolution
- Reword the three comments to the accurate guarantee, e.g.: "loses no loop that is ever simultaneously active at a sampled timestep" -- and explicitly note that a baton-passing loop whose links are active at disjoint times can be missed (exhaustive mode still finds it).
- Fix the
discovery_decoupled_stockscomment to attribute the missed cross loop to the zero-edge-exclusion / non-overlapping-link-activity cause, not the removed best-score pruning. Keepfound.len() == 2as the documented expected behavior, now correctly explained. - Optionally document the limitation in the user-facing LTM reference alongside the per-step /
save_stepcaveats.
Relationship to existing issues
- Related to but broader than ltm: discovery misses loops active only between saved steps #309 ("discovery runs at save_step instead of dt"): ltm: discovery misses loops active only between saved steps #309 covers only the sub-
save_stepsampling aspect (demonstration 2). The baton-passing limitation (demonstration 1) holds even at fulldtresolution, so this is filed separately and cross-references ltm: discovery misses loops active only between saved steps #309 rather than extending it. Part of the LTM epic epic: Loops that Matter (LTM) -- open work #488.
Context
Identified during a deep LTM review while cross-validating discovery against exhaustive results on test/decoupled_stocks/decoupled.stmx.
Activity
ltm: document discovery completeness gaps and dt scaling
bpowers commentedon Jun 8, 2026
Fixed by PR #705 (merged, commit 26a641e), verified present on
main:stitch_cross_agg_petals/collect_agg_petalscore (ltm_finding.rs:2370); 3-element repro returns the same 7 loops as exhaustive.discovery_module_exit_port,ltm_finding.rs:2013), wired intoanalyze_modelviacausal_graph_from_element_edges_with_modules; regression tests driveanalyze_modelend-to-end.ltm_finding.rs:223), and thediscovery_decoupled_stockscomment was corrected.Closing as resolved. (FFI surfacing of the #696 truncation flag remains tracked as #701.)