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
mdl: saving loses a variable's custom sketch shape #402
Vensim lets a modeler draw any variable with any sketch shape, such as an auxiliary drawn as a box.
The MDL writer chose the shape from the variable's type, so a save lost the custom shape: defaults in test/bobby/vdf/econ/mark2.mdl is a DELAY1 auxiliary drawn as a box (shape=3) and came back as a plain auxiliary.
Status on main
ViewElementCompat keeps the sketch record's shape, plus name_field and tail (the raw fields the writer does not interpret), in datamodel.rs and in project_io.proto (fields 4-6, since #1071); the writer uses them (mdl/writer.rs, around line 3428). mdl_format_roundtrip in tests/integration/mdl_roundtrip.rs compares mark2's saved sketch records, shape included, with the original.
Editing a view in the TypeScript editor can still drop the whole compat record; that is #811.
Current audit confirms the missing protobuf fidelity surface is broader than shape: in-memory ViewElementCompat now also carries name_field and tail, while proto ViewElement.ViewElementCompat still has only width/height/bits. Please preserve and regression-test all three fields when implementing this issue. The TS view-edit loss of the compat object itself remains tracked separately in #811.
ViewElementCompat carries shape, name_field and tail (src/simlin-engine/src/datamodel.rs:1284-1295), serialized as proto fields 4-6 (project_io.proto:207-214, serde.rs:1686-1712), and the writer uses the recorded shape for aux, stock, valve, flow label, cloud and alias records (src/simlin-engine/src/mdl/writer.rs:3428, 3461, 3709, 3713, 3920, 3965). mdl_format_roundtrip AC1.2 (tests/integration/mdl_roundtrip.rs:1465-1486) compares mark2's raw type-10 records from field 3 on, shape included, which covers defaults drawn as shape 3.
Activity
bpowers commentedon Jul 11, 2026
Current audit confirms the missing protobuf fidelity surface is broader than
shape: in-memoryViewElementCompatnow also carriesname_fieldandtail, while protoViewElement.ViewElementCompatstill has only width/height/bits. Please preserve and regression-test all three fields when implementing this issue. The TS view-edit loss of the compat object itself remains tracked separately in #811.[-]MDL roundtrip doesn't preserve custom sketch display shapes[/-][+]mdl: saving loses a variable's custom sketch shape[/+]bpowers commentedon Oct 12, 2026
Closing: already fixed on main.
ViewElementCompat carries shape, name_field and tail (src/simlin-engine/src/datamodel.rs:1284-1295), serialized as proto fields 4-6 (project_io.proto:207-214, serde.rs:1686-1712), and the writer uses the recorded shape for aux, stock, valve, flow label, cloud and alias records (src/simlin-engine/src/mdl/writer.rs:3428, 3461, 3709, 3713, 3920, 3965). mdl_format_roundtrip AC1.2 (tests/integration/mdl_roundtrip.rs:1465-1486) compares mark2's raw type-10 records from field 3 on, shape included, which covers
defaultsdrawn as shape 3.