Package housekeeping: R CMD check clean, silent tests, GHA CI#70
Merged
Package housekeeping: R CMD check clean, silent tests, GHA CI#70
Conversation
R CMD check goes from (1 WARNING, 3 NOTEs) to (0 errors, 0 warnings, 0 notes): - WARNING: undocumented build_epistats argument race.level is now described with a proper @param roxygen tag. - NOTE: race.cat.num added to the globalVariables list in globals.R (dplyr::select(d, race.cat.num, ...) in build_epistats was being flagged as an unresolved symbol by the code-analysis checker). - NOTE: inst/validation/snapshots is .Rbuildignore'd so the local .gitkeep doesn't ship in the built tarball. - NOTE: CLAUDE.md and .github/ are .Rbuildignore'd as non-standard top-level files / infra. Testthat is now silent and tabular. The two test-workflow-*.R files in tests/testthat/ were actually full end-to-end ERGM estimation scripts (netest + netdx + print + plot) that ran as bare scripts under testthat — not test_that() blocks — and produced hundreds of lines of MCMC / SAN progress output per run. Moved to tests/workflows/ with a README.md explaining they are manual integration scripts. testthat::test_local() and the tests/testthat.R runner invoked by R CMD check only scan tests/testthat/, so they're excluded cleanly. After the move, testthat on-load output is clean: ✔ | F W S OK | Context ✔ | 77 | joint-dyad ✔ | 78 | joint-model ✔ | 29 | joint-netstats [ FAIL 0 | WARN 0 | SKIP 0 | PASS 184 ] Duration: 5.3s Also removed stale tests/testthat/Rplots.pdf (from the old workflow scripts' plot() calls) and added Rplots.pdf to .gitignore. GitHub Actions CI added at .github/workflows/R-CMD-check.yaml based on the standard r-lib/actions template. Matrix covers ubuntu-latest x (release, devel, oldrel-1), plus macos-latest and windows-latest on release. ARTnetData is private and not installed in CI — the package's build_* functions guard on its presence and the test suite skips when absent, so CI runs fast without needing a PAT. README.md gets a status badge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ARTnet is not CRAN-published, so the full (5-OS × 3-R-version) portability matrix is overkill. Drop to a single Linux runner on R release — covers the 95% case and keeps CI runs fast and cheap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Skipping ARTnetData-dependent tests in CI was the wrong call — ARTnetData IS the package's reason to exist, and skipping means CI would miss regressions in the main code paths. The default GITHUB_TOKEN provided to Actions is scoped to the repo where the workflow runs, so it can't see private repos in the same org (EpiModel/ARTnetData, EpiModel/EpiModelHIV-p). Workflow now reads a user-configured secret EPIMODEL_PAT instead. One-time setup needed in the repo settings: 1. Create a fine-grained PAT with Contents: Read on EpiModel/ARTnetData and EpiModel/EpiModelHIV-p. 2. Add it as repo secret EPIMODEL_PAT. Falls back to GITHUB_TOKEN if the secret is unset, so forks without the secret produce a clean resolution-error message rather than a YAML-level failure. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Every EpiModelHIV reference in R/ is a docstring comment — the package has no runtime dependency on EpiModelHIV. It was vestigial from when the workflow scripts lived under tests/testthat/. Those scripts are now under tests/workflows/ (manual integration only, not run by testthat), and the reference copies in inst/validation/epimodelhiv_template_ref/ are static files read for comparison, never sourced or loaded. Removing the Suggests entry (and its Remotes line for EpiModel/EpiModelHIV-p) also fixes the CI dependency-resolution failure: pak couldn't map the package name "EpiModelHIV" to the "-p" repo suffix, and the package doesn't need it at all. Local R CMD check: 0 errors / 0 warnings / 0 notes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
r-lib/actions currently defaults error-on to "warning", but silent upstream defaults can drift. Pin it explicitly so any WARNING from R CMD check fails the job. rcmdcheck supports "never" / "note" / "warning" / "error". "warning" is the right level for ARTnet: NOTEs (e.g., vestigial hidden files) may be benign and situational, but any WARNING — undocumented args, undefined globals, misuse of Suggests — should block merge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes the CI coverage gap flagged in PR #70 review: the existing test-joint-{model,netstats,dyad}.R files all exercise Atlanta + race = TRUE, leaving several real-world parameterizations exercised only by the manual tests/workflows/ scripts or inst/validation/. New test-parameterizations.R hits: 1. No-geog (national) -- epistats\$geog.lvl = NULL; build_* must work without geogYN in the formulas. Exercises both method = "existing" and method = "joint". 2. sex.cess.mod (CEA-style) -- age.limits = c(15, 100) with age.sexual.cessation = 65, young.prop = 0.99. Verifies active.sex contains both 0 and 1, the post-cessation age group has nodefactor_age.grp = 0, and internal consistency holds under method = "joint" with inactive-node zeroing. 3. Non-Atlanta city -- "New York City" as a smoke test that other geog.cat values work the same as Atlanta. 4. Custom age.breaks / age.limits -- age.limits = c(20, 50) with age.breaks = c(30, 40), giving 3 age groups. Verifies nodefactor_age.grp has length 3 on every layer and sampled ages fall within limits. 5. Non-default time.unit -- monthly (30) vs weekly (7). Verifies unit-invariant md.main is identical between methods and per-time-unit md.inst scales by 30/7 as expected. Each block also runs expect_netstats_contract() against the public fields model_{main,casl,ooff}.R in EpiModelHIV-Template actually read (kept in sync with inst/validation/netstats_contract.md). Total suite now: 451 assertions / 8.1 s, still clean tabular output. R CMD check still 0/0/0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses three package-hygiene items before resuming the duration/dissolution work on #63.
1. R CMD check: (1 WARNING, 3 NOTES) → (0, 0, 0)
build_epistatsargrace.level@param race.levelwith the allowed category valuesrace.cat.numundefined globalutils::globalVariables()inR/globals.R(dplyr::select(d, race.cat.num, ...)was flagged)inst/validation/snapshots/.gitkeepin build.Rbuildignoretheinst/validation/snapshotsdirectoryCLAUDE.md.RbuildignoreCLAUDE.mdand.github/Final check:
2. Silent tabular testthat output
Root cause:
tests/testthat/test-workflow-{standard,cea}.Rwere full ERGM estimation scripts —netest()+netdx()+print()+plot()— running as bare scripts (notest_that()wrapping). testthat executes every.Rfile intests/testthat/as test code, so they spewed hundreds of lines of SAN / MCMC progress per run.Moved to
tests/workflows/workflow-{standard,cea}.Rwith atests/workflows/README.mdexplaining they're manual integration scripts.testthat::test_local()and thetests/testthat.Rrunner invoked byR CMD checkonly scantests/testthat/, so the move cleanly excludes them without deleting functionality.Also cleaned up a stale
Rplots.pdfartifact from those scripts'plot()calls and addedRplots.pdfto.gitignore.Before/after:
3. GitHub Actions CI for R CMD check
.github/workflows/R-CMD-check.yamlusing the standardr-lib/actionstemplate. Single-OS matrix (ubuntu-latest, R release) because ARTnet isn't CRAN-published — no need to burn minutes testing multi-OS portability. Runs on push tomain, PRs targetingmain, and manual dispatch.ARTnetData in CI: installed, not skipped
ARTnetDataIS the package's reason to exist, so tests that exercise it must run in CI. The defaultGITHUB_TOKENcan't see private repos in the same org, so the workflow uses a user-configured secretEPIMODEL_PAT.One-time setup required in repo settings (commit
49b016e):EpiModel/ARTnetDataEpiModel/EpiModelHIV-pEpiModel/ARTnet→ Settings → Secrets and variables → Actions → New repository secret, namedEPIMODEL_PAT.After that, CI installs both private packages, runs the full testthat suite including all joint-model / joint-dyad / joint-netstats tests, and runs R CMD check end-to-end. Suggests-gated
skip_without_artnetdata()guards in tests stay in place as defensive no-ops (they skip gracefully in local dev if ARTnetData isn't installed, but never fire in CI once the secret is configured).README gets a status badge linking to the workflow runs.
Test plan
devtools::check(): 0 errors / 0 warnings / 0 notesdevtools::test(): 184/184 pass, clean tabular outputEPIMODEL_PATsecret not yet configured)EPIMODEL_PATis added to repo secrets: re-run the workflow; should go green end-to-end with all ARTnetData-dependent tests actually executingBookkeeping only — no user-facing behavior changes. Byte-identical output for
build_netparams()/build_netstats()is preserved and still verified by theinst/validation/snapshot harness locally.