Skip to content

engine: XMILE <options> namespace attribute is silently dropped on read #902

Closed

Description

@bpowers

Summary

The XMILE spec (section 2.2.1) defines namespace as an XML attribute of <options> (e.g. <options namespace="std, isee">), declaring the namespace resolution order for identifiers. The Options struct in src/simlin-engine/src/xmile/mod.rs (line ~1139) declares the field without the quick-xml @ attribute rename:

pub struct Options {
    pub namespace: Option<String>, // string of comma separated namespaces
    #[serde(rename = "$value")]
    pub features: Option<Vec<Feature>>,
}

quick-xml's serde support maps an un-prefixed field to a child element, and unknown attributes are ignored -- so the attribute form always parses as None. Contrast the Macro struct in the same file, which correctly uses #[serde(rename = "@namespace")] for its spec-defined namespace attribute.

Note the vendored Stella fixtures also carry namespace="std, isee" as an attribute on the <smile> header element (test/conveyors/*.stmx), which is a separate un-parsed surface (see the companion issue on the <smile> attribute-form feature flags).

Why it matters

Advisory-only today -- nothing in the engine consumes the declared namespace resolution order -- but it is a spec-defined attribute silently dropped on import, so the declaration is lost on any read/re-write round trip. Same "XMILE header advisory metadata silently dropped by the reader" class as the #888 family; unlike pre-#888 unknown options, it never causes a parse failure.

Component

src/simlin-engine/src/xmile/mod.rs (Options struct).

Suggested direction

Add #[serde(rename = "@namespace")] to the field (mirroring Macro), plus a reader test with <options namespace="std, isee">...</options> asserting the value survives. Decide separately whether the writer should re-emit it (the current writer re-canonicalizes the header from model contents).

Context

Noticed during the GH #888 fix (tolerant <options> parsing) on branch conveyor-engine; deliberately left out of that fix's scope. Related: #888 (reader hard-fail on unknown option elements), #872 (writer never emits <uses_conveyor/>).

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