1195: Fix assert_forecast() for nominal and ordinal forecasts#1208
Open
nikosbosse wants to merge 1 commit into
Open
1195: Fix assert_forecast() for nominal and ordinal forecasts#1208nikosbosse wants to merge 1 commit into
nikosbosse wants to merge 1 commit into
Conversation
- Invert the completeness filter so the incomplete-forecast error message names the first incomplete forecast instead of the first complete one (or NA when all forecasts were incomplete). - Return invisible(NULL) as documented and as all other assert_forecast() methods do, instead of visibly returning the forecast object. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1208 +/- ##
=======================================
Coverage 98.15% 98.15%
=======================================
Files 41 41
Lines 2225 2225
=======================================
Hits 2184 2184
Misses 41 41 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
Automated review (Claude Fable, directed by @nikosbosse): Verdict: approve. Independently verified in an isolated checkout:
Minor pre-existing observation (out of scope, no action needed): the ordinal "Printing works as expected" test emits a validation warning because |
nikosbosse
marked this pull request as draft
July 18, 2026 13:53
nikosbosse
marked this pull request as ready for review
July 18, 2026 21:07
Collaborator
Author
|
lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR closes #1195.
assert_forecast.forecast_nominal()andassert_forecast.forecast_ordinal()had two bugs:complete[(correct), ...](the forecasts that passed the check) instead ofcomplete[!(correct), ...]when building the error message. As a result the error pointed the user at the first complete forecast, and atNAwhen every forecast was incomplete. Fixed by inverting the filter in both methods.assert_forecast()is "Returns NULL invisibly", and all other methods (binary, point, quantile, sample) do exactly that; the nominal and ordinal methods ended withreturn(forecast[]), so a top-levelassert_forecast()call auto-printed the entire dataset. Fixed by returninginvisible(NULL). No caller consumes the return value, so nothing else changes.Tests were written first and failed against the unfixed code:
(plus the analogous failures for the ordinal test file). All tests pass after the fix; the full suite passes (0 failed, 916 passed).
Dev note: bug identified by an LLM audit (#1189); fix and tests implemented with LLM support, directed by @nikosbosse.
Checklist
lintr::lint_package()to check for style issues introduced by my changes.