Skip to content

test: track the nine orphaned vdiffr baselines; fix the .Rcheck ignore pattern - #186

Open
ehrlinger wants to merge 1 commit into
mainfrom
claude/lucid-pascal-05aa38
Open

test: track the nine orphaned vdiffr baselines; fix the .Rcheck ignore pattern#186
ehrlinger wants to merge 1 commit into
mainfrom
claude/lucid-pascal-05aa38

Conversation

@ehrlinger

@ehrlinger ehrlinger commented Aug 11, 2026

Copy link
Copy Markdown
Owner

What

Two repo-hygiene fixes that were both sitting in an ambiguous "neither protected nor deliberately ignored" state.

1. Nine vdiffr baselines were untracked on every branch

tests/testthat/_snaps/snapshots/ holds 49 SVGs. Forty are tracked; nine never have been, on any branch (git log --all on them is empty — this is not a deletion to recover, they were simply never added).

All nine correspond to live expect_doppelganger() calls in test_snapshots.R — there are exactly 49 such calls and 49 SVGs, a 1:1 map.

Two consequences:

  • Loud — a suite run with VDIFFR_RUN_TESTS unset prunes them as "unused", and git restore cannot recover them because git never had them. On 2026-08-06 they survived only because a stale copy happened to remain in ggRandomForests.Rcheck/00_pkg_src/. That is not a backup and will not reliably be there.
  • Quiet — vdiffr writes a baseline and passes when none exists. So on any fresh clone, those nine visual-regression tests could never fail.

Tracking them is what the package's own convention already prescribes — test_snapshots.R:18 reads "Commit tests/testthat/_snaps/ to the repo".

2. .gitignore never actually ignored *.Rcheck

The file carried ..Rcheck and ..Rcheck/*. A dot is a literal in gitignore syntax, so those patterns matched only a path named ..Rcheck, which nothing creates — an evident typo for *.Rcheck. The 12 MB ggRandomForests.Rcheck/ was therefore never ignored, while .gitignore looked like it handled it. That false coverage is why a build directory sat exposed to a stray git add -A.

Replaced with *.Rcheck/; dropped the redundant second line.

Verification

Rebased onto main after #185 merged, and re-verified. #185 changed R/calc_roc.R, R/gg_roc.R, R/plot.gg_roc.R, R/gg_error.R, R/gg_vimp.R and R/plot.gg_rfsrc.R — the plotting code behind two of these nine baselines (gg-roc-multiclass-*) and a dozen of the tracked forty. GitHub reported the PR MERGEABLE / CLEAN throughout, but that is only textual; it says nothing about whether the SVGs still match. Re-ran rather than relied on it:

  • NOT_CRAN=true VDIFFR_RUN_TESTS=true devtools::test(filter = "snapshots") against the post-fix: address Codex review items for 3.5.1 #185 base → FAIL 0 | WARN 22 | SKIP 0 | PASS 49, with no .new.svg written. So fix: address Codex review items for 3.5.1 #185's changes did not move any baseline, and these nine match current output — they are not stale recoveries, and are exactly as fresh as their 40 committed siblings (all 49 share one Aug 6 generation run).
  • Snapshot count 49 before and after, no tracked file modified or deleted — the VDIFFR_RUN_TESTS=true guard behaved as documented.
  • lintr::lint_package()0 lints (re-run after fix: address Codex review items for 3.5.1 #185, which also modified test_lint.R).
  • git check-ignore -v confirms *.Rcheck/ catches ggRandomForests.Rcheck/ and its contents, and does not match R/ or tests/.
  • No tracked files live under any .Rcheck path, so the new rule cannot orphan anything already in the index.

Heads-up: this merge will abort your next git pull

The nine files also exist as untracked copies in the primary local checkout. Git refuses to overwrite untracked files on checkout even when the content is byte-identical (verified empirically, not assumed), so pulling this will fail with:

error: The following untracked working tree files would be overwritten by merge:
	tests/testthat/_snaps/snapshots/gg-isopro-default.svg
	...
Please move or remove them before you merge.
Aborting

Remedy — delete the local untracked copies first, then pull; the identical tracked versions arrive with the merge. From the repo root:

rm tests/testthat/_snaps/snapshots/gg-isopro-default.svg \
   tests/testthat/_snaps/snapshots/gg-isopro-predict-overlay.svg \
   tests/testthat/_snaps/snapshots/gg-isopro-threshold.svg \
   tests/testthat/_snaps/snapshots/gg-roc-multiclass-facet.svg \
   tests/testthat/_snaps/snapshots/gg-roc-multiclass-overlay.svg \
   tests/testthat/_snaps/snapshots/gg-udependent-default.svg \
   tests/testthat/_snaps/snapshots/gg-udependent-undirected.svg \
   tests/testthat/_snaps/snapshots/gg-variable-rf-classification-default.svg \
   tests/testthat/_snaps/snapshots/gg-variable-rf-classification-smooth.svg && git pull

Not folded in (flagging, not fixing)

.Rbuildignore has no .Rcheck entry. Low severity given the release gate builds from a clean git archive export, but worth a separate look.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 11, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.02%. Comparing base (b32202a) to head (e58c198).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #186   +/-   ##
=======================================
  Coverage   89.02%   89.02%           
=======================================
  Files          50       50           
  Lines        4618     4618           
=======================================
  Hits         4111     4111           
  Misses        507      507           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…e pattern

Nine SVGs under tests/testthat/_snaps/snapshots/ have never been tracked on
any branch, though they are baselines for nine live expect_doppelganger()
calls in test_snapshots.R. That left them in the worst of both states: not
protected by git, and not deliberately ignored either.

Two consequences, one loud and one quiet:

  - Loud: a suite run with VDIFFR_RUN_TESTS unset prunes them as "unused",
    and `git restore` cannot bring them back because git never had them.
    On 2026-08-06 they survived only because a stale copy happened to be
    left in ggRandomForests.Rcheck/00_pkg_src/. That is not a backup.

  - Quiet: vdiffr writes a baseline and passes when none exists, so on any
    fresh clone those nine visual-regression tests could never fail.

Tracking them is what the package's own convention already prescribes --
test_snapshots.R:18 says "Commit tests/testthat/_snaps/ to the repo" -- and
puts them on the same footing as their 40 committed siblings, which share
the same Aug 6 generation run.

Verified rather than assumed: NOT_CRAN=true VDIFFR_RUN_TESTS=true
devtools::test(filter = "snapshots") reports FAIL 0 | SKIP 0 | PASS 49
against main, with no .new.svg written, so these baselines match current
output and are not stale recoveries. lintr::lint_package() reports 0 lints.

Separately, .gitignore carried `..Rcheck` and `..Rcheck/*`. A dot is a
literal in gitignore syntax, so those matched only a path named `..Rcheck`,
which nothing creates -- an evident typo for `*.Rcheck`. The 12 MB
ggRandomForests.Rcheck/ was therefore never ignored while the file looked
like it handled it. Replaced with `*.Rcheck/` and dropped the redundant
second line. Confirmed it catches the directory and its contents without
matching R/ or tests/.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ehrlinger
ehrlinger force-pushed the claude/lucid-pascal-05aa38 branch from ae1824a to e58c198 Compare August 11, 2026 18:06
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