Skip to content

engine: conveyor slat access like belt[1] reports a spurious error #948

Open

Description

@bpowers

Reading one slat of a conveyor, x = belt[1], simulates correctly but reports an Error diagnostic on x.
The CLI, libsimlin's error list (so the web app and pysimlin), and the agent tools all show a correct equation as broken.
A valid slat access should produce no diagnostic.

Example

cargo run -q -p simlin-cli -- simulate test/conveyors/conveyor_containers.xmile

prints

error in model 'main' variable 'second_slat': generic
error in model 'main' variable 'exit_slat': generic

for exit_slat = belt[1] and second_slat = belt[2], then the correct series.
SUM(belt), MEAN, MIN, MAX, STDDEV and SIZE over the same belt draw no error.
(The message text may have changed since generic was observed; the error itself is still noted in the fixture's comments.)

Why it matters

Diagnostics are computed on the model as written, where belt is a scalar stock, so belt[1] looks like a subscript on a non-arrayed variable.
Only the conveyor expansion, which the simulation path runs, turns it into a read of a slat.
An agent told the equation is broken may "fix" a correct model.
Slat access is specified (docs/design/conveyors.md section 10); the only models using it are our own fixtures.

Fix

Recommended: give the diagnostic pass the rule the expansion already uses: a subscript on a conveyor stock with one more index than the stock has dimensions is a slat read.
Share one predicate between the two so they cannot drift.

Alternative: compute diagnostics on the expanded model and map internal names back to user names.
This fixes the whole class but risks leaking internal names into messages.

The regression test should assert zero diagnostics for conveyor_containers.xmile; the corpus harness simulates it but never collects diagnostics.

Pointers

  • src/simlin-engine/src/conveyor_compile.rs: ContainerKind::Slat and the conveyor_dims map
  • src/simlin-engine/src/db/diagnostic.rs: collect_all_diagnostics
  • test/conveyors/conveyor_containers.xmile

Activity

  1. bpowers commented on Jul 11, 2026

    @bpowers
    OwnerAuthor

    Mechanism note (why nothing is red today): simulate_special_path -- the harness that runs conveyor_containers.xmile and every other test/conveyors/ fixture -- never calls collect_all_diagnostics. It builds the VM through queue_compile::build_sim, runs it, and diffs the slab against the protobuf round-trip, the XMILE round-trip, and the wasm blob. Diagnostics are outside its field of view entirely, so the corpus is green because the harness cannot see the spurious errors, not because they are absent.

    That is why the regression test for this issue must assert zero diagnostics rather than "it simulates" (already noted under Suggested fix). Adding the fixture to the corpus, which GH #924 did, does not close this.

  2. added
    engine
    bug
    on Oct 12, 2026
  3. changed the title [-]engine: conveyor container slat access (belt[1]) simulates correctly but emits a spurious Error diagnostic[/-] [+]engine: conveyor slat access like belt[1] reports a spurious error[/+] 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

    bugengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions