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
datamodel::StockFlow lacks a name/title field #326
datamodel::StockFlow does not carry a view title/name field. As a result, write_stock_flow_view() in the MDL writer (src/simlin-engine/src/mdl/writer.rs) hardcodes "View 1" as the sketch view title. This means the original view name from a parsed MDL file is lost on roundtrip -- reading a model with a view named e.g. "Overview" and writing it back out will produce "View 1" instead.
Why it matters
Correctness: View names carry semantic meaning in Vensim models. Losing them on roundtrip is a fidelity regression.
Roundtrip fidelity: MDL read-write-read cycles should preserve all metadata that the engine understands. This is one of the remaining gaps.
Components affected
src/simlin-engine/src/datamodel.rs -- StockFlow struct needs a name: Option<String> (or similar) field
src/simlin-engine/src/mdl/writer.rs -- write_stock_flow_view() should use the field instead of hardcoding "View 1"
src/simlin-engine/src/mdl/parser.rs (or convert layer) -- needs to populate the new field when parsing view headers
XMILE reader/writer may also need updates for consistency
Possible approach
Add pub name: Option<String> to datamodel::StockFlow.
Populate it during MDL parsing from the view header line (e.g. *View 1).
Use it in the MDL writer, falling back to "View 1" when None.
Update XMILE serde if <views><view name="..."> is not already handled.
Add a roundtrip test that verifies view name preservation.
Context
Identified during review of PR #324 (MDL writer implementation). The hardcoded value was an intentional pragmatic choice to keep the PR scope manageable.
Activity