Skip to content

test: the conveyor corpus has no independent numeric oracle -- a lockstep VM+wasm drift would pass every test #951

Description

@bpowers

test/conveyors/reference_prototype.py is presented by test/conveyors/README.md and docs/design/conveyors.md sections 13/15 as the acceptance oracle for the core continuous conveyor. It is an executable transcription of the spec's per-DT algorithm (sections 4-7) and asserts the section 15 worked-example trajectories.

Nothing in CI or any test runs it. It is a standalone script (python3 test/conveyors/reference_prototype.py). The only automatic pin on the VM's belt numerics is src/simlin-engine/src/conveyor_tests.rs, which transcribes the prototype's expected values by hand into Rust asserts. The prototype is therefore a source document, not a live oracle, and the two can silently diverge.

Why it matters

This got sharper with #924. The corpus gate (simulate_special_path in src/simlin-engine/tests/integration/simulate.rs) runs each test/conveyors/ fixture through the VM, the protobuf round-trip, the XMILE round-trip, and the wasm backend, and asserts they all agree column-for-column. Its stated job is round-trip fidelity and VM-vs-wasm parity -- not numeric truth. The VM is the oracle for that harness. Consequences:

Components

test/conveyors/ (reference_prototype.py, README), src/simlin-engine (conveyor_tests.rs, tests/integration/simulate.rs), docs/design/conveyors.md.

Requested work

  1. Extend reference_prototype.py beyond the core continuous conveyor to cover:

    • leak zones (section 5.3, the zone_start/zone_end path schedule)
    • discrete admission and the per-time-unit <in_limit> budget (sections 6.3/6.4)
    • the queue-coupled serve (section 11 / queues.md section 9)

    The prototype already covers transport, capacity, inflow limit, linear + exponential leak, and non-integer-transit rounding.

  2. Run it from a Rust test against the four new fixtures: parse each .xmile, feed the belt parameters to the prototype, and compare its trajectory to the VM's at the corpus comparator's existing epsilons. This is the check that catches a lockstep VM+wasm drift; nothing else does.

  3. Keep it cheap. cargo test --workspace runs under a hard 3-minute wall-clock cap in pre-commit and CI, and individual unit tests must finish in a few seconds on a debug build.

Acceptable alternative if shelling out to python from a Rust test is too slow or too fragile a dependency: port the prototype's extended scenarios into conveyor_tests.rs as hand-derived closed forms. But the value lies entirely in the derivation being independent of the implementation -- a mechanical transcription of what the VM currently prints is worthless and must not be what lands.

Two stale doc claims to fix as part of this

Both currently assert the prototype pins the VM, which it does not:

  • test/conveyors/README.md (~line 8): "the VM's belt pass is itself pinned by reference_prototype.py (below) and by hand-derived closed forms in the Rust unit tests"
  • docs/design/conveyors.md section 13 (~line 1258): "the bytecode VM is the oracle, pinned in turn by reference_prototype.py"

#924 is rewording both to the truth -- that the automatic pin is conveyor_tests.rs, which transcribes the prototype -- and will reference this issue from the README's oracle paragraph. So the reword is handled; what remains here is the actual wiring.

Related

How it was discovered

Identified during review of #924 on branch conveyor-engine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions