Skip to content

chore: Fix CI failures#573

Merged
schloerke merged 37 commits intomainfrom
tweaks
Feb 4, 2026
Merged

chore: Fix CI failures#573
schloerke merged 37 commits intomainfrom
tweaks

Conversation

@schloerke
Copy link
Member

@schloerke schloerke commented Feb 2, 2026

Summary

This PR addresses multiple CI failures and prepares the package for compatibility with ggplot2 v4 and R package check requirements:

  • Fix mapping_string() to handle multi-line aesthetic expressions
  • Fix duplicate aesthetics warning in ggsurv() for upcoming ggplot2 version
  • Update fix_data() for ggplot2 >= 4.0.0 map data handling
  • Wrap documentation examples requiring optional packages in conditional checks
  • Update test infrastructure and snapshot handling for vdiffr
  • Clean up package dependencies and documentation

Key Changes

Bug Fixes

mapping_string() multi-line expression handling (R/gg-plots.R)

  • Added paste0(..., collapse = "") to concatenate deparse() output before regex substitution
  • Fixes issues when aesthetic mappings span multiple lines
  • Removed debug "Smoker ?" output

ggsurv() duplicate aesthetics warning (#572)

  • Removed duplicate lty aesthetic from confidence interval bounds
  • Prevents warnings with upcoming ggplot2 version

fix_data() map compatibility

  • Updated to use ggplot2::map_data() instead of fortify() for ggplot2 >= 4.0.0
  • Ensures proper handling of map objects

Documentation & Examples

  • Wrapped examples requiring {MASS}, {broom}, {network}, {sna}, {ggforce} in if (require(...)) blocks
  • Added {MASS} to Suggests in DESCRIPTION
  • Updated documentation links to reference {ggstats} functions correctly
  • Removed unused lifecycle SVG badge images

Testing Infrastructure

  • Disabled vdiffr snapshot testing on GitHub Actions (platform-specific rendering differences)
  • Added conditional logic to handle _R_CHECK_DEPENDS_ONLY_=true checks
  • Standardized snapshot file naming using hashes for long test names
  • Skip vdiffr tests on non-R-4.5 and non-macOS platforms
  • Added GitHub Actions script to conditionally manage .Rbuildignore for snapshot paths
  • Updated all visual regression test snapshots

Test Plan

  • ✅ All tests pass with updated snapshots
  • ✅ R CMD check passes with _R_CHECK_DEPENDS_ONLY_=true
  • ✅ Examples work correctly when optional packages are missing
  • ✅ No duplicate aesthetics warnings with upcoming ggplot2

🤖 Generated with Claude Code

schloerke and others added 30 commits February 2, 2026 12:35
Replaces deparse with paste0(deparse(...), collapse = "") in mapping_string to ensure multi-line expressions are concatenated into a single string. This improves robustness when handling complex aes_col inputs.
Modified tests/testthat/test-ggparcoord.R to accommodate changes in ggplot2 v4.0.0 output. Ensures compatibility with updated plot rendering and output structure.
Updated the example for broomify to only run if the 'broom' package is available, preventing errors when 'broom' is not installed.
Added a condition to skip vdiffr-related tests when running in depends-only check environments, improving test reliability in CI pipelines.
Added skip_if_not_installed for required packages in test-ggcoef.R, test-ggsurv.R, and test-ggtable.R to ensure tests are skipped if dependencies are missing. This improves test robustness in environments where some packages may not be installed.
Commented out the tryCatch error handling in the ggmatrix test, allowing errors to propagate directly during test execution. This change simplifies debugging by not suppressing errors or assigning objects to the global environment.
Added .claude patterns to both .Rbuildignore and .gitignore to prevent Claude-related files and directories from being included in builds or tracked by git.
Introduces a local string standardization function to ensure snapshot names match vdiffr's expectations. Adds checks for name standardization in interactive mode and improves handling of snapshot file naming and skipping logic for specific test environments.
Added _dev/ to .gitignore and .Rbuildignore to exclude the _dev directory from version control and R build processes. Deleted barret-outline.md, which contained a presentation outline, as it is no longer needed.
Deleted SVG files for various lifecycle badges (archived, defunct, maturing, questioning, soft-deprecated) from man/figures. These images are no longer needed in the documentation.
Updated example code in R scripts and documentation to only run if the 'broom' package is available. This prevents errors for users who do not have 'broom' installed and improves robustness of examples.
Added skip_if_not_installed for 'MASS' in test-gg-plots.R and for 'broom' in test-ggnostic.R to prevent test failures when these packages are not available.
Replaced the lifecycle badge in both R and Rd documentation to use the recommended format. This improves clarity and consistency in how the experimental status is displayed.
Updated the fix_data function to use map_data instead of fortify when ggplot2 version is 4.0.0 or higher, ensuring compatibility with newer versions of ggplot2.
Changed internal Rd documentation links to explicitly reference ggstats package functions (stat_cross and ggcoef_model) for improved clarity and accuracy.
Adjusted example code and internal logic to use ggplot2::map_data for ggplot2 versions >= 4.0.0, falling back to fortify for earlier versions. Also added missing 'maps' package requirement in examples to ensure reproducibility.
Add .github/shiny-workflows/check.R: an Rscript used by the rstudio/shiny-workflows R-CMD-check GitHub Action to remove the exact line "tests/testthat/_snaps" from .Rbuildignore. This ensures snapshot files are included during R CMD check but not bundled in the package build (e.g., for CRAN submissions). The script verifies .Rbuildignore exists, removes the matching line if present, writes the file only when changed, and prints a status message.

Related: r-lib/testthat#2320
Guard ggally_autopoint examples with if(require(ggforce)) to avoid running them when ggforce is not installed. Updated examples in R/gg-plots.R and man/ggally_autopoint.Rd; the function itself continues to call rlang::check_installed("ggforce").
Ensure vdiffr snapshot tests only run on macOS and make .Rbuildignore/snaps handling consistent. Changes:
- .Rbuildignore: narrow ignored entries to tests/testthat/_snaps/*/*.svg instead of excluding the whole _snaps directory.
- .github/shiny-workflows/check.R: add early exit for non-macOS CI runs (so check script won't modify .Rbuildignore on other OSes) and adjust the pattern/message used when removing the tests/testthat/_snaps/ entry.
- R/utils.R: add system_os() and on_mac() helpers for OS detection.
- tests/testthat/helper-doppelganger.R: add a skip_snapshot helper and use on_mac() to skip vdiffr tests on non-macOS (and on depends-only checks), announcing snapshot files and emitting messages to avoid empty tests.

These changes keep snapshot files available for R CMD check on macOS while avoiding snapshot-related failures on other platforms and make the .Rbuildignore matching explicit.
Add a version check in tests/testthat/helper-doppelganger.R to skip vdiffr snapshot tests when running on R versions older than 4.5. If R.version.string does not match 4.5.x the test calls skip_snapshot with a message and returns early, preventing image-snapshot tests from running on unsupported R versions and avoiding spurious failures. The check is placed before existing OS-based skips.
schloerke and others added 7 commits February 3, 2026 21:17
Wrap example calls to ggally_density in R/gg-plots.R and man/ggally_density.Rd with if (require(MASS)) { ... } so the examples/documentation don't run or fail when the MASS package is not installed. No changes to ggally_density implementation — only example and Rd updates.
* Initial plan

* Fix duplicate aesthetics warning in ggsurv and add NEWS entry

Co-authored-by: schloerke <93231+schloerke@users.noreply.github.com>

* Remove placeholder from NEWS.md entry

Co-authored-by: schloerke <93231+schloerke@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: schloerke <93231+schloerke@users.noreply.github.com>
Co-authored-by: Barret Schloerke <schloerke@gmail.com>
@schloerke
Copy link
Member Author

Finally

@schloerke schloerke marked this pull request as ready for review February 4, 2026 03:37
@schloerke schloerke merged commit 2f846e9 into main Feb 4, 2026
18 checks passed
@schloerke schloerke deleted the tweaks branch February 4, 2026 03:37
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.

2 participants