Skip to content

939: Remove check_input_binary() and check_input_point() - #1242

Merged
nikosbosse merged 5 commits into
mainfrom
issue-939-remove-check-input
Nov 8, 2026
Merged

nikosbosse merged 5 commits into
mainfrom
issue-939-remove-check-input

Conversation

@nikosbosse

@nikosbosse nikosbosse commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

CLAUDE:

Description

This PR closes #939.

It removes the last two check_input_<forecast_type>() wrappers, check_input_binary() and check_input_point(), together with their roxygen blocks and man/*.Rd files. The wrappers for sample, quantile and interval were removed earlier, so this PR completes #939.

The three call sites, assert_forecast.forecast_binary(), assert_forecast.forecast_point() and assert_forecast.forecast_multivariate_point(), now call check_try(assert_input_<type>(forecast$observed, forecast$predicted)) directly. That is exactly what the wrappers did, so behaviour and the cli_abort() error messages are unchanged. check_try() and document_check_functions() are still used elsewhere and are kept.

Test tidy-ups:

  • Deleted the test "scoring functions still work end-to-end without check_input_* wrappers" in test-inputs-scoring-functions.R. Its name only made sense while some wrappers still existed. It called crps_sample() and bias_quantile(), which test-metrics-sample.R and test-metrics-quantile.R already cover.
  • Tightened the existing multivariate point error test in test-class-forecast-multivariate-point.R. It now expects "Checking \forecast`: Assertion on 'predicted' failed"instead of just"Checking `forecast`", so it pins the interpolated check_try()` message from the refactored call site.

Out of scope: check_dims_ok_scalar() in R/metrics-point.R follows the same "check_ wrapper of an assert_" pattern. #939 is about the check_input_<forecast_type>() helpers only, so this PR leaves it in place.

Implementation: two independent drafts were compared by a judge agent, and draft A was chosen as the base.

Checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have included the target issue or issues in the PR title as follows: issue-number: PR title
  • I have tested my changes locally. The full devtools::test() suite has 1037 passes, 0 failures and 0 errors.
  • N/A: I have added or updated unit tests where necessary. This is a pure refactor of unexported internals, so no test can tell the code before and after apart, and no fails-before/passes-after test was written. The evidence is that the existing error-message tests for all three affected classes (binary, point, multivariate point) still pass. The multivariate point one was tightened as described above.
  • I have updated the documentation if required. The Rd files of the removed internal functions are deleted.
  • I have built the package locally and run rebuilt docs using roxygen2.
  • My code follows the established coding standards and I have run lintr::lint() on the changed files. The changed test files are lint-free. The only R-file lints are the known spurious object_usage_linter "no visible global function" warnings, which also hit unchanged code.
  • I have added a news item linked to this PR. It is under "Internal changes".
  • I have reviewed CI checks for this PR and addressed them as far as I am able. CI is pending.

Review

An independent adversarial agent reviewed this PR and approved it with two minor findings and two nits.

Changed in response:

  • Stale test name (minor): deleted the redundant "...without check_input_* wrappers" test (details above).
  • NEWS wording (nit): removed the implementation-detail clause, so the entry now says only that the two internal helpers were removed.
  • Out-of-scope check_dims_ok_scalar() (nit): added the "Out of scope" note above.

Rebutted:

  • Missing test for the multivariate point error branch (minor): such a test already exists. "as_forecast_multivariate_point() handles errors appropriately" passes a character predicted column. I confirmed that the resulting error comes from the cli_abort() in assert_forecast.forecast_multivariate_point(), which is the only Checking \forecast`: {input_check}` source. Instead of adding a duplicate test, I tightened that test's expected message as described above.

🤖 Generated with Claude Code

nikosbosse and others added 4 commits November 8, 2026 13:08
Forecast validation now calls check_try(assert_input_<type>()) directly,
so new forecast types only need an assert_input_<type>() function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.18%. Comparing base (fe06be3) to head (975020d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1242      +/-   ##
==========================================
- Coverage   99.18%   99.18%   -0.01%     
==========================================
  Files          41       41              
  Lines        2333     2331       -2     
==========================================
- Hits         2314     2312       -2     
  Misses         19       19              

☔ View full report in Codecov by Harness.
📢 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.

@nikosbosse
nikosbosse marked this pull request as ready for review November 8, 2026 13:34
@nikosbosse

Copy link
Copy Markdown
Collaborator Author

LGTM. Merging directly as it's very low-impact

@nikosbosse
nikosbosse merged commit 779d7d6 into main Nov 8, 2026
9 checks passed
@nikosbosse
nikosbosse deleted the issue-939-remove-check-input branch November 8, 2026 13:35
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.

remove check_input_<forecast_type> functions

1 participant