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
Add protobuf support for EXCEPT equations, element-level dimension mappings, and DataSource metadata #341
Phase 2 of the MDL full compatibility work introduced three new datamodel constructs:
Equation::Arrayed with default_equation -- Represents Vensim's :EXCEPT: syntax, where a default equation applies to all dimension elements not explicitly overridden. The Equation::Arrayed variant now has an Option<String> third field for this default equation.
DimensionMapping with element_map -- Replaces the previous Dimension.maps_to: Option<String> with mappings: Vec<DimensionMapping>, supporting element-level correspondence between subscript families (e.g., mapping individual elements of one dimension to elements of another).
DataSource metadata -- A new struct on Compat that stores parsed arguments from Vensim's GET DIRECT DATA/CONSTANTS/LOOKUPS/SUBSCRIPT functions, preserving the file path, tab/delimiter, and lookup coordinates so the MDL writer can reconstruct the original function call.
Current behavior
Protobuf serialization (serde.rs) returns an explicit error when encountering any of these constructs, preventing silent data loss. The error messages direct users to the sd.json format for full fidelity.
What needs to change
To support these constructs in protobuf:
EXCEPT equations: Add a default_equation field to the protobuf Variable message (or the arrayed equation representation) so that Equation::Arrayed with a default can roundtrip through protobuf.
Element-level dimension mappings: Extend the protobuf Dimension message to include a repeated DimensionMapping message with target name and element-level map entries, replacing or supplementing the current maps_to string field.
DataSource metadata: Add a DataSource message to the protobuf schema with fields for kind (enum: Data, Constants, Lookups, Subscript), file, tab_or_delimiter, row_or_col, and cell. Include this as an optional field on the Compat message.
Proto schema changes will require regenerating TypeScript and Rust bindings (pnpm build:gen-protobufs).
Acceptance criteria
Protobuf serialization roundtrips all three constructs without error
Existing protobuf-serialized data (with None/empty values for new fields) continues to deserialize correctly
The explicit error paths in serde.rs are replaced with proper serialization logic
Activity