Skip to content

Fixes#136

Open
Keats wants to merge 5 commits into
mainfrom
fixes
Open

Fixes#136
Keats wants to merge 5 commits into
mainfrom
fixes

Conversation

@Keats
Copy link
Copy Markdown
Collaborator

@Keats Keats commented May 18, 2026

No description provided.

Copy link
Copy Markdown

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 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-parser to render diagnostics with file context and to parse $TABLE ... FORMAT=,1PE15.9 correctly.
  • Added a shared table-row splitter to support comma-separated (and mixed) .ext/.shk table rows without breaking parameter names like OMEGA(2,1).
  • Added a comma-separated .ext fixture + 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.

Comment thread components/nonmem/src/output_files/ext.rs
Comment thread components/nonmem-parser/src/model/mod.rs
@Keats Keats requested a review from Copilot May 18, 2026 15:02
Copy link
Copy Markdown

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

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_results now only snapshots output for bql.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 like itsimp.ext (multi-method) and/or 1002c.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));
    }

Comment thread components/nonmem/src/output_files/ext.rs
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