Skip to content

Fix flaky tests failing CRAN Fedora r-devel checks (0.4.1) - #104

Merged
mstackhouse merged 1 commit into
mainfrom
fix/cran-fedora-dsjc
Oct 22, 2026
Merged

mstackhouse merged 1 commit into
mainfrom
fix/cran-fedora-dsjc

Conversation

@mstackhouse

Copy link
Copy Markdown
Member

Summary

CRAN (Prof Ripley, 2026-10-22) reported test ERRORs for 0.4.0 on r-devel-linux-x86_64-fedora-clang and r-devel-linux-x86_64-fedora-gcc. The fix is due by 2026-11-12. All other flavors are OK.

Root cause: several tests compare the output of two separate writes. Each write stamps datasetJSONCreationDateTime with the current second. On the slow Fedora machines, the two writes sometimes fell in different seconds, so the outputs differed. The two flavors failed at different compression levels (1 and 9), which fits a timing flake rather than a zlib problem.

The failure surfaced as a confusing error rather than a test failure because the test passed the compression level (a number) to info, which current testthat rejects.

To confirm, I re-ran the suite with every write getting a later timestamp. Five tests failed: the one CRAN hit, two more in test-dsjc.R, and two in test-write_dataset_json.R. All pass with this change.

Changes

  • New tests/testthat/helper-datetime.R with local_frozen_datetime(), which pins the internal get_datetime() via local_mocked_bindings(). The five affected tests call it.
  • test-dsjc.R: info = lvl becomes info = paste("level", lvl).
  • DESCRIPTION: testthat >= 2.1.0 becomes >= 3.1.7, the minimum for local_mocked_bindings(). test-edge-cases.R already used it.
  • Version bumped to 0.4.1, with a NEWS entry and a resubmission section in cran-comments.md.

There are no changes to package code.

Checks

  • Updated relevant unit tests
  • NEWS.md updated
  • R CMD check --as-cran run locally. Tests pass. The incoming-feasibility WARNING was the version (now bumped) and three wiki.cdisc.org doc links returning 403, which is probably bot-blocking. Worth checking before resubmitting.
  • styler / lintr not run (test-only change)
  • N/A: no functions removed, no roxygen/Rd changes, no vignette changes, no pkgdown changes

🤖 Generated with Claude Code

Several tests compared the output of two separate writes. Each write
stamps datasetJSONCreationDateTime with the current second, so on a slow
machine the two writes could fall in different seconds and the outputs
differed. This is what failed the r-devel Fedora clang/gcc checks.

- Add local_frozen_datetime() test helper that pins get_datetime(), and
  use it in the five tests that compare separate writes
- Pass a character string to testthat's `info` instead of the
  compression level number, which current testthat rejects
- Require testthat >= 3.1.7 for local_mocked_bindings()
- Bump version to 0.4.1, add NEWS entry and resubmission notes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mstackhouse
mstackhouse merged commit 0d4a6ac into main Oct 22, 2026
9 checks passed
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.

1 participant