Repository navigation
Description
When an LTM equation compiles but refers to a variable that has no slot in the model's layout, assembly drops it silently: the variable keeps its slot and reads 0 every step, and every loop score through it reads 0.
No diagnostic says so.
That is intended for one case (a sub-model's LTM equation the parent model re-emits under qualified names), but nothing distinguishes that case from a real omission.
No current path is known to produce a real omission.
One did: link scores into a pass-through user module referenced a composite score the module never had, and every loop through such a module read 0.
That emitter now checks that the composite exists first (module_composite_ports), which fixes that path but not the class.
Why it matters
A loop score of 0 tells the modeler the loop does not matter, which is worse than an error.
The next emitter that names a missing variable will fail the same way.
Fix
In assemble_module, warn when an LTM variable or LTM helper is dropped for having no layout slot in the root model.
The drop is documented as the sub-model stdlib-instance case and never fires on single-model test fixtures; that it cannot fire legitimately in the root is likely but unverified.
Small.
Alternative: also detect the sub-model case precisely by checking that the root emits the qualified equivalent; more work for a case with no known bug.
Reasonable to close instead if the owner prefers to rely on per-emitter checks.
Pointers
src/simlin-engine/src/db/assemble.rs: the twofragment_vars_in_layoutdrops (LTM variables and LTM helpers)src/simlin-engine/src/db/ltm/compile.rs:model_ltm_fragment_diagnostics(reports compile failures only; its rustdoc describes the silent drop)src/simlin-engine/src/db.rs:module_composite_ports- Related: ltm: module pathway scores read 0 through reducer or declined links #768 (module pathway scores reading 0)
Activity
bpowers commentedon Jun 10, 2026
Helper-leg instance of this class, post-
cd96ffcf(the GH #741 diagnostics leg on branchltm-fix-batch-2):A successfully-COMPILED LTM implicit helper dropped by assembly's layout-presence check is still silent.
src/simlin-engine/src/db/assemble.rs:1413-1418drops a helper fragment whenfragment_vars_in_layoutfails -- even though the fragment compiled fine -- so the helper keeps its layout slot and reads a constant 0 at runtime. The new #741 helper probe inmodel_ltm_fragment_diagnostics(src/simlin-engine/src/db/ltm/compile.rs, commitcd96ffcf) deems such a helper "compiled ok" (it checks only for value-bearing-phase bytecode), so no Warning fires. Its doc comment explicitly carves this out: "A fragment that compiles but whose variable references do not resolve in the model's layout is the documented sub-model dedup case ... that drop is intentionally left silent."That carve-out is sound only for the benign sub-model dedup case (the root re-emits an equivalent fragment under qualified names). A layout-absence with NO root-level equivalent is exactly this issue's failure mode -- compiles cleanly, reads silent 0 -- just surfacing on the implicit-HELPER leg rather than a synthetic variable's cross-module reference. Note the synthetic-variable leg has the identical structure at
db/assemble.rs:1383(samefragment_vars_in_layoutdrop, same dedup rationale).When implementing the suggested "warn when a fragment compiled against a stubbed/absent dependency / no laid-out slot" guard, please cover both legs (synthetic vars at
assemble.rs:1383, implicit helpers atassemble.rs:1413-1418), and have the guard distinguish the benign dedup drop (root emits a qualified equivalent) from a genuine absence -- a blanket warning on everyfragment_vars_in_layoutfailure would be noisy for the documented dedup case, while the current blanket silence hides the dangerous one.Identified during adversarial review of the #741 work (PR branch
ltm-fix-batch-2, commitcd96ffcf).ltm: scoring-correctness and visibility batch from epic #488 (#775)
[-]ltm: a generated reference to an absent cross-module LTM variable compiles cleanly and reads a silent constant 0[/-][+]ltm: LTM variable dropped at assembly silently reads 0[/+]