Repository navigation
Undefined functions/variables cause runtime errors (luna_info, luna_tables, luna_tool, luna_clone, luna_ind, luna) - #66
Conversation
- Namespace pharmr.extra calls (get_fit_info, get_tables_from_fit, call_pharmpy_tool, call_psn) in luna_info, luna_tables, luna_tool and luna_clone. - luna_tool: drop undefined fit_folder args. pharmr.extra's prepare_run_folder() is unexported, computes its own paths and returns a list, and would abort on (or with force wipe) an existing run folder, so it is now only called via an internal wrapper when the run folder does not exist yet, using the returned $model. - luna_tool: remove hardcoded devtools::load_all() from the job body. - luna_ind: add subject_ids argument; qualify ggplot2::element_blank(). - luna(): align Function/Description columns (add luna_list). - Move knitr from Suggests to Imports. - Remove test workarounds and add tests for luna() and existing run folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roninsightrx
left a comment
There was a problem hiding this comment.
🤖 Codex review, round 1: 🔁 changes requested
The namespace, dependency, table-alignment, and undefined-variable fixes are largely present, and the test suite passes. However, the Pharmpy tool path still targets the working directory instead of the loaded project, so a core affected workflow remains incorrect.
| Severity | Location | Finding |
|---|---|---|
| major | R/luna_tool.R:108 |
call_pharmpy_tool() is still invoked without switching to or passing the loaded project's folder. pharmr.extra::call_pharmpy_tool() defaults to getwd() and selects/creates <getwd()>/<id>, so when a project is loaded from another directory—as the bundled workflow examples do—the tool writes outside the project's existing run folder. This leaves the newly namespaced Pharmpy path functionally incorrect and can create stray run directories. Execute the call in folder or otherwise ensure the dependency receives and uses the intended existing run folder; add a test where getwd() differs from the project directory. |
| minor | R/luna_ind.R:43 |
Inserting subject_ids before the existing verbose argument breaks positional callers that previously supplied verbose as the final argument: their logical value is now interpreted as a subject ID and can produce empty/incorrect plots or pagination errors. Append the new argument after verbose to preserve the public function's positional API. |
The coder agent is addressing these findings.
- luna_tool: pass the project folder to call_pharmpy_tool() and run it from within that folder, since it prefers an existing <getwd()>/<id> run folder. Add a test with a working directory outside the project. - luna_ind: append subject_ids after verbose so existing positional callers are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roninsightrx
left a comment
There was a problem hiding this comment.
🤖 Codex review, round 2: 🔁 changes requested
The full test suite passes, but the documented subject_ids functionality remains broken for the common case where the selection does not fill an entire page.
| Severity | Location | Finding |
|---|---|---|
| major | R/luna_ind.R:117 |
subject_ids is now exposed, but pagination still uses floor(). With the defaults, selecting fewer than nine subjects computes max_pages = 0, so calls such as luna_ind(..., subject_ids = 1) abort. A final partial page is likewise inaccessible. Use ceiling(length(ids) / set_len) with empty-input handling, and test a selection smaller than the page capacity. |
The coder agent is addressing these findings.
Use ceiling() for the page count so selections smaller than one page (e.g. subject_ids = 1 with the default 3x3 grid) and a final partial page can be plotted, and abort clearly when there are no subjects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roninsightrx
left a comment
There was a problem hiding this comment.
🤖 Codex review, round 3: ✅ approved
The implementation addresses the reported undefined functions and variables without introducing a material regression. The full test suite passes; package build succeeds, and R CMD check completes with only pre-existing warnings/notes.
Resolve conflicts with #63/#64 and #66: - DESCRIPTION: bump to 0.2.4 (main is at 0.2.3). - luna_new_project: use main's new_project_from_template() for the YAML, keep this branch's shared metadata assignment. - luna_ind: take main's min()-based end index (partial pages already handled there); keep the page-out-of-range test from this branch. - luna_gof: keep plotting the selected residual, with main's descriptive axis label extended to NPDE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #61
Namespaced pharmr.extra calls, fixed luna_tool (undefined fit_folder, incompatible/unexported prepare_run_folder now only used via wrapper when run folder is missing, removed devtools::load_all), added subject_ids arg and ggplot2::element_blank to luna_ind, fixed luna() table, moved knitr to Imports, and removed the test workarounds (450 tests pass).
🤖 Implemented by Claude Code and reviewed by Codex, orchestrated by auto. Review rounds are posted as comments below.