Skip to content

fix(fit): absolute run path when prior is a run number - #396

Open
mhovd wants to merge 1 commit into
mainfrom
claude/pmetrics-pmcore-pharmsol-fixes-qdno6d-prior-run-path
Open

mhovd wants to merge 1 commit into
mainfrom
claude/pmetrics-pmcore-pharmsol-fixes-qdno6d-prior-run-path

Conversation

@mhovd

@mhovd mhovd commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Bug. fit(prior = 1) with the default path = "." fails with Data path does not exist: ./2/inputs/gendata.csv.

normalizePath() leaves the new run folder relative because it doesn't exist yet. The fit runs from the prior's temporary folder, so that relative path points nowhere.

Fix. Normalize path_run after the folder is created.

Test. A mocked fit with a relative path checks that the data file is found and the output path is absolute. The test fails on main.

Note. This changes PM_model$fit, so test-data-currency.R will fail until data/*.rda is regenerated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GTyUgJEd5uCEmv9qYrv8dC


Generated by Claude Code

With the default path = ".", the new run folder stayed relative and the
fit, which runs from the prior's temporary folder, could not find
inputs/gendata.csv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTyUgJEd5uCEmv9qYrv8dC
Copilot AI balanced review requested due to automatic review settings October 11, 2026 10:13

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

The new assertion is not portable to the repository’s Windows CI job.

1 open finding
What changed in this PR

Fixes relative run paths when fitting from a prior run’s temporary directory.

Changes:

  • Normalizes the run directory after creation.
  • Adds a regression test for numeric priors and relative paths.
File Description
R/​PM_model.R Makes the created run path absolute.
tests/​testthat/​test-pm-fit-prior-run-path.R Tests data and output path resolution.

🧠 Review effort: Balanced


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

)

expect_true(data_found)
expect_equal(captured_output, file.path(normalizePath("2"), "outputs"))
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.78%. Comparing base (ef474a1) to head (4383713).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #396   +/-   ##
=======================================
  Coverage   64.77%   64.78%           
=======================================
  Files          52       52           
  Lines       22964    22963    -1     
=======================================
+ Hits        14876    14877    +1     
+ Misses       8088     8086    -2     
Files with missing lines Coverage Δ
R/PM_model.R 67.41% <100.00%> (+0.01%) ⬆️

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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