Skip to content

Advance deprecation cycle for v1.9.0#1311

Merged
seabbs merged 8 commits intomainfrom
advance-deprecations
Feb 19, 2026
Merged

Advance deprecation cycle for v1.9.0#1311
seabbs merged 8 commits intomainfrom
advance-deprecations

Conversation

@sbfnk
Copy link
Contributor

@sbfnk sbfnk commented Feb 10, 2026

Description

This PR closes #1309.

Advances the deprecation cycle following the v1.8.0 CRAN release:

  • Completely removed arguments/functions that have been erroring since v1.6.0/v1.7.0/v1.8.0:
    • gp_opts(ls_mean, ls_sd, ls_min, ls_max, alpha_mean, alpha_sd)
    • obs_opts(phi, na)
    • estimate_infections(CrIs, weigh_delay_priors, filter_leading_zeros, zero_threshold, horizon)
    • estimate_secondary(filter_leading_zeros, zero_threshold)
    • epinow(filter_leading_zeros, zero_threshold, horizon)
    • regional_epinow(horizon)
    • format_fit(burn_in, start_date)
    • default_fill_missing_obs() function
  • Advanced to deprecate_stop("1.9.0") (were warnings in v1.7.0/v1.8.0):
    • rt_opts(pop = numeric) and simulate_infections(pop = numeric)
    • All deprecated accessors ($samples, $summarised, $predictions, $posterior, $data, $dist, $obs, $last_obs, $cmf, $estimates, etc.)
    • summary.epinow(output) and summary.estimate_infections(type = "samples")
    • extract_parameter_samples()
  • Cleaned up legacy validation code and stale test comments

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.

Summary by CodeRabbit

Release Notes

  • Chores

    • Removed deprecated function parameters (filter_leading_zeros, zero_threshold, horizon, burn_in, start_date, and others) from multiple functions to streamline the public API
    • Converted deprecated object accessors from warnings to errors
    • Removed deprecated internal helper functions
  • Documentation

    • Updated function signatures and examples to reflect current API and removed options

@sbfnk sbfnk force-pushed the advance-deprecations branch from 49345c5 to a1f64fc Compare February 10, 2026 13:01
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

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.

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 pull request removes deprecated public function arguments, converts deprecation warnings to errors for object accessors, removes deprecated public functions, and changes numeric population parameter handling from warnings to errors. The changes affect core option constructors and estimation functions across the package.

Changes

Cohort / File(s) Summary
Options Constructors
R/opts.R
Removed deprecated length-scale parameters (ls_mean, ls_sd, ls_min, ls_max) and alpha parameters (alpha_mean, alpha_sd) from gp_opts; removed na and phi parameters from obs_opts; changed pop handling in rt_opts from deprecation warning to error when numeric values are passed.
Estimation Function Signature Updates
R/estimate_infections.R, R/estimate_secondary.R, R/epinow.R, R/regional_epinow.R, R/format.R
Removed deprecated parameters: filter_leading_zeros, zero_threshold, horizon from estimate_infections and epinow; filter_leading_zeros, zero_threshold from estimate_secondary; horizon from regional_epinow; burn_in, start_date from format_fit.
Accessor Error Conversion
R/epinow.R, R/estimate_infections.R, R/estimate_secondary.R, R/estimate_truncation.R
Changed deprecated element accessors (e.g., $samples, $summarised, $predictions) from emitting deprecation warnings to raising errors via lifecycle::deprecate_stop. Updated summary() methods to error for deprecated usage patterns.
Deprecated Function Removals
R/extract.R, R/preprocessing.R
Removed public function extract_parameter_samples() and internal helper default_fill_missing_obs().
Supporting Code Changes
R/checks.R, R/create.R, R/simulate_infections.R, inst/dev/stan-to-R.R
Updated error handling in check_generation_time; introduced get_accumulate() helper; changed pop numeric validation in simulate_infections to error; refactored data variable usage in test helper.
Summary and Other Behaviour
R/summarise.R
Updated summary.epinow() and summary.estimate_infections() to error on deprecated arguments instead of warning; removed backward-compatibility return paths.
Documentation Files
man/*.Rd
Updated all function documentation to reflect removed parameters; changed accessor documentation from "deprecation warnings" to "deprecation errors"; removed documentation files for deleted functions (default_fill_missing_obs.Rd, extract_parameter_samples.Rd); updated examples in create_gp_data.Rd.
Test Updates
tests/testthat/test-*.R
Replaced deprecated accessor checks and summary calls with new accessor functions; updated expectations from deprecation warnings to errors for deprecated element access; removed tests for removed deprecated functions.
Miscellaneous
NEWS.md, inst/WORDLIST
Updated changelog documenting all removals and behaviour changes; added "erroring" to word list.

Possibly Related PRs

  • PR #904: Related through population parameter handling—both PRs modify rt_opts and simulate_infections to enforce distribution-based pop specifications with Fixed(pop) conversion requirements.
  • PR #1209: Related through epinow summary and accessor behaviour—both PRs modify how deprecated element access is handled and summary methods function.
  • PR #1221: Related through estimate_truncation accessor dispatch—both PRs update deprecated accessor error handling and refactor the extraction logic.
🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses issue #1309 which requests updating the forecasting_multiple_data_streams vignette. However, the raw_summary shows only code changes to R files, documentation, and tests—no vignette updates are present. Verify whether the forecasting_multiple_data_streams vignette has been updated to reflect the deprecation changes, or confirm that this PR is separate from the vignette update requirement in #1309.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (48 files):

⚔️ NEWS.md (content)
⚔️ R/checks.R (content)
⚔️ R/create.R (content)
⚔️ R/epinow.R (content)
⚔️ R/estimate_infections.R (content)
⚔️ R/estimate_secondary.R (content)
⚔️ R/estimate_truncation.R (content)
⚔️ R/extract.R (content)
⚔️ R/format.R (content)
⚔️ R/opts.R (content)
⚔️ R/preprocessing.R (content)
⚔️ R/regional_epinow.R (content)
⚔️ R/simulate_infections.R (content)
⚔️ R/summarise.R (content)
⚔️ inst/WORDLIST (content)
⚔️ inst/dev/stan-to-R.R (content)
⚔️ man/add_horizon.Rd (content)
⚔️ man/cash-.epinow.Rd (content)
⚔️ man/cash-.estimate_infections.Rd (content)
⚔️ man/cash-.estimate_secondary.Rd (content)
⚔️ man/create_gp_data.Rd (content)
⚔️ man/create_shifted_cases.Rd (content)
⚔️ man/epinow.Rd (content)
⚔️ man/estimate_infections.Rd (content)
⚔️ man/estimate_secondary.Rd (content)
⚔️ man/estimate_truncation.Rd (content)
⚔️ man/forecast_secondary.Rd (content)
⚔️ man/format_fit.Rd (content)
⚔️ man/gp_opts.Rd (content)
⚔️ man/obs_opts.Rd (content)
⚔️ man/regional_epinow.Rd (content)
⚔️ man/run_region.Rd (content)
⚔️ man/simulate_infections.Rd (content)
⚔️ man/simulate_secondary.Rd (content)
⚔️ man/sub-sub-.epinow.Rd (content)
⚔️ man/sub-sub-.estimate_infections.Rd (content)
⚔️ man/sub-sub-.estimate_secondary.Rd (content)
⚔️ tests/testthat/test-epinow.R (content)
⚔️ tests/testthat/test-estimate_infections.R (content)
⚔️ tests/testthat/test-estimate_secondary.R (content)
⚔️ tests/testthat/test-estimate_truncation.R (content)
⚔️ tests/testthat/test-regional_epinow.R (content)
⚔️ tests/testthat/test-regional_summary.R (content)
⚔️ tests/testthat/test-rt_opts.R (content)
⚔️ vignettes/prior_choice_guide-workflow-step3-1.png (content)
⚔️ vignettes/prior_choice_guide-workflow-step3-2.png (content)
⚔️ vignettes/prior_choice_guide-workflow-step4-1.png (content)
⚔️ vignettes/prior_choice_guide.Rmd (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Advance deprecation cycle for v1.9.0' accurately summarises the primary change: systematically advancing deprecations (removing deprecated items and promoting warnings to errors) for the v1.9.0 release.
Out of Scope Changes check ✅ Passed The PR scope aligns with advancing the deprecation cycle: removing deprecated arguments, promoting warnings to errors, updating tests, and updating documentation. All changes directly support the stated v1.9.0 deprecation objectives.
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
  • Post copyable unit tests in a comment
  • Commit unit tests in branch advance-deprecations

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.

@sbfnk sbfnk force-pushed the advance-deprecations branch 4 times, most recently from dc58a74 to d6460ae Compare February 10, 2026 17:01
Remove deprecated arguments that have been erroring since v1.7.0:
- gp_opts(alpha_mean, alpha_sd)
- obs_opts(phi, na)
- estimate_infections(filter_leading_zeros, zero_threshold, horizon)
- estimate_secondary(filter_leading_zeros, zero_threshold)
- epinow(filter_leading_zeros, zero_threshold, horizon)
- regional_epinow(horizon)

Advance 1.7.0 deprecation warnings to errors:
- rt_opts(pop = numeric) and simulate_infections(pop = numeric)

Advance 1.8.0 deprecation warnings to errors:
- Deprecated accessors on model objects ($samples, $summarised, etc.)
- summary.epinow(output) and summary.estimate_infections(type = 'samples')
- extract_parameter_samples()

Convert check_generation_time deprecation to plain error.

Co-authored-by: sbfnk-bot <242615673+sbfnk-bot@users.noreply.github.com>
@sbfnk sbfnk force-pushed the advance-deprecations branch from ae3d538 to bdd1fa1 Compare February 10, 2026 17:59
sbfnk and others added 4 commits February 10, 2026 20:12
Co-authored-by: sbfnk-bot <242615673+sbfnk-bot@users.noreply.github.com>
Co-authored-by: sbfnk-bot <242615673+sbfnk-bot@users.noreply.github.com>
Co-authored-by: sbfnk-bot <242615673+sbfnk-bot@users.noreply.github.com>
@sbfnk sbfnk marked this pull request as ready for review February 16, 2026 16:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
man/obs_opts.Rd (1)

67-67: ⚠️ Potential issue | 🟡 Minor

Pre-existing doc bug: example comment contradicts the code.

The comment says "Turn off day of the week effect" but the code sets week_effect = TRUE. This is not introduced by this PR, but since the surrounding documentation was updated, it may be worth fixing in passing.

Suggested fix
-# Turn off day of the week effect
-obs_opts(week_effect = TRUE)
+# Turn off day of the week effect
+obs_opts(week_effect = FALSE)
tests/testthat/test-regional_summary.R (1)

45-64: ⚠️ Potential issue | 🟡 Minor

Test description no longer matches the test body.

The test is described as "works with a lower and upper bound of 0" but the body no longer sets any bounds to zero — it simply calls regional_summary with the unmodified fit, which is effectively the same as the first test case (line 5). Either the edge-case scenario should be restored with the new accessor patterns, or the test should be removed/renamed to avoid a misleading description.

man/cash-.estimate_secondary.Rd (1)

5-5: ⚠️ Potential issue | 🟡 Minor

Update roxygen2 @title to match other accessor documentation files.

The title for the $ accessor documentation in R/estimate_secondary.R says "with deprecated warnings" but should say "with deprecation errors" to be consistent with cash-.estimate_infections.Rd and cash-.epinow.Rd.

🤖 Fix all issues with AI agents
In `@R/opts.R`:
- Around line 349-361: After the numeric deprecation guard in rt_opts, add an
explicit type assertion to validate pop is a dist_spec: call assert_class(pop,
"dist_spec") immediately after the is.numeric(...) deprecate_stop block so
non-numeric, non-<dist_spec> values (e.g., strings) error early rather than
being assigned to opts$pop; keep this validation consistent with other checks
(see existing assert_class usage) and ensure it runs before opts$pop is set.
🧹 Nitpick comments (4)
tests/testthat/test-regional_epinow.R (1)

126-135: Duplicated accessor validation block — consider extracting a helper.

Lines 126–135 are identical to lines 48–57. A small helper (e.g., expect_valid_accessors(fit)) would reduce duplication and make future accessor changes easier to maintain.

tests/testthat/test-epinow.R (1)

44-52: Consider extracting repeated accessor assertions into a shared helper.

The same block of accessor checks (get_samples, summary, estimates_by_report_date, plot) is repeated across five test cases. A small helper (similar to the existing df_non_zero) would reduce duplication and make it easier to update if accessors change again.

♻️ Example helper
assert_epinow_accessors <- function(out, check_plots = TRUE) {
  df_non_zero(get_samples(out))
  df_non_zero(summary(out, type = "parameters"))
  df_non_zero(estimates_by_report_date(out)$summarised)
  expect_true(!is.null(summary(out)))
  if (check_plots) {
    expect_equal(
      names(plot(out, type = "all")),
      c("summary", "infections", "reports", "R", "growth_rate")
    )
  }
}

Then each test block becomes:

-  df_non_zero(get_samples(out))
-  df_non_zero(summary(out, type = "parameters"))
-  df_non_zero(estimates_by_report_date(out)$summarised)
-  expect_true(!is.null(summary(out)))
-  expect_equal(
-    names(plot(out, type = "all")),
-    c("summary", "infections", "reports", "R", "growth_rate")
-  )
+  assert_epinow_accessors(out)

Also applies to: 73-81, 97-105, 121-129, 170-174

NEWS.md (1)

16-22: Some NEWS entries don't start with action verbs.

As per coding guidelines, NEWS.md entries should start with action verbs like 'Added', 'Fixed', 'Updated', 'Changed'. A few entries here use passive or subject-first phrasing:

  • Line 16: "The pop argument…" → "Changed the pop argument…"
  • Line 17: "Deprecated accessors…" → "Changed deprecated accessors…"
  • Line 22: `summary.epinow(output)` and… → "Changed summary.epinow(output) and…"
📝 Suggested wording
-- The `pop` argument in `rt_opts()` and `simulate_infections()` now errors when passed a numeric value. Use `Fixed(pop)` instead.
+- Changed the `pop` argument in `rt_opts()` and `simulate_infections()` to error when passed a numeric value. Use `Fixed(pop)` instead.
-- Deprecated accessors on model objects now error instead of warning:
+- Changed deprecated accessors on model objects to error instead of warning:
-- `summary.epinow(output)` and `summary.estimate_infections(type = 'samples')` now error.
+- Changed `summary.epinow(output)` and `summary.estimate_infections(type = 'samples')` to error.

As per coding guidelines, NEWS.md items should "Start with action verbs: 'Added', 'Fixed', 'Updated', 'Changed'".

R/estimate_infections.R (1)

257-271: Minor inconsistency with $.estimate_secondary pattern.

Here .subset2(x, name) is called after the switch statement, whereas in $.estimate_secondary it's the default case inside switch. Both are functionally correct — deprecate_stop throws before .subset2 is reached for deprecated names, and for non-deprecated names .subset2 runs either way. Just noting the stylistic divergence across accessor methods in the package.

@sbfnk sbfnk force-pushed the advance-deprecations branch from fc8817d to fd16d5a Compare February 16, 2026 17:02
@sbfnk sbfnk requested a review from seabbs February 17, 2026 08:40
Copy link
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.

This all looks good to me.

@seabbs seabbs added this pull request to the merge queue Feb 19, 2026
Merged via the queue into main with commit f28b22f Feb 19, 2026
13 checks passed
@seabbs seabbs deleted the advance-deprecations branch February 19, 2026 18:46
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