Skip to content

mdl: saving loses a variable's custom sketch shape #402

Closed

Description

@bpowers

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.

Activity

  1. added
    engine
    compat
    on Jun 8, 2026
  2. bpowers commented on Jul 11, 2026

    @bpowers
    OwnerAuthor

    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.

  3. added
    bug
    on Oct 12, 2026
  4. changed the title [-]MDL roundtrip doesn't preserve custom sketch display shapes[/-] [+]mdl: saving loses a variable's custom sketch shape[/+] on Oct 12, 2026
  5. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    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 defaults drawn as shape 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompatengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions