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
engine: recurrence inside a module with wired inputs reports a false cycle #573
The engine resolves element-by-element recurrences (like x[t2] = x[t1] + 1) by looking for dependency cycles in the model as if it had no module inputs.
When the model is used as a module with wired inputs, its real dependencies differ, so a recurrence inside such a module can be missed and reported as a circular dependency.
Example
Unknown; no model in the repo hits this.
All the recurrence test models (ref.mdl, interleaved.mdl, init_recurrence.mdl) are root models with no inputs.
Why it matters
The failure is a spurious circular-dependency error, never a wrong number: the final dependency check runs on the real wired-up graph and rejects anything left unresolved.
It would only affect a user who writes a per-element recurrence inside a module that takes inputs.
Fix
Pass the module's real input names into recurrence resolution instead of an empty list.
Cost: resolution is cached once per model today; with inputs it would be cached once per distinct wiring.
Alternative: leave it, since the failure is a clear error, and revisit if a real model hits it.
Pointers
src/simlin-engine/src/db/dep_graph.rs: resolve_recurrence_sccs (its rustdoc explains the no-input choice), no_input_var_info, model_dependency_graph_impl
changed the title [-]engine: element-cycle dt-recurrence SCC resolution uses no-input build_var_info wiring; Phase 2 must plumb real module_input_names before consuming ResolvedScc.element_order[/-][+]engine: recurrence inside a module with wired inputs reports a false cycle[/+]on Oct 12, 2026
The worst case is a clear error, never a wrong number: the final check runs on the wired graph. No real model hits it, and the fix costs per-wiring caching. The no-input choice is documented in the resolve_recurrence_sccs rustdoc; reopen if a user hits it.
Activity
engine: phase 2 review doc-accuracy fixes (no logic change)
[-]engine: element-cycle dt-recurrence SCC resolution uses no-input build_var_info wiring; Phase 2 must plumb real module_input_names before consuming ResolvedScc.element_order[/-][+]engine: recurrence inside a module with wired inputs reports a false cycle[/+]bpowers commentedon Oct 12, 2026
Closing as won't fix.
The worst case is a clear error, never a wrong number: the final check runs on the wired graph. No real model hits it, and the fix costs per-wiring caching. The no-input choice is documented in the resolve_recurrence_sccs rustdoc; reopen if a user hits it.