Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves NONMEM model/output parsing robustness and error reporting by (1) making parser diagnostics path-aware and (2) handling comma-separated table rows / FORMAT specs that include commas.
Changes:
- Updated
nonmem-parserto render diagnostics with file context and to parse$TABLE ... FORMAT=,1PE15.9correctly. - Added a shared table-row splitter to support comma-separated (and mixed)
.ext/.shktable rows without breaking parameter names likeOMEGA(2,1). - Added a comma-separated
.extfixture + snapshot updates, and adjusted some extraction tests/snapshots.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.rs | Passes model path into parsing to enable path-aware diagnostics. |
| components/nonmem/test_data/ext/commas.ext | New .ext fixture exercising comma-separated table output. |
| components/nonmem/src/run/setup.rs | Switches to new Model::parse(path, input) API. |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_parse_ext_files@commas.ext.snap | New snapshot validating CSV rendering for commas.ext. |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_parameter_estimates@itsimp.ext.snap | Removed snapshot (tests no longer generate per-file extraction snapshots). |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_parameter_estimates@1002c.ext.snap | Removed snapshot (tests no longer generate per-file extraction snapshots). |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_parameter_estimates.snap | Snapshot metadata updated after test changes. |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_parameter_estimates_hiding_off_diags@itsimp.ext.snap | Removed snapshot (tests no longer generate per-file extraction snapshots). |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_parameter_estimates_hiding_off_diags@1002c.ext.snap | Removed snapshot (tests no longer generate per-file extraction snapshots). |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_parameter_estimates_hiding_off_diags.snap | Snapshot metadata updated after test changes. |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_estimation_results@itsimp.ext.snap | Removed snapshot (tests no longer generate per-file extraction snapshots). |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_estimation_results@1002c.ext.snap | Removed snapshot (tests no longer generate per-file extraction snapshots). |
| components/nonmem/src/output_files/snapshots/nonmem__output_files__ext__tests__can_extract_estimation_results.snap | Snapshot metadata updated after test changes. |
| components/nonmem/src/output_files/shk.rs | Uses shared row-splitting to parse .shk data rows more robustly. |
| components/nonmem/src/output_files/parsing.rs | Adds split_table_row and routes header/value parsing through it. |
| components/nonmem/src/output_files/mod.rs | Switches to new Model::parse(path, input) API. |
| components/nonmem/src/output_files/lst.rs | Threads file path into extracted-model parsing for better diagnostics. |
| components/nonmem/src/output_files/grd.rs | Updates tests to use new Model::parse(path, input) API. |
| components/nonmem/src/output_files/ext.rs | Narrows some extraction tests to a single fixture; keeps glob-based CSV snapshots for parsing. |
| components/nonmem/src/copy.rs | Switches to new Model::parse(path, input) API. |
| components/nonmem/src/check.rs | Switches to new Model::parse(path, input) API. |
| components/nonmem-parser/test_data/everything.mod | Adds $TABLE ... FORMAT=,1PE15.9 to cover FORMAT parsing. |
| components/nonmem-parser/src/snapshots/nonmem_parser__parser__tests__can_parse_mod_files@everything.mod.snap | Updates CST snapshot to reflect FORMAT tokenization. |
| components/nonmem-parser/src/snapshots/nonmem_parser__lower__tests__can_lower@everything.mod.snap | Updates lowered snapshot to include FORMAT option text. |
| components/nonmem-parser/src/parser.rs | Special-cases FORMAT values to allow leading separators/commas/parens. |
| components/nonmem-parser/src/model/parameters.rs | Updates tests to use inner_parse after parse API change. |
| components/nonmem-parser/src/model/mod.rs | Introduces inner_parse and changes public parse to be path-aware and return anyhow::Result. |
| components/nonmem-parser/src/model/estimates.rs | Updates tests to use inner_parse after parse API change. |
| components/nonmem-parser/src/model/copy.rs | Updates tests to use inner_parse after parse API change. |
| components/nonmem-parser/src/lower.rs | Ensures FORMAT key-values can span multiple tokens when lowering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
components/nonmem/src/output_files/ext.rs:873
can_extract_estimation_resultsnow only snapshots output forbql.ext, whereas previously it exercised the extraction pipeline across all EXT fixtures. Since estimation-results extraction depends on optional fields (condition number, termination codes, SD/Corr, multi-table runs), keeping coverage for at least one additional fixture likeitsimp.ext(multi-method) and/or1002c.ext(different random-effects layout) would help prevent regressions.
#[test]
fn can_extract_estimation_results() {
let reader = ExtReader::default()
.final_estimates_and_stderr_and_fixed()
.with_condition_number()
.with_termination_codes()
.with_sd_corr()
.keep_all_tables();
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test_data/ext/bql.ext");
let result = get_estimation_results(&path, &reader, None, false, None).unwrap();
assert_snapshot!(format!("{:#?}", result));
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.