Skip to content

engine: no way to supply GET DIRECT data files without a filesystem #598

Open

Description

@bpowers

A browser or wasm caller cannot import a Vensim model that uses GET DIRECT DATA, GET DIRECT CONSTANTS, GET DIRECT LOOKUPS, or GET DIRECT SUBSCRIPT.
The engine reads the referenced CSV or Excel files at import through a DataProvider, and the only real provider reads from the filesystem.
In wasm the import uses the null provider and fails with external data file '...' referenced but no DataProvider configured.
A caller should be able to hand the engine the file contents directly.

Why it matters

Any model with external data fails to import through @simlin/engine's Project.openVensim in the browser, and the same is true for the native tools that open models without a data directory: pysimlin, simlin-serve, and the MCP server.
Only simlin-cli and simlin_project_open_vensim_with_data pass a directory today.
Real example: the metasd COVID model (#555).

Fix

Add an in-memory DataProvider holding a map from file name to bytes.
The CSV and Excel parsers currently open files by path, so they need to be split into a read step and a parse step first.
Expose the provider through one small libsimlin call (for example an open variant that takes name/bytes pairs) and the @simlin/engine open API.
That keeps the FFI surface small and lets the browser pass files the user uploads with the model.

Alternative: a host callback provider. More flexible, but callbacks across the wasm and C boundaries are harder to get right.

The native tools that already have a path (pysimlin, simlin-serve, MCP) can use the filesystem provider rooted at the model's directory; that part is cheap and could go first.

Pointers

  • src/simlin-engine/src/data_provider/: the DataProvider trait and filesystem provider
  • src/libsimlin/src/project.rs: simlin_project_open_vensim_with_data
  • src/simlin-serve/src/parse.rs, src/simlin-mcp-core/src/open.rs, src/pysimlin/simlin/project.py: callers on plain open_vensim

Activity

  1. added
    engine
    on Jun 8, 2026
  2. changed the title [-]WASM/libsimlin: data-supply API for GET DIRECT external data (browser/WASM callers)[/-] [+]engine: no way to supply GET DIRECT data files without a filesystem[/+] on Oct 12, 2026
  3. added
    enhancement
    on Oct 12, 2026
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

    engineenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions