Skip to content

ltm: pins on a model with no stocks are dropped without a warning #772

Open

Description

@bpowers

On a model with no state (no stocks, no PREVIOUS, no stateful modules), LTM returns early before it validates pinned loops.
A pin on such a model, including a misspelled one, is dropped without the usual invalid-pin warning.
It should get a warning saying pins are ignored because the model has no state.

Example

A model with only auxiliaries, plus a pinned loop over {a, b}: no LTM output and no diagnostic.
The same pin on a model with one stock gets "contains no stock" or "do not form a closed feedback loop" as appropriate.

Why it matters

Low severity and uncommon: a model with no stocks has no feedback loops to pin (an instantaneous cycle is a compile error), so the only realistic case is a model whose stocks were deleted after a loop was pinned.
The pin then silently does nothing.

A second case, a loop whose only state is a PREVIOUS inside a sub-model, is reported in the loop list but never scored; that is #773, and fixing it there makes the model count as having state.
An instantaneous cycle through a module with no stock does not compile (pinned_loop_through_stockless_passthrough_rejected), so it is not a case here.

Fix

In the stateless early return of model_ltm_variables, emit one warning per pinned loop ("ignored: the model has no stocks or other state").
Alternative: let pin validation run before the early return, so pins get the same messages as on any other model.

Pointers

  • src/simlin-engine/src/db/ltm/mod.rs: the model_is_stateless early return in model_ltm_variables
  • src/simlin-engine/src/db/ltm/pinned.rs: model_pinned_loops

Activity

  1. added
    ltm
    on Jun 11, 2026
  2. changed the title [-]ltm: model_detected_loops has no stateless gate -- stateless-but-cyclic shapes report unscoreable loops and silently drop pins[/-] [+]ltm: pins on a model with no stocks are dropped without a warning[/+] on Oct 12, 2026
  3. added
    bug
    on Oct 12, 2026
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

    bugltm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions