Skip to content

Function name changes#241

Open
sschildhauer wants to merge 6 commits into
mainfrom
runmod_namechange
Open

Function name changes#241
sschildhauer wants to merge 6 commits into
mainfrom
runmod_namechange

Conversation

@sschildhauer
Copy link
Copy Markdown
Collaborator

Renaming functions as recommended by Kristen:
run_mod -> run_serodynamics
post_summ -> summarize_posterior
plot_jags_trace -> plot_trace
plot_jags_dens -> plot_density
plot_jags_Rhat -> plot_rhat
plot_jags_effect -> plot_ess

Will change all documentation and references throughout package.

@sschildhauer sschildhauer changed the title Runmod namechange Function name changes May 28, 2026
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 28, 2026

Claude finished @sschildhauer's task in 1m 48s —— View job


Code Review: PR #241 — Function Name Changes

Tasks:

  • Gather context and understand the PR
  • Read changed files and analyze the diff
  • Review for correctness, completeness, and best practices
  • Post review findings

Overall Assessment

This is a well-executed, comprehensive rename. All 6 function renames are consistent across R source, man pages, NAMESPACE, examples, tests (including snapshots), vignettes, pkgdown config, and the copilot instructions. The diff is mechanical and correct. CI passes (110 tests, 0 failures). Two minor issues worth noting below.


Issues Found

1. Inconsistent single-element guard condition in plot_trace.R (pre-existing bug)

File: R/plot_trace.R:79

# plot_trace.R — operand order differs from the other two
if (sum(lengths(trace_strat_list) == 1)) {

Compare with plot_ess.R:84 and plot_rhat.R:83:

if (sum(lengths(eff_strat_list)) == 1) {
if (sum(lengths(rhat_strat_list)) == 1) {

These two forms behave differently:

  • sum(lengths(x)) == 1 → fires only when total plot count is exactly 1 (intended).
  • sum(lengths(x) == 1) → fires when any stratum has exactly 1 iso (unintended — could misfire when there are multiple strata each with 1 iso).

This bug predates this PR (it existed in plot_jags_tracedx.R), but since the file was touched in this rename, this is a good opportunity to fix it. Fix this →

2. Stale copy-paste comments in plot_ess.R

File: R/plot_ess.R:67,71

# Assigning attributes, which are needed to run ggs_density  # ← should say ggs_effective
...
# Creating density plot  # ← should say "Creating effective sample size plot"

These comments were copied from plot_density.R and not updated for the ESS function. Minor, but misleading for future readers.


What Looks Good

  • NAMESPACE is clean — all 6 new names are exported, all 6 old names are gone.
  • Snapshot directories for both base and darwin variants are correctly renamed.
  • Historical NEWS.md entries (lines 47, 66–117) correctly retain the old names — those describe what the functions were called at the time they were written, so they should not be changed.
  • Cross-references in unpack_jags.R, prep_priors.R, prep_strat_list.R, rebuild_sr_model_attributes.R, plot_predicted_curve.R, use_att_names.R, and nepal_sees_jags_output.R are all updated.
  • run_serodynamics.R @title still reads "Run Jags Model" — this is a pre-existing issue and out of scope for this PR, but could be a future improvement.

Summary

PR is ready to merge as-is. The two flagged items are pre-existing and minor — the plot_trace.R guard bug is worth a follow-up fix but is not a regression introduced by this PR.
• Branch: runmod_namechange

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
R/plot_density.R 100.00% <ø> (ø)
R/plot_ess.R 96.42% <ø> (ø)
R/plot_predicted_curve.R 98.68% <ø> (ø)
R/plot_rhat.R 96.55% <ø> (ø)
R/plot_trace.R 96.42% <ø> (ø)
R/prep_priors.R 87.50% <ø> (ø)
R/prep_strat_list.R 100.00% <ø> (ø)
R/rebuild_sr_model_attributes.R 100.00% <ø> (ø)
R/run_serodynamics.R 100.00% <ø> (ø)
R/summarize_posterior.R 100.00% <ø> (ø)
... and 2 more

@sschildhauer
Copy link
Copy Markdown
Collaborator Author

@claude, can you please make the recommended function name changes and change documentation and references throughout. Please update the news and version as well. Please rerun all tests with the function name changes. Keep all edits within this thread.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 28, 2026

Claude finished @sschildhauer's task in 13m 7s —— View job


Function Renames: Complete

Tasks:

  • Explore repo structure and current state
  • Rename post_summsummarize_posterior (source, docs, tests, snapshots)
  • Rename plot_jags_traceplot_trace (source, docs, tests, snapshots)
  • Rename plot_jags_densplot_density (source, docs, tests, snapshots)
  • Rename plot_jags_Rhatplot_rhat (source, docs, tests, snapshots)
  • Rename plot_jags_effectplot_ess (source, docs, tests, snapshots)
  • Fix lingering run_mod cross-references across R files, vignettes, pkgdown
  • Rename example file inst/examples/run_mod-examples.Rrun_serodynamics-examples.R
  • Regenerate NAMESPACE + man pages via devtools::document()
  • Update NEWS.md (new bullet noting the breaking renames)
  • Bump version in DESCRIPTION (0.0.0.9055 → 0.0.0.9056)
  • Run all tests (devtools::test()PASS 110 | FAIL 0 | WARN 0 | SKIP 0)
  • Run spelling check (added ess to inst/WORDLIST)
  • Commit and push (2e99086)

Summary

Completed all 6 function renames end-to-end (the 1 partial rename from the prior commit, plus the 5 still-pending ones):

Old name New name
run_mod run_serodynamics
post_summ summarize_posterior
plot_jags_trace plot_trace
plot_jags_dens plot_density
plot_jags_Rhat plot_rhat
plot_jags_effect plot_ess

Updates touched: R source files, inst/examples/, man/ (regenerated), NAMESPACE (regenerated), test files, snapshot directories (both base and darwin variants), pkgdown/_pkgdown.yml, vignettes/articles/getting-started.qmd, vignettes/articles/os-snapshot-analysis.qmd, R/ cross-reference doc comments (unpack_jags, use_att_names, plot_predicted_curve, prep_priors, nepal_sees_jags_output, prep_strat_list, rebuild_sr_model_attributes), .github/copilot-instructions.md, data-raw/nepal_sees_jags_output.R. NEWS.md gained a top-level bullet noting the breaking change.

devtools::test() reports 110 PASS, 0 FAIL, 0 WARN, 0 SKIP — replacing the prior 5 could not find function "run_mod" failures. spelling::spell_check_package() is clean.

Not done: No deprecation shims for the old names — per the trigger comment's scope ("make the recommended function name changes"), this is a hard rename. Downstream users of the old names will need to update their calls. If you'd prefer soft deprecation via lifecycle::deprecate_warn() aliases, let me know and I'll add them.
• Branch: runmod_namechange • Commit: 2e99086

Completes the rename initiative started for run_mod -> run_serodynamics:

  post_summ()        -> summarize_posterior()
  plot_jags_trace()  -> plot_trace()
  plot_jags_dens()   -> plot_density()
  plot_jags_Rhat()   -> plot_rhat()
  plot_jags_effect() -> plot_ess()

Source files, examples, tests, snapshot directories, NAMESPACE,
roxygen-generated .Rd pages, pkgdown reference index, and articles
all updated to the new names. NEWS.md notes the breaking change and
DESCRIPTION version bumped to 0.0.0.9056.

Co-authored-by: Samuel Hisaji Schildhauer <sschildhauer@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

📖 https://ucd-serg.github.io/serodynamics/preview/pr241
Preview documentation for this PR (at commit 7e1ac30)

@github-actions github-actions Bot requested review from Kwan-Jenny and d-morrison and removed request for Kwan-Jenny and d-morrison May 29, 2026 18:31
@github-actions github-actions Bot requested review from Kwan-Jenny and d-morrison and removed request for Kwan-Jenny and d-morrison May 29, 2026 19:24
@github-actions github-actions Bot requested review from Kwan-Jenny and d-morrison and removed request for Kwan-Jenny and d-morrison May 29, 2026 19:32
@sschildhauer sschildhauer requested a review from Kwan-Jenny June 1, 2026 21:07
@sschildhauer
Copy link
Copy Markdown
Collaborator Author

@Kwan-Jenny This one is ready for your review. Thank you!

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.

Change run_mod name to srm()

2 participants