Skip to content

Comments

BOT: Fix #811: batch failed metric warnings into a single message#1085

Draft
nikosbosse wants to merge 1 commit intomainfrom
fix/811-batch-failed-metric-warnings
Draft

BOT: Fix #811: batch failed metric warnings into a single message#1085
nikosbosse wants to merge 1 commit intomainfrom
fix/811-batch-failed-metric-warnings

Conversation

@nikosbosse
Copy link
Collaborator

Summary

  • When multiple metrics fail during score(), apply_metrics() now collects all errors and emits a single batched cli_warn() summarizing all failures, instead of warning separately for each failed metric
  • run_safely() no longer calls cli_warn() directly — it returns error info as a structured list, and apply_metrics() handles the aggregated warning
  • Fixes Should score()/apply_metrics() return warning about failed metrics in a batch? #811

Root cause

run_safely() called cli_warn() immediately inside the lapply loop for each metric that failed. With N failing metrics, users saw N separate warnings with no clear summary.

What the fix does

  1. run_safely() now returns list(result = NULL, error = <message>) on failure instead of warning
  2. apply_metrics() collects all failures during the loop, then emits a single cli_warn() at the end listing all failed metrics and their error messages
  3. Existing tests in test-class-forecast-quantile.R updated to match the new warning format

Test coverage added

  • apply_metrics() emits a single batched warning when multiple metrics fail
  • apply_metrics() emits no warning when all metrics succeed
  • Batched warning message includes metric name and error details for each failure
  • score() emits a single batched warning when multiple metrics fail
  • run_safely() returns error info instead of warning directly
  • Existing one-sample score() test updated for new format
  • Full test suite passes (706 tests), R CMD check: 0 errors, 0 warnings

🤖 Generated with Claude Code

When multiple metrics fail during score(), apply_metrics() now collects
all errors and emits a single batched cli_warn() summarizing all failures,
instead of warning separately for each failed metric.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.84%. Comparing base (ac0c01a) to head (d99c867).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1085      +/-   ##
==========================================
+ Coverage   97.83%   97.84%   +0.01%     
==========================================
  Files          35       35              
  Lines        1845     1854       +9     
==========================================
+ Hits         1805     1814       +9     
  Misses         40       40              

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

Copy link
Collaborator Author

@nikosbosse nikosbosse left a comment

Choose a reason for hiding this comment

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

CLAUDE: Approve — Clean, well-scoped fix that correctly moves warning emission from per-metric (run_safely) to batched (apply_metrics). The implementation is minimal: run_safely() returns a structured error list instead of calling cli_warn() directly, and apply_metrics() collects all failures then emits a single cli_warn() summarizing all failed metrics. All 6 test specifications are covered with thorough assertions. Existing tests in test-class-forecast-quantile.R are correctly updated to match the new batched format. No issues found.

@nikosbosse nikosbosse marked this pull request as draft February 13, 2026 08:27
@nikosbosse nikosbosse changed the title Fix #811: batch failed metric warnings into a single message BOT: Fix #811: batch failed metric warnings into a single message Feb 13, 2026
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.

Should score()/apply_metrics() return warning about failed metrics in a batch?

1 participant