Skip to content

Wrap as_forecast_sample example in \donttest{}#1384

Open
seabbs-bot wants to merge 2 commits intomainfrom
long-running-scoringutils-example
Open

Wrap as_forecast_sample example in \donttest{}#1384
seabbs-bot wants to merge 2 commits intomainfrom
long-running-scoringutils-example

Conversation

@seabbs-bot
Copy link
Copy Markdown
Collaborator

@seabbs-bot seabbs-bot commented May 7, 2026

Description

This PR closes #1383.

The example for as_forecast_sample() (added in #1367) calls estimate_infections() directly, which fits a Stan model. R CMD check reports it taking ~37s of CPU/elapsed time:

Examples with CPU (user + system) or elapsed time > 5s
                    user system elapsed
as_forecast_sample 37.01  0.179  37.424

Other Stan-fitting examples in the package (estimate_infections, epinow, forecast_secondary, estimate_truncation) wrap the fit in \donttest{}. This PR matches that convention.

Initial submission checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have tested my changes locally (using devtools::test() and devtools::check()).
  • I have added or updated unit tests where necessary.
  • I have updated the documentation if required and rebuilt docs if yes (using devtools::document()).
  • I have followed the established coding standards (and checked using lintr::lint_package()).
  • I have added a news item linked to this PR.

This was opened by a bot. Please ping @seabbs for any questions.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected date-extraction logic in forecast trajectory extension to resolve dimension mismatches that occurred when projecting beyond the original observation window.
  • Documentation

    • Updated documentation examples and improved build efficiency by optimising how example code is handled during automated verification processes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9efccfdf-578f-4e09-85e9-93f881378f04

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR wraps the long-running as_forecast_sample() example in \donttest{} to exclude it from R CMD check execution, preventing Stan MCMC fitting from inflating test runtime. The changelog and source documentation are updated accordingly, with the generated .Rd file reflecting the corrected example wrapping structure.

Changes

Documentation Example Wrapping

Layer / File(s) Summary
Changelog entries
NEWS.md
Added forecast_infections() bug fix note and documented that as_forecast_sample() example is now wrapped in \donttest{} to avoid Stan runtime during R CMD check.
Example wrapping implementation
R/as_forecast_sample.R, man/as_forecast_sample.Rd
Roxygen example in R/as_forecast_sample.R is wrapped with \donttest{ ... } block; generated .Rd file updates the example guard structure accordingly.

Possibly related PRs

  • epiforecasts/EpiNow2#1367: Added the as_forecast_sample() S3 methods and example that is now wrapped in \donttest{} by this PR.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: wrapping the as_forecast_sample example in \donttest{} to prevent long-running checks.
Linked Issues check ✅ Passed All objectives from issue #1383 are met: the example is wrapped in \donttest{}, the @examplesIf guard is preserved, the convention matches other Stan-fitting examples, and R CMD check runtime is reduced.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objective: wrapping the as_forecast_sample example in \donttest{}, with supporting documentation updates and a NEWS.md entry.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch long-running-scoringutils-example

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@seabbs seabbs requested review from sbfnk-bot and seabbs and removed request for seabbs May 7, 2026 14:08
Copy link
Copy Markdown
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

We changed this in review but I think it actually breaks package convention and leads to a long running example. Note we likely need an issue for storing a few fits as epinowcast does so our examples can all be running (or a shared script that pkgdown runs or something if that is now possible)

@seabbs seabbs requested a review from sbfnk May 8, 2026 10:04
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.

Wrap as_forecast_sample example in \donttest{} to avoid 37s R CMD check time

2 participants