BOT: Fix #811: batch failed metric warnings into a single message#1085
BOT: Fix #811: batch failed metric warnings into a single message#1085nikosbosse wants to merge 1 commit intomainfrom
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
nikosbosse
left a comment
There was a problem hiding this comment.
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.
Summary
score(),apply_metrics()now collects all errors and emits a single batchedcli_warn()summarizing all failures, instead of warning separately for each failed metricrun_safely()no longer callscli_warn()directly — it returns error info as a structured list, andapply_metrics()handles the aggregated warningscore()/apply_metrics()return warning about failed metrics in a batch? #811Root cause
run_safely()calledcli_warn()immediately inside thelapplyloop for each metric that failed. With N failing metrics, users saw N separate warnings with no clear summary.What the fix does
run_safely()now returnslist(result = NULL, error = <message>)on failure instead of warningapply_metrics()collects all failures during the loop, then emits a singlecli_warn()at the end listing all failed metrics and their error messagestest-class-forecast-quantile.Rupdated to match the new warning formatTest coverage added
apply_metrics()emits a single batched warning when multiple metrics failapply_metrics()emits no warning when all metrics succeedscore()emits a single batched warning when multiple metrics failrun_safely()returns error info instead of warning directlyscore()test updated for new format🤖 Generated with Claude Code