Skip to content

engine: XMILE <element> without <eqn> fails whole-file parse with opaque 'missing field eqn' (gf-only and len-only elements are spec-legal) #907

Closed

Description

@bpowers

Problem

The XMILE reader's <element> struct (VarElement in src/simlin-engine/src/xmile/variables.rs) declares pub eqn: String as a required field. Any <element> block WITHOUT an <eqn> child therefore fails deserialization of the ENTIRE file with the opaque error:

ModelError{xml_deserialization: missing field 'eqn'}

The error names neither the variable nor the element, so users have no way to locate the offending block.

Element blocks without an <eqn> are legal XMILE. Spec section 4.5.2 allows each <element> to carry per-element simulation attributes and per-element graphical functions, e.g.:

  • a graphical-function-only element: <element subscript="a"><gf>...</gf></element> (lookup-only per-element definitions)
  • a conveyor per-element <len>-only element: <element subscript="a"><len>2</len></element>

Concrete evidence

  • The vendored corpus file test/test-models/samples/arrays/non-a2a/non-a2a-gf.stmx cannot be opened at all today -- open_xmile returns exactly the error above. It is not wired into the simulate corpus (its sibling non-a2a.stmx is), so the breakage is invisible to CI.
  • A minimal synthetic file with <element subscript="a"><len>2</len></element> on an arrayed conveyor fails the whole-file parse the same way.
  • By contrast, <element> blocks that DO have an <eqn> silently drop unrecognized sub-tags like <len> -- that silent-drop half is tracked separately as xmile: per-element <len> on an arrayed conveyor is silently dropped #904.

Why it matters

  • Interop/correctness: spec-legal Stella exports are un-openable, and the failure mode is total (whole file rejected) with an undiagnosable error.
  • Test coverage: a vendored corpus model is dead weight because the reader cannot load it.

Component

src/simlin-engine/src/xmile/variables.rs (VarElement).

Suggested disposition

Make eqn optional on VarElement (defaulting to an empty equation, which the engine already treats as lookup-only when a gf is present), or at minimum surface a targeted diagnostic naming the variable and element subscript. This would let non-a2a-gf.stmx open and potentially join the simulate test corpus.

Context

Confirmed while working #904/#905 on branch conveyor-engine (PR #869 line of work, 2026-07-08). Related but distinct: #904 (per-element <len> silently dropped when <eqn> present), #888 (same hard-fail-on-unknown pattern in the <options> block), #90 (other Stella loading issues, including a different missing-field error on empty <variables/>).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions