Skip to content

engine: MDL converter drops GET DIRECT data_source metadata after resolution #352

@bpowers

Description

@bpowers

Problem

When the MDL converter resolves GET DIRECT DATA/CONSTANTS/LOOKUPS/SUBSCRIPT expressions via the DataProvider, the resolved equation (baked lookup/constant values) replaces the opaque GET DIRECT string, but the Compat.data_source metadata (file, tab, cell) is not populated. This means models imported from MDL with GET DIRECT references lose their external-data provenance -- they only retain baked values and cannot be exported back with reconstructable GET DIRECT intent.

The DataSource struct and the Compat.data_source field exist and are properly populated by the XMILE, protobuf, and JSON deserializers, but the MDL conversion path skips this step.

Concrete example

In src/simlin-engine/src/mdl/convert/variables.rs, try_resolve_data_equation (around lines 797-834) calls into the DataProvider to resolve expressions like GET DIRECT CONSTANTS('file.xlsx', 'Sheet1', 'B2'). The resolved constant/lookup replaces the equation, but no code sets compat.data_source to preserve the original file path, tab/delimiter, and cell reference.

Why it matters

Components affected

  • src/simlin-engine/src/mdl/convert/variables.rs -- try_resolve_data_equation function

Possible approach

In try_resolve_data_equation, after successfully resolving a GET DIRECT expression, parse the function arguments (file, tab/delimiter, row/col, cell) into a DataSource struct and set it on variable.compat.data_source. The arguments are already available as parsed AST nodes at the call site.

Context

Identified during review of the mdl-full-compat branch. Related to #341, #342, and #348, but those issues cover serialization formats and simulation support respectively, not the MDL import path's metadata population.

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