Skip to content

[repo-improver] test-coverage: cover check_input_data validation error branches - #263

Open
Mike Tokic (mitokic) wants to merge 2 commits into
mainfrom
agent/2026-08-03/test-coverage-input-checks-validation-82eda765
Open

[repo-improver] test-coverage: cover check_input_data validation error branches#263
Mike Tokic (mitokic) wants to merge 2 commits into
mainfrom
agent/2026-08-03/test-coverage-input-checks-validation-82eda765

Conversation

@mitokic

Copy link
Copy Markdown
Collaborator

Evidence

R/input_checks.R::check_input_data() contains a number of detailed, user-facing
validation error messages (several recently enhanced) that had no regression
coverage in tests/testthat/test-input_checks.R. A baseline reproducer confirmed
the exact current message for each branch, so the behavior is well-defined but
unguarded against accidental regressions.

Change

Add focused testthat coverage for the previously untested check_input_data
validation branches. No source behavior is changed — this is test-only:

  • combo variables missing from the input data
  • target variable missing from the input data
  • external regressors missing from the input data
  • non-numeric target variable
  • missing Date column
  • non-date-formatted Date column
  • uneven day-of-month spacing for month data, plus a positive test that
    date_type = "week" bypasses that check
  • fiscal_year_start outside 1–12
  • duplicate combo-Date rows

Dependency decision

No new dependency added. Existing capabilities were sufficient: testthat
(already in Suggests) and base R. This is test-only coverage, so the dependency
ladder resolves at step 2 (existing declared dependencies).

Validation

Each category was run in its own process with
Rscript -e "devtools::test(filter = '<filter>', stop_on_failure = TRUE)",
affected category first:

Category Filter Result
focused reproducer ^input_checks$ FAIL 0 · PASS 39
data-input-preparation ^(input_checks|hash_data|prep_data|clamp_negative_target|undifference)$ FAIL 0 · PASS 262
forecasting-core ^(forecast_time_series|multistep|hierarchical)$ FAIL 0 · PASS 237
model-selection-results ^(best_models|final_models|summarize_models)$ FAIL 0 · SKIP 2 · PASS 700
agent-run-lifecycle ^(agent|finalize_run|load_run_results)$ FAIL 0 · PASS 155
foundation-model-integrations ^(foundation-model-credentials|chronos|timegpt|timesfm)$ FAIL 0 · SKIP 17 · PASS 281

All 18 test-*.R files map exactly to the five configured categories; no
unclassified files. No roxygen/source changes, so devtools::document() was not
required.

Rscript -e "devtools::check(args = '--no-tests')" completed all package checks
but errored only at vignette re-building ('xfun::attr()' is deprecated). This is
a pre-existing environment/toolchain limitation: the identical command on clean
main fails at the same vignette step with the same error, so it is unrelated to
this test-only change. All focused and category tests pass.

Risk and limitations

Blast radius 1 (test-only; no runtime or public-API change). These tests lock in
the current user-facing validation messages, so intentional future message edits
must update the corresponding assertions. The only unavailable gate is the
pre-existing vignette build error noted above.

Automation metadata

  • Scout run: 2026-08-03 18:22 PDT (America/Los_Angeles)
  • Source SHA: 53908f7d75ea2f37ccf269afada8bc62e99bc5c7
  • Recommendation fingerprint: 82eda7658e3d9c96cbfdb0c1b913ca8671b273281591527a139b1ccb2bdd6c77

Add focused testthat coverage for previously untested check_input_data validation branches: missing combo/target/external-regressor columns, non-numeric target, missing and non-date-formatted Date column, uneven day-of-month spacing for month data (and week bypass), fiscal_year_start range, and duplicate combo-Date rows.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Plan (review focus):

  • Verify new tests match current check_input_data() validation branches and messages.
  • Check that “positive” tests isolate the intended behavior and won’t fail for unrelated future validations.
  • Ensure changes are test-only and consistent with existing test conventions.

This PR adds regression coverage around R/input_checks.R::check_input_data() by asserting the current user-facing validation errors across previously untested branches, helping prevent accidental message/behavior regressions without changing runtime behavior.

Changes:

  • Added testthat cases for missing required columns (combo vars, target, xregs) and invalid target type.
  • Added coverage for Date column presence/type, month day-of-month consistency, fiscal year start range, and duplicate combo–Date rows.
  • Added a “week” positive test intended to confirm the month day-of-month check is bypassed for date_type = "week".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/testthat/test-input_checks.R Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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