Skip to content

ltm: some --ltm output prints in a different order each run #1036

Open

Description

@bpowers

With --ltm, some output still comes out in a different order from one process to the next for the same binary and model.
The set of lines is stable; only the order moves.
It should be a function of the model.

The largest source is fixed: the causal-edge map LTM walks to emit link-score warnings is now a BTreeMap (#1071), so C-LEARN's 25 warnings, where this was first seen, should now print in a fixed order (not re-checked).
Two hash-ordered loops remain:

  • In model_ltm_variables, the loop over a module's input-port pathways iterates a HashMap, so the "unresolved pathway link" warnings of a sub-model come out in random order.
  • ltm_loop_report in the CLI iterates the project's models from a HashMap, so a multi-model project prints its # Loops in model '...' blocks in random order.

Why it matters

Low severity: text only, no numbers change.
But diffing --ltm output between two builds needs a sort first, and diagnostics are meant to be deterministic.

Fix

Sort at both sites: iterate the pathways' input ports in name order, and iterate models in name order in the CLI.
Add one LTM-enabled case to diagnostic_determinism_tests.rs (it has none today): a model with a sub-model that produces at least two unresolved-pathway warnings, checked across fresh databases.

Pointers

  • src/simlin-engine/src/db/ltm/mod.rs: for (input_port, port_pathways) in &pathways in model_ltm_variables
  • src/simlin-engine/src/ltm/graph.rs: ModulePathways is a HashMap
  • src/simlin-cli/src/main.rs: ltm_loop_report
  • src/simlin-engine/src/db/diagnostic_determinism_tests.rs

Activity

  1. added
    engine
    ltm
    on Sep 2, 2026
  2. changed the title [-]ltm: --ltm warning order is process-random (model_ltm_variables iterates CausalEdgesResult.edges HashMap)[/-] [+]ltm: some --ltm output prints in a different order each run[/+] 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

    bugengineltm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions