Problem
Two independent offset machineries size a module-typed body variable differently when the submodel contains a table-only (lookup-only) variable:
calc_flattened_offsets_incremental (src/simlin-engine/src/db/assemble.rs) sizes a module-typed body variable by the sum of its sub_offsets entry sizes, which excludes table-only / lookup-only variables (they are skipped from the offsets map).
compute_layout (src/simlin-engine/src/db/layout.rs) sizes the same submodule by the full sub_layout.n_slots, which does count table-only slots.
If a submodel contains a table-only variable (the standalone lookup-only kind from #606) and is instantiated as a module, the two machineries can disagree on the submodule's size, corrupting result-map slot offsets (an off-by-N in the result map).
Why it matters
This is a latent correctness bug: result-map slot offsets could silently point at the wrong slots for any model that instantiates such a submodel as a module. It produces wrong numbers, not a crash.
Current status
Components affected
src/simlin-engine/src/db/assemble.rs (calc_flattened_offsets_incremental)
src/simlin-engine/src/db/layout.rs (compute_layout)
Possible approach
Reconcile the two size computations so both either include or exclude table-only slots consistently. Add a regression test: a submodel containing a lookup-only variable, instantiated as a module, asserting the results-map offsets match the assembled layout (i.e. the two machineries agree).
Severity
medium / latent correctness bug.
Context
Identified during the salsa-pipeline-cleanup refactor.
Problem
Two independent offset machineries size a module-typed body variable differently when the submodel contains a table-only (lookup-only) variable:
calc_flattened_offsets_incremental(src/simlin-engine/src/db/assemble.rs) sizes a module-typed body variable by the sum of itssub_offsetsentry sizes, which excludes table-only / lookup-only variables (they are skipped from the offsets map).compute_layout(src/simlin-engine/src/db/layout.rs) sizes the same submodule by the fullsub_layout.n_slots, which does count table-only slots.If a submodel contains a table-only variable (the standalone lookup-only kind from #606) and is instantiated as a module, the two machineries can disagree on the submodule's size, corrupting result-map slot offsets (an off-by-N in the result map).
Why it matters
This is a latent correctness bug: result-map slot offsets could silently point at the wrong slots for any model that instantiates such a submodel as a module. It produces wrong numbers, not a crash.
Current status
is_rootrefactor -- this is pre-existing; the salsa-pipeline-cleanup refactor surfaced it.gf(Time)lowering being a unit error; this is about the two offset machineries disagreeing on submodule size when such a variable is present.Components affected
src/simlin-engine/src/db/assemble.rs(calc_flattened_offsets_incremental)src/simlin-engine/src/db/layout.rs(compute_layout)Possible approach
Reconcile the two size computations so both either include or exclude table-only slots consistently. Add a regression test: a submodel containing a lookup-only variable, instantiated as a module, asserting the results-map offsets match the assembled layout (i.e. the two machineries agree).
Severity
medium / latent correctness bug.
Context
Identified during the salsa-pipeline-cleanup refactor.