Repository navigation
Description
A variable whose name contains a literal period, such as Goal 1.5 for Temperature, probably cannot be referenced when it comes from an XMILE file or is created in the editor.
The variable's own name and a quoted reference to it canonicalize to two different strings, so the reference fails with DoesNotExist.
This is traced from the code and has not been reproduced.
Example
<aux name="Goal 1.5 for Temperature"><eqn>1.5</eqn></aux>
<aux name="y"><eqn>"Goal 1.5 for Temperature" + 1</eqn></aux>Expected: y = 2.5.
Traced behavior: y fails with DoesNotExist.
The XMILE reader and the editor store the name as written.
canonicalize reads an unquoted . as a module separator and maps it to · (U+00B7), so the variable is keyed goal_1·5_for_temperature.
The quoted reference maps its . to the literal-period marker ‥ (U+2024) and looks up goal_1‥5_for_temperature.
MDL import avoids this because it wraps such names in quotes, and stored projects avoid it because loading rewrites a stored . to U+2024.
Why it matters
C-LEARN has "Goal 1.5 for Temperature"; it works today only because it arrives through MDL.
No XMILE file or editor session has been seen to hit this.
Whether Stella writes names containing periods is unverified.
Fix
A . in a name field can only be literal.
Add one name-context canonicalization (. becomes U+2024) and use it everywhere a stored variable name, view-element name, or group member becomes an ident.
That one function also fixes the diagram mismatch in #704.
Alternative: refuse names containing . in the XMILE reader and the editor with a clear error; cheaper, but it would also refuse C-LEARN's names if they ever arrive through XMILE.
Pointers
src/simlin-engine/src/common.rs:canonicalize,LITERAL_PERIOD_SENTINELsrc/simlin-engine/src/db/sync.rs: canonicalizes stored variable namessrc/simlin-engine/src/xmile/variables.rs:ident: aux.name.clone()and the stock/flow equivalentssrc/simlin-engine/src/serde.rs:migrate_stored_ident, the load-time rewrite for stored projectssrc/simlin-engine/src/mdl/xmile_compat.rs:quoted_space_to_underbarsrc/core/canonicalize.tskeeps a raw.(core: two TypeScript canonicalize copies that disagree on dotted names #624)- Related: engine: layout loses glyph positions for names containing a period #704 (same root cause, diagram side), engine: three look-alike separator characters are written as literals #565
Activity
[-]engine: freshly imported/created period-named variables may fail to simulate at HEAD (XMILE-name + JSON ident boundaries skip name-context canonicalization, unlike the #690 serde fix)[/-][+]engine: period in a variable name breaks references from XMILE or the editor[/+]