Skip to content

feat: Rename DSL types and add additional safeguards#302

Merged
mhovd merged 3 commits into
mainfrom
kimi-dsl-rename
Jul 22, 2026
Merged

feat: Rename DSL types and add additional safeguards#302
mhovd merged 3 commits into
mainfrom
kimi-dsl-rename

Conversation

@mhovd

@mhovd mhovd commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 21, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the pharmsol DSL pipeline and runtime integration to reflect renamed DSL/compiler concepts (e.g., “kernel” → “function”, “lowering” → “compile”) and adds frontend hardening so pathological inputs fail with clear diagnostics instead of panicking or exhausting the stack.

Changes:

  • Renames DSL/execution concepts across native/JIT/WASM/AoT paths (analyzed → compiled execution model, kernels → functions, ABI/layout naming updates).
  • Centralizes numeric label resolution via ValidatedModelMetadata::{route_for_label,output_for_label} and updates equation/runtime callers accordingly.
  • Adds DSL frontend safeguards and UX improvements: nesting-depth limits, number-literal infinity rejection, capped compile-time sizes, unified one-shot compile_model/compile_module API, and improved diagnostic rendering.

Reviewed changes

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

Show a summary per file
File Description
tests/support/runtime_corpus.rs Updates test compilation pipeline to analyzed→compiled terminology.
tests/authoring_parity_corpus.rs Migrates parity tests to new compile API and layout naming.
src/simulator/equation/ode/mod.rs Renames test helper functions for clarity (kernel→function naming).
src/simulator/equation/mod.rs Switches label resolution to metadata helpers and removes duplicate alias logic.
src/simulator/equation/metadata.rs Adds route_for_label / output_for_label with numeric-alias-only fallback and tests.
src/lib.rs Updates crate docs to reflect “compilation” terminology.
src/dsl/wasm.rs Renames WASM runtime concepts to functions and updates metadata consistency checks.
src/dsl/wasm_direct_emitter.rs Updates direct emitter to new execution/function IR types and math op naming.
src/dsl/wasm_compile.rs Updates WASM compilation pipeline, metadata envelope fields, and browser loader generator.
src/dsl/rust_backend.rs Updates Rust backend emitter to functions and renamed ops/intrinsics.
src/dsl/runtime.rs Updates DSL runtime compilation pipeline to analyzed→compiled and error type renames.
src/dsl/native.rs Renames native runtime ABI concepts (KernelSession→FunctionSession, etc.) and label resolution plumbing.
src/dsl/model_info.rs Updates model info extraction for layout and function IR changes.
src/dsl/mod.rs Updates DSL facade docs and re-exports for renamed pipeline/types.
src/dsl/jit.rs Migrates JIT compiler to function IR and improves diagnostic display formatting.
src/dsl/compiled_backend_abi.rs Renames compiled metadata availability to “functions” and updates symbol mapping.
src/dsl/aot.rs Migrates AoT compile/load pipeline and symbols to functions + analysis/compile error types.
pharmsol-macros/src/lib.rs Renames analytical kernel spec plumbing to function terminology and updates docs.
pharmsol-dsl/tests/frontend_hardening.rs Adds extensive hardening tests for parsing/analyzing/compiling and error UX.
pharmsol-dsl/tests/dsl_authoring_edge_cases.rs Updates edge-case tests to compile terminology and APIs.
pharmsol-dsl/src/syntax.rs Adds module-level documentation for syntax tree types.
pharmsol-dsl/src/pipeline.rs Introduces one-shot compile pipeline and unified DslError.
pharmsol-dsl/src/parser.rs Adds recursion-depth guardrails and fatal-abort handling to prevent cascades/stack exhaustion.
pharmsol-dsl/src/lib.rs Reframes crate as a source-to-execution compiler; updates exports/docs accordingly.
pharmsol-dsl/src/lexer.rs Rejects number literals that overflow to infinity with a clear error/help message.
pharmsol-dsl/src/diagnostic.rs Renames phases/codes and improves rendering (avoid repeating same-line source excerpts).
pharmsol-dsl/src/authoring.rs Updates authoring parsing, route detection, and structure/function guidance.
pharmsol-dsl/src/analysis.rs Renames typed→analyzed structures, refines const conversions, and improves analytical input errors.
pharmsol-dsl/README.md Updates README for new pipeline terminology and APIs.
pharmsol-dsl/Cargo.toml Adds thiserror dependency for unified error types.
pharmsol-dsl/browser-compile-bridge/src/lib.rs Updates JSON metadata shape from kernels to functions.
Cargo.toml Moves thiserror to workspace dependency for shared use.

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

Comment on lines 437 to 440
if let Some(name_segment) = lhs_trimmed.strip_prefix("const ") {
let name_abs = span.start + (lhs.find("const").unwrap() + "const ".len());
let name_abs = span.start + (lhs.len() - lhs_trimmed.len()) + "const ".len();
let name = parse_ident_segment(name_segment, name_abs)?;
let value = parse_expr_at(rhs, rhs_abs)?;
Comment thread src/dsl/wasm_compile.rs
if (Boolean(available) !== Object.prototype.hasOwnProperty.call(kernels, name)) {{
for (const [name, available] of Object.entries(infoEnvelope.functions)) {{
if (Boolean(available) !== Object.prototype.hasOwnProperty.call(functions, name)) {{
throw new Error(`Kernel metadata mismatch for ${{name}}`);
Comment on lines +1401 to +1402
let error =
compile_analyzed_model(&analyzed).expect_err("infusion lag should fail during lowering");
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpharmsol
Branchkimi-dsl-rename
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

@mhovd
mhovd added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit b05d6fa Jul 22, 2026
4 checks passed
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