Skip to content

feature: Metadata contract#262

Merged
Siel merged 4 commits into
mainfrom
fix/missing_metadata
May 14, 2026
Merged

feature: Metadata contract#262
Siel merged 4 commits into
mainfrom
fix/missing_metadata

Conversation

@Siel
Copy link
Copy Markdown
Member

@Siel Siel commented May 14, 2026

This PR aims to define the metadata contract between the different runtimes in pharmsol. The different runtimes now expose metadata directly so downstream crates can read it independently on the runtime used

Copilot AI review requested due to automatic review settings May 14, 2026 17:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the compiled-runtime metadata contract so DSL runtimes can expose richer model metadata consistently across JIT, AoT, and WASM backends.

Changes:

  • Adds state, covariate interpolation, and route destination/feature metadata to NativeModelInfo.
  • Builds and exposes ValidatedModelMetadata from compiled native/runtime models.
  • Tightens WASM metadata loading to require the compiled metadata envelope and kernel availability agreement.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/parameter_order.rs Updates test metadata construction for the expanded NativeModelInfo shape.
src/dsl/wasm.rs Requires compiled metadata envelopes and updates WASM loader/tests for richer metadata.
src/dsl/runtime.rs Exposes runtime metadata accessors and propagates model-construction errors.
src/dsl/native.rs Constructs validated runtime metadata and exposes it from compiled native models.
src/dsl/model_info.rs Extends compiled model info with states, interpolation, and route metadata.
src/dsl/mod.rs Re-exports the new runtime state metadata type.
src/dsl/jit.rs Propagates metadata validation errors during JIT compilation.
src/dsl/compiled_backend_abi.rs Updates ABI tests for the expanded metadata fields.
src/dsl/aot.rs Propagates metadata validation errors while loading AoT artifacts.
pharmsol-dsl/src/ir.rs Makes covariate interpolation serializable for metadata transport.
Comments suppressed due to low confidence (2)

src/dsl/native.rs:401

  • Defaulting legacy structured-block routes to Bolus makes the exposed validated metadata disagree with runtime behavior: RouteInputSemantics still treats kind == None routes as supporting both bolus and infusion inputs, while metadata().route(...).kind() will report bolus-only. Downstream crates relying on the new metadata contract can incorrectly reject infusion use for those models.
        // Structured-block DSL routes still lower without an explicit kind.
        // Treat them as declaration-ordered bolus routes for the shared
        // metadata surface while preserving the original runtime semantics
        // from `info.routes` below.
        let kind = route.kind.unwrap_or(RouteKind::Bolus);

src/dsl/model_info.rs:66

  • The state metadata omits the declared state's length even though execution states can span multiple buffer slots (ExecutionState has len). Without preserving that length (or expanding one entry per slot), downstream metadata consumers cannot reconstruct vector/array state layouts or map offsets back to state elements correctly.
/// Metadata for one compiled state.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct NativeStateInfo {
    /// Public state name.
    pub name: String,
    /// Dense runtime state offset.
    pub offset: usize,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/dsl/model_info.rs
Comment thread src/dsl/native.rs Outdated
Comment thread src/dsl/native.rs
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

🐰 Bencher Report

Branchfix/missing_metadata
Testbedmhovd-pgx

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

🐰 View full continuous benchmarking report in Bencher

Siel and others added 2 commits May 14, 2026 18:44
@Siel Siel merged commit 8029aa4 into main May 14, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants