You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
engine: arrayed <element> entries with unknown subscripts are silently dropped; declared elements with no entry silently default to 0 (no diagnostic) #905
For non-apply-to-all arrayed variables (any kind -- stock, aux, flow; not conveyor-specific), the engine silently tolerates two malformed shapes with no compile error and no editor diagnostic:
Typo'd subscript: an <element subscript="c"> entry whose subscript names no declared element of the variable's dimensions. The entry's equation is silently dropped; the variable compiles and simulates.
Missing element: a declared element with no <element> entry and no default/top-level <eqn>. That element silently initializes/evaluates to 0.
Concrete example
Verified 2026-07-08 on branch conveyor-engine via adversarial-review scratch tests: an ordinary arrayed stock over dimension board{a,b} with
builds a VM successfully (plain[a]=30, plain[b]=0) and db::collect_all_diagnostics returns an empty vec -- the editor shows nothing. The same silence applies to the missing-element case (declare board{a,b} but only provide an <element> for a: plain[b] is 0 with no signal).
This also applies to the new per-element conveyor init lists (GH #889 work in conveyor_compile.rs), which deliberately mirror the general behavior: a typo'd per-element init list is silently ignored and the belt steady-fills from nothing (0).
Why it matters
A single-character typo in a subscript name produces a model that simulates plausible-looking but wrong results with no signal that anything is off. This is the same class of silent-wrong-model hazard as #697 (arrayed equation on an undimensioned variable), but for the complementary case: a correctly dimensioned variable with a malformed per-element equation list.
Component(s) affected
src/simlin-engine/src/compiler -- Equation::Arrayed lowering (per-element entries are matched against declared elements; unmatched entries are dropped, unmatched declared elements default to 0)
src/simlin-engine/src/db -- diagnostic collection (collect_all_diagnostics reports nothing for either shape)
src/simlin-engine/src/conveyor_compile.rs -- per-element conveyor init lists inherit the same silence
Expected behavior / possible approaches
Emit a loud diagnostic for both shapes:
The typo case (an element entry naming no declared element) should arguably be an Error: the modeler wrote an equation the engine is discarding.
The missing-element case (declared element with no entry and no default) should be at least a Warning: implicit 0 is occasionally intended but usually a mistake; XMILE's default/has_except_default machinery exists precisely so the modeler can be explicit.
Validation could live in datamodel/lowering (alongside the fix for #697) so both the compile path and collect_all_diagnostics surface it.
Context
Identified during adversarial review of the conveyor-engine branch (PR #869 follow-on work for #889), where per-element conveyor init lists were made to mirror the general arrayed-element behavior and inherited its silence.
Activity
engine: support per-element conveyor init lists; document header forms
engine: warn on unresolvable arrayed element subscripts
engine: apply the implicit WITH-LOOKUP wrap to arrayed variables
engine: support per-element conveyor init lists; document header forms
engine: warn on unresolvable arrayed element subscripts
engine: apply the implicit WITH-LOOKUP wrap to arrayed variables