Skip to content

BOT: Fix #780: Add verbose argument to as_forecast_*() constructors#1089

Draft
nikosbosse wants to merge 1 commit intomainfrom
fix/780-verbose-as-forecast
Draft

BOT: Fix #780: Add verbose argument to as_forecast_*() constructors#1089
nikosbosse wants to merge 1 commit intomainfrom
fix/780-verbose-as-forecast

Conversation

@nikosbosse
Copy link
Collaborator

Summary

  • Adds a verbose = TRUE parameter to all 7 as_forecast_<type>.default() methods
  • Passes verbose through to assert_forecast() to suppress messages/warnings when verbose = FALSE
  • Gates the quantile rounding cli_warn() in as_forecast_quantile.default() behind the verbose flag
  • Adds @inheritParams assert_forecast roxygen tags for documentation

Fixes #780

Root cause

The verbose parameter existed on assert_forecast() and assert_forecast_generic() (added in PR #778), but was never threaded through to the as_forecast_<type>() constructors. Users were forced to wrap calls in suppressMessages()/suppressWarnings() to silence informational output.

What the fix does

Each .default() method now accepts verbose = TRUE and forwards it to assert_forecast(data, verbose = verbose). The quantile constructor additionally gates its own cli_warn() about rounding issues behind if (verbose). Default behavior (verbose = TRUE) is unchanged.

Test coverage added

  • as_forecast_quantile() verbose suppresses NA messages, rounding warnings, and unequal-quantile warnings
  • as_forecast_quantile() verbose = FALSE does not suppress errors
  • as_forecast_quantile() default verbose = TRUE preserves messages
  • as_forecast_sample() verbose suppresses NA messages
  • as_forecast_binary() verbose suppresses NA messages
  • as_forecast_point() verbose suppresses NA messages
  • as_forecast_nominal() verbose works correctly

Test plan

  • All new tests pass
  • Full test suite passes (692 tests, 0 failures)
  • R CMD check: 0 errors, 0 warnings, 2 pre-existing notes

🤖 Generated with Claude Code

Thread the existing verbose parameter from assert_forecast() through all
7 as_forecast_<type>.default() methods so users can suppress messages and
warnings by passing verbose = FALSE instead of wrapping calls in
suppressMessages()/suppressWarnings().

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 (f511dc9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1089   +/-   ##
=======================================
  Coverage   97.83%   97.83%           
=======================================
  Files          35       35           
  Lines        1845     1846    +1     
=======================================
+ Hits         1805     1806    +1     
  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, well-scoped implementation that correctly threads the existing verbose parameter from assert_forecast() through all 7 as_forecast_.default() constructors. The change is minimal, follows existing patterns, and preserves default behavior. Quantile rounding cli_warn() is properly gated while the rounding behavior itself still executes. Tests are thorough for quantile (6 tests) and adequate for other types. Minor gaps: no tests for ordinal/multivariate_sample types (low risk, identical code pattern) and the nominal test uses na.omit() so doesn't exercise actual suppression. The optional cleanup of existing suppressMessages/suppressWarnings wrappers was reasonably deferred to a follow-up.

@nikosbosse nikosbosse marked this pull request as draft February 13, 2026 08:28
@nikosbosse nikosbosse changed the title Fix #780: Add verbose argument to as_forecast_*() constructors BOT: Fix #780: Add verbose argument to as_forecast_*() constructors 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.

Add a verbose argument to as_forecast()

1 participant

Comments