Skip to content

feat: Remove label prefixes - #383

Open
mhovd wants to merge 4 commits into
mainfrom
remove-label-prefixes
Open

mhovd wants to merge 4 commits into
mainfrom
remove-label-prefixes

Conversation

@mhovd

@mhovd mhovd commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

INPUT and OUTEQ are now parsed exactly as they come, never appending input_ or outeq_ to them.

Route and output labels are now opaque strings matched exactly
everywhere: data, metadata, error models and the simulator. Numeric
names such as `1` are plain names with no relationship to declaration
order, and `input_<n>` / `outeq_<n>` are ordinary identifiers.

- DSL: accept integer literals wherever a route or output name goes and
  keep their source text; drop the bare-numeric and wrong-prefix
  rejections and the NUMERIC_*_PREFIX constants.
- Metadata and DSL runtime: resolve routes and outputs by exact match
  only, with no alias or positional fallback.
- Macros: match numeric labels by literal text and require plain
  decimal digits.
- Error models: AssayErrorModels and ResidualErrorModels bind labels by
  exact output name; numeric labels are no longer dense slots.
- Pmetrics: normalize zero-fraction integers such as `1.0` to `1`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V2wvK41uHMvzuFJmZeM6PY
- Inline the runtime's output-label wrapper and reword the route
  resolution comment.
- Drop ValidatedModelMetadata::route_by_kind, now identical to
  route_for_label, and fold output_index into output_for_label.
- Compare InputLabel/OutputLabel with usize as text, so "01" != 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V2wvK41uHMvzuFJmZeM6PY
The JSON model module it described was removed in #252.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V2wvK41uHMvzuFJmZeM6PY
Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:07
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.58824% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.18%. Comparing base (a2203f2) to head (4cc0cea).

Files with missing lines Patch % Lines
src/data/error_model.rs 87.69% 8 Missing ⚠️
pharmsol-dsl/src/parser.rs 92.15% 4 Missing ⚠️
src/data/parser/pmetrics/mod.rs 90.00% 3 Missing ⚠️
src/data/residual_error.rs 94.44% 3 Missing ⚠️
src/simulator/likelihood/mod.rs 82.35% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #383      +/-   ##
==========================================
+ Coverage   84.75%   85.18%   +0.43%     
==========================================
  Files          78       78              
  Lines       35818    35771      -47     
==========================================
+ Hits        30356    30470     +114     
+ Misses       5462     5301     -161     
Files with missing lines Coverage Δ
pharmsol-dsl/src/analyze.rs 83.90% <ø> (+0.78%) ⬆️
pharmsol-dsl/src/authoring.rs 83.16% <ø> (-0.77%) ⬇️
pharmsol-dsl/src/execution.rs 89.20% <100.00%> (ø)
pharmsol-macros/src/analysis.rs 93.49% <100.00%> (+9.06%) ⬆️
pharmsol-macros/src/input/analytical.rs 90.85% <100.00%> (ø)
pharmsol-macros/src/input/ode.rs 93.09% <100.00%> (-0.05%) ⬇️
pharmsol-macros/src/input/sde.rs 92.77% <100.00%> (ø)
pharmsol-macros/src/symbols.rs 92.54% <100.00%> (+11.85%) ⬆️
src/data/event.rs 81.55% <100.00%> (+0.27%) ⬆️
src/dsl/backend.rs 69.54% <100.00%> (+0.65%) ⬆️
... and 16 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

🟡 Changes recommended

Residual-model accessors lack public binding, and CSV normalization can silently change labels during round trips.

2 open findings
What changed in this PR

Removes numeric label prefixes across model authoring and simulation, using exact names for route, output, and error-model binding.

Changes:

  • Accepts numeric labels directly in macros and the DSL.
  • Removes prefix aliases and adds label-based residual-model binding.
  • Updates regression tests and normalizes float-formatted integer CSV labels.
File Description
tests/​test_pf.rs Uses named assay output.
tests/​support/​bimodal_ke.rs Uses unprefixed runtime route.
tests/​ode_optimizations.rs Uses named assay output.
tests/​ode_macro_lowering.rs Tests numeric-label lowering.
tests/​numeric_labels.rs Adds cross-backend label tests.
tests/​bolus_reinit_stop_time.rs Migrates regression fixtures.
tests/​authoring_parity_corpus.rs Updates authoring parity cases.
src/​simulator/​likelihood/​subject.rs Updates dense-slot test setup.
src/​simulator/​likelihood/​prediction.rs Updates dense-slot test setup.
src/​simulator/​likelihood/​mod.rs Binds residual models before scoring.
src/​simulator/​likelihood/​matrix.rs Updates dense-slot test setup.
src/​simulator/​equation/​sde/​mod.rs Tests exact label resolution.
src/​simulator/​equation/​ode/​mod.rs Tests exact label resolution.
src/​simulator/​equation/​mod.rs Documents label resolution rules.
src/​simulator/​equation/​metadata.rs Removes numeric alias resolution.
src/​simulator/​equation/​analytical/​mod.rs Tests exact label resolution.
src/​dsl/​runtime.rs Updates runtime label tests.
src/​dsl/​model_info.rs Tests numeric metadata names.
src/​dsl/​jit.rs Updates compiled-model label tests.
src/​dsl/​backend.rs Removes runtime route aliases.
src/​data/​residual_error.rs Adds label-keyed residual models.
src/​data/​parser/​pmetrics/​mod.rs Normalizes integer decimal labels.
src/​data/​event.rs Compares labels as text.
src/​data/​error_model.rs Enforces exact assay-label binding.
schemas/​model-v2.json Deletes model schema.
pharmsol-macros/​src/​symbols.rs Preserves numeric literal text.
pharmsol-macros/​src/​input/​sde.rs Updates numeric route tests.
pharmsol-macros/​src/​input/​ode.rs Updates shared-route tests.
pharmsol-macros/​src/​input/​analytical.rs Updates numeric route tests.
pharmsol-macros/​src/​analysis.rs Maps label text to dense slots.
pharmsol-dsl/​tests/​ode_rhs_inputs.rs Tests shared numeric routes.
pharmsol-dsl/​tests/​frontend_hardening.rs Updates invalid-label case.
pharmsol-dsl/​tests/​dsl_authoring_edge_cases.rs Tests numeric names and round trips.
pharmsol-dsl/​src/​parser.rs Parses numeric labels verbatim.
pharmsol-dsl/​src/​lib.rs Removes prefix constants.
pharmsol-dsl/​src/​execution.rs Tests numeric execution metadata.
pharmsol-dsl/​src/​authoring.rs Removes prefix restrictions.
pharmsol-dsl/​src/​analyze.rs Removes prefix validation.
benches/​common/​mod.rs Uses named residual output.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

&& integer.bytes().all(|byte| byte.is_ascii_digit())
&& fraction.bytes().all(|byte| byte == b'0') =>
{
integer.to_string()
/// `outputs` are the equation's declared output names in slot order. When
/// it is empty (an equation without metadata), labels are dense slot
/// numbers.
pub(crate) fn bind_output_names(&self, outputs: &[String]) -> Result<Self, ErrorModelError> {
@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpharmsol
Branchremove-label-prefixes
Testbedmhovd-pgx

⚠️ WARNING: Truncated view!

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

🚨 2 Alerts

🐰 View full continuous benchmarking report in Bencher

This branch has not been deployed

No deployments
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.

4 participants