Skip to content

BOT: Fix #718: Reset rlang warning verbosity in repeated test runs#1092

Draft
nikosbosse wants to merge 1 commit intomainfrom
fix/718-testing-fails-locally-repeated
Draft

BOT: Fix #718: Reset rlang warning verbosity in repeated test runs#1092
nikosbosse wants to merge 1 commit intomainfrom
fix/718-testing-fails-locally-repeated

Conversation

@nikosbosse
Copy link
Collaborator

Summary

  • Fixes Testing fails locally when done repeatedly #718: Tests fail locally when devtools::test() is run repeatedly in the same R session
  • Root cause: cli_warn(.frequency = "once", .frequency_id = "small_interval_range") in assert_input_interval() suppresses warnings after first emission per R session, causing expect_warning() to fail on subsequent runs
  • Fix: Add rlang::reset_warning_verbosity("small_interval_range") before expect_warning() calls to reset the one-time warning gate
  • Add rlang to Suggests in DESCRIPTION (needed for rlang::reset_warning_verbosity() in tests)
  • Add a new test confirming the warning fires reliably even after being previously consumed and reset

Test plan

  • New test assert_input_interval() warns about small interval_range on repeated calls passes
  • Existing test for small interval_range warning passes (with reset added)
  • Full test suite passes (679 tests, 0 failures)
  • R CMD check: 0 errors, 0 warnings, 2 notes (pre-existing)

🤖 Generated with Claude Code

Add rlang::reset_warning_verbosity("small_interval_range") before
expect_warning() calls in test-metrics-interval-range.R so that
cli_warn(.frequency = "once") warnings fire reliably on repeated
devtools::test() runs in the same R session. Add rlang to Suggests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.83%. Comparing base (ac0c01a) to head (5c209d2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1092   +/-   ##
=======================================
  Coverage   97.83%   97.83%           
=======================================
  Files          35       35           
  Lines        1845     1845           
=======================================
  Hits         1805     1805           
  Misses         40       40           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator Author

@nikosbosse nikosbosse left a comment

Choose a reason for hiding this comment

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

CLAUDE: APPROVE — Clean, minimal fix that correctly addresses root cause of test flakiness when running devtools::test() repeatedly. Uses the correct rlang::reset_warning_verbosity() (not reset_message_verbosity), adds rlang to Suggests appropriately. New idempotency test validates the reset mechanism. Only 1 instance of .frequency='once' exists in the codebase, so no other tests need similar treatment. Independently verified the bug reproduces on main and the fix resolves it.

@nikosbosse nikosbosse marked this pull request as draft February 13, 2026 08:28
@nikosbosse nikosbosse changed the title Fix #718: Reset rlang warning verbosity in repeated test runs BOT: Fix #718: Reset rlang warning verbosity in repeated test runs Feb 13, 2026
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.

Testing fails locally when done repeatedly

1 participant

Comments