Fix #1071: Rename forecast_sample_multivariate class to match constructor#1072
Fix #1071: Rename forecast_sample_multivariate class to match constructor#1072nikosbosse merged 10 commits intomainfrom
Conversation
Rename class from forecast_sample_multivariate to forecast_multivariate_sample to match the constructor function as_forecast_multivariate_sample(). The old class name is retained in the class vector during the deprecation period so inherits(x, "forecast_sample_multivariate") still works. This fixes transform_forecasts(append = TRUE) which previously failed because it dynamically constructed the wrong constructor name from the class. Other changes: - is_forecast_sample_multivariate() deprecated in favour of is_forecast_multivariate_sample() - Deprecated S3 method aliases for score, get_metrics, and assert_forecast retained for backwards compatibility - get_forecast_type() now takes the first matching forecast_* class to handle the dual-class deprecation period - joint_across made optional in the constructor when data already has .mv_group_id (needed for transform_forecasts reconstruction) Closes #1071
Ensures get_forecast_type() errors clearly if a class matches the forecast_ prefix but has no type suffix.
|
Note on deprecation wrappers: Since multivariate scoring hasn't been included in a CRAN release yet (it was merged after v2.1.2), no external users have the old Options:
I'd suggest option 1 (keep for now, remove before CRAN) as the safest approach since it avoids breaking any in-progress work that might reference the old names (e.g. hubEvals development), but we should clean them up before going to CRAN to avoid shipping deprecated code that was never public. This was opened by a bot. Please ping @seabbs for any questions. |
seabbs
left a comment
There was a problem hiding this comment.
This looks good to me. As noted I think we probably don't need to push to CRAN with the mismatched naming but can drop the depreciations instead (having some warning of this does seem like a good idea for those living on the bleeding edge).
The linter changed paste(..., collapse = ", ") to toString() in snapshots but not in the test code, causing CI failures.
Aligns test code and snapshots to use toString() consistently, fixing CI snapshot mismatches.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1072 +/- ##
==========================================
+ Coverage 97.83% 97.85% +0.02%
==========================================
Files 35 35
Lines 1845 1865 +20
==========================================
+ Hits 1805 1825 +20
Misses 40 40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Cover the cli_abort when joint_across is NULL and .mv_group_id is absent from the data.
|
Some linting issues to clean up |
|
Thanks @seabbs |
…iate Since multivariate scoring hasn't been in a CRAN release yet, the deprecation wrappers added in #1072 are not needed for backwards compatibility. This removes: - The deprecated class name "forecast_sample_multivariate" from the class vector (it was appended after "forecast" for compat) - assert_forecast.forecast_sample_multivariate S3 method alias - is_forecast_sample_multivariate() deprecated function - score.forecast_sample_multivariate S3 method alias - get_metrics.forecast_sample_multivariate S3 method alias Also regenerates example data and documentation to reflect the clean class vector. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
forecast_sample_multivariatedid not match constructoras_forecast_multivariate_sample()(word order mismatch)transform_forecasts(append = TRUE)to fail on multivariate sample forecasts because it dynamically constructedas_forecast_sample_multivariate(wrong name) from the classChanges
forecast_sample_multivariatetoforecast_multivariate_sampleinherits(x, "forecast_sample_multivariate")still worksis_forecast_sample_multivariate()in favour ofis_forecast_multivariate_sample()score,get_metrics, andassert_forecastmethods retainedget_forecast_type(): now takes first matchingforecast_*class to handle dual-class deprecation periodjoint_acrossmade optional: when data already has.mv_group_id(needed fortransform_forecastsobject reconstruction)Test plan
transform_forecasts(append = TRUE)now works on multivariate sample forecastsis_forecast_sample_multivariate()emits warning and still returns correct resultCloses #1071
This was opened by a bot. Please ping @seabbs for any questions.