Skip to content

MDL writer produces invalid output for projects with no views #404

@bpowers

Description

@bpowers

Problem

In write_sketch_section (src/simlin-engine/src/mdl/writer.rs), the V300 sketch header is only emitted inside the per-view loop. When a project has no views (e.g., viewless XMILE imports), the output contains only the sketch start/end markers with no header or view block. This may be rejected by external tools that expect a valid sketch section.

Why it matters

  • Correctness: External tools (Vensim, other MDL consumers) may reject or misinterpret MDL files with an empty sketch section that lacks the required V300 header line.
  • Interoperability: XMILE models imported without views are a valid use case; the MDL writer should produce valid output for all representable projects.
  • Roundtrip fidelity: This gap undermines the MDL roundtrip work, where any valid project should produce valid MDL output.

Component

  • simlin-engine -- specifically src/simlin-engine/src/mdl/writer.rs, write_sketch_section function

Possible resolution

Emit a minimal valid sketch section (with the V300 header and a default/empty view block) even when the project has zero views, so the output is always structurally valid MDL.

Discovery context

Identified during the MDL roundtrip fidelity work on branch mdl-roundtrip-fidelity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions