Skip to content

engine: reading a conveyor's leak or outflow in an equation is refused #944

Open

Description

@bpowers

Any equation that reads a conveyor's outflow or leak flow is refused with ConveyorDrivenFlowRead.
That blocks a real Stella model.
It should simulate, giving the same value Stella does.

Example

test/conveyors/covid19_severity.stmx (vendored from the peterhovmand COVID-19 models, written by isee/Ventana staff) has

death rate = SUM(contagious_deaths[*]) + SUM(non_contagious_deaths[*])
           + SUM(tested_contagious_deaths[*]) + SUM(tested_non_contagious_deaths[*])

where all four are leak flows off conveyors.
Compiling it fails:

variable 'death rate' references conveyor-driven flow 'contagious_deaths'; a conveyor
outflow/leak cannot be read by another equation (it is computed after the flows phase)

Why it matters

Summing a belt's leak flows to report a rate is an ordinary Stella idiom, not a corner case.
The refusal is correct for today's evaluation order: the conveyor pass runs after the flows phase and before the stocks phase, so an auxiliary computed in the flows phase would read 0 for the flow.
Refusing is better than that wrong number, but it leaves the model unsimulatable on every backend.

Fix

Evaluate auxiliaries that read a conveyor-driven flow after the conveyor pass, before stocks are integrated.
The dependency graph has to split auxiliaries into before-pass and after-pass sets and refuse a cycle that crosses the split (an after-pass value feeding something the pass reads).
This also covers PREVIOUS(driven_flow), item 2 of #865.

Validate against a trajectory not produced by the engine itself: Stella output for covid19_severity.stmx, or a small hand-worked model of the same idiom.
The model also has unrelated unit errors.

Pointers

  • src/simlin-engine/src/conveyor_compile.rs: the refusal, find_driven_flow_read
  • src/simlin-engine/src/queue_compile.rs: compile_sim, shared by VM and wasm
  • covid_leak_fixture_is_blocked_by_the_driven_flow_read_rule in src/simlin-engine/src/wasmgen/belt_tests.rs, and the blocked list in tests/integration/simulate.rs, pin the refusal and will fail when it is fixed
  • engine: a conveyor leak fraction given as a graphical function is ignored #865 item 2

Activity

  1. added
    engine
    compat
    enhancement
    on Oct 12, 2026
  2. changed the title [-]engine: a direct read of a conveyor-driven leak flow is rejected, blocking a real Stella model (covid19_severity.stmx)[/-] [+]engine: reading a conveyor's leak or outflow in an equation is refused[/+] 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

    compatengineenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions