-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Description
During MDL parsing, when multiple views are merged into a single StockFlow, font metadata is collapsed to a single value by taking only the first non-None font (src/simlin-engine/src/mdl/view/convert.rs:262-264). When the merged view is later split back into multiple views for MDL output, all segments share this single font string.
This means multi-view MDL files where different views specify different $... font lines will roundtrip with the wrong font on later views.
Why it matters
- Correctness: roundtripping a multi-view MDL file silently loses information, which could affect downstream tools or users who rely on per-view font settings.
- Maintainability: the current data model (
StockFlowhas a singlefont: Option<String>) conflates view-level metadata with model-level metadata, making it harder to reason about what belongs where.
Components affected
src/simlin-engine/src/mdl/view/convert.rs(merge logic at lines 262-264)src/simlin-engine/src/mdl/view/(output/split logic)project_io.proto/ data model (StockFlow.fontfield)
Possible approaches
The fix would require extending the data model so that font metadata is stored per-view rather than per-StockFlow. One approach: attach font metadata to the Group elements that serve as view merge markers, since those already delineate view boundaries within a merged StockFlow. This would require changes to the protobuf schema and both the MDL reader and writer.
Context
Identified during code review of PR #397 (mdl-roundtrip-fidelity branch). The fix requires a data model refactor and was deemed out of scope for that PR.