Debug calcfitmod#240
Conversation
This comment has been minimized.
This comment has been minimized.
|
📕 Preview documentation for this PR has been cleaned up. |
Codecov Report✅ All modified and coverable lines are covered by tests.
|
|
@claude, please help me fix this PR to pass all reviews. Please keep all edits within this thread. |
|
Claude finished @sschildhauer's task in 12m 11s —— View job Fixed: regenerated the missing Linux snapshotsRoot cause: The
Fix: Regenerated the 8 deleted Linux snapshots on a matching environment (Linux, R 4.6.0, serocalculator 1.4.0.9013, JAGS 4.3.2 — same as the CI ubuntu runner). They now include the full-dataset fitted/residual rows and the new
Notes
|
The non-darwin (Linux/Windows) snapshots for run_mod were deleted but not regenerated, causing R-CMD-check and test-coverage to fail with "Adding new file snapshot" on every non-macOS runner. Regenerate them so they include the full-dataset fitted/residual values and the new Stratification column. Co-authored-by: Samuel Hisaji Schildhauer <sschildhauer@users.noreply.github.com>
The new strat parameter added in this PR was not documented with an @param tag, causing an undocumented-argument gap in calc_fit_mod.Rd. Co-authored-by: Samuel Hisaji Schildhauer <undefined@users.noreply.github.com>
|
@claude please review |
|
Claude finished @sschildhauer's task in 1m 48s —— View job Code Review: PR #240 — Debug calcfitmod
SummaryThe core change is sound and the intent matches the PR description:
The new Findings🟢 Correctness — looks good
🟡 Suggestions (non-blocking)
🟢 Documentation
🟢 Tests / Snapshots
VerdictApprove-with-nits. The fix is correct, well tested, and CI is green on every platform. Items (1)–(3) and (6) are quality-of-life follow-ups; (5) is whitespace. None block merge. |
…namics into debug_calcfitmod
Merge commit '77dc07e6a01e267a2ad18533a359e630b83dc8e8' #Conflicts: # tests/testthat/_snaps/run_mod.md
|
@claude, please implement all suggestions. Keep all edits within in this thread. |
|
Claude finished @sschildhauer's task in 6m 33s —— View job Review suggestions implemented — pushed as
|
|
Claude finished @d-morrison's task in 1m 17s —— View job Code Review: PR #240 — Debug calcfitmod
SummaryCI on The two-part fix lands cleanly:
Correctness — looks good
Documentation — looks good
FindingsNo new blockers and no outstanding nits. Every prior review item — full-data fitted/residual computation, VerdictApprove. The fix is correct, well-tested, and CI is green across all platforms. Ready to merge. Note on the failing Claude Code Review workflowTo @d-morrison's point above: the auto-triggered Claude Code Review workflow has been failing on bot-authored commits in this PR. That's a workflow-config behavior, not a code-quality signal. Manually invoking
|
d-morrison
left a comment
There was a problem hiding this comment.
looking good; please address inline comments
|
@sschildhauer PS - I just updated the main branch to hopefully catch tidyselect/data-masking errors going forward (#244). I made some changes to the main branch of calc_fit_mod in order to keep the main branch passing; sorry about the resulting merge conflict. |
|
Heads-up about an incoming merge conflict: PR #244 (targeting |
Co-authored-by: Douglas Ezra Morrison <demorrison@ucdavis.edu>
Merge commit '0875741138c0195035f9a74ce8465b68f5fd6d58' #Conflicts: # R/calc_fit_mod.R
|
@claude, please implement changes that will allow this PR to pass review. |
|
Claude finished @sschildhauer's task in 13m 55s —— View job Implementing review changes — PR #240Pushed as
What the refactor looks likecalc_fit_mod <- function(modeled_dat,
original_data,
strat = NA) {
strat_col <- if (is.na(strat)) character() else c(Stratification = strat)
original_data <- original_data |>
use_att_names() |>
dplyr::select(
dplyr::any_of(c("Subject", "Iso_type", "t", "result", strat_col))
)
modeled_dat <- modeled_dat |>
dplyr::summarize(
.by = dplyr::all_of(
c("Parameter", "Iso_type", "Stratification", "Subject")
),
med_value = stats::median(.data$value)
) |>
tidyr::pivot_wider(names_from = "Parameter", values_from = "med_value")
matched_dat <- modeled_dat |>
dplyr::right_join(
original_data,
by = base::intersect(
c("Subject", "Iso_type", "Stratification"),
names(original_data)
)
)
fitted_dat <- matched_dat |>
dplyr::mutate(
fitted = ab(.data$t, .data$y0, .data$y1, .data$t1,
.data$alpha, .data$shape),
residual = .data$result - .data$fitted
) |>
dplyr::select(
dplyr::all_of(
c("Subject", "Iso_type", "Stratification", "t", "fitted", "residual")
)
)
return(fitted_dat)
}Notes
|
Combine the rename + select into a single select(any_of(...)) call using a named-vector entry for the optional Stratification column, switch the .by argument and final select to all_of(), and replace the by_vars if/else + right_join with right_join(by = intersect(...)) so the join key picks up Stratification only when it exists in original_data. Adds explicit return(), dplyr:: prefixes on the final mutate/select, and the safe strat = NA default. Also regenerate the stale Linux (non-darwin) fitted_residuals snapshots, which were in lex Subject order from an earlier regeneration; the right_join now produces the same numerical Subject order as the darwin snapshots, so the previous-pass test failures resolve. Co-authored-by: Samuel Hisaji Schildhauer <sschildhauer@users.noreply.github.com>
|
@claude, review. |
|
Claude finished @sschildhauer's task in 1m 57s —— View job Code Review: PR #240 — Debug calcfitmod
SummaryThe refactor in Every one of d-morrison's five inline comments is addressed:
Correctness — looks good
Documentation — looks good
Style — looks good
FindingsNo blockers and no nits. All prior items across the review thread are now resolved. VerdictApprove. The fix is correct, well-documented, well-tested, and CI is green across every substantive workflow. d-morrison's inline comments are all addressed in the most recent refactor. Ready to merge.
|
|
@d-morrison , Thank you for calling out those changes. I will keep track of the new dplyr features in the future. |
|
Claude finished @d-morrison's task in 2m 5s —— View job Code Review: PR #240 — Debug calcfitmod
SummaryThe two-part fix lands correctly and the refactor is now fully idiomatic per CLAUDE.md and d-morrison's inline review:
CI is 5/5 complete workflows passing (NEWS check, Documentation check, Spellcheck, check-readme, lint-changed-files); 4 workflows still in progress (R-CMD-check, test-coverage, version-check, pkgdown). Correctness — looks good
CLAUDE.md idioms — all addressed
Documentation — looks good
Findings🟡 Minor — unstratified unmatched rows get
|
Debugging calc_fit_mod in two ways: