Skip to content

Improve forecast command output - #48839

Merged
pelikhan merged 2 commits into
mainfrom
improve-forecast-command
Jul 29, 2026
Merged

Improve forecast command output#48839
pelikhan merged 2 commits into
mainfrom
improve-forecast-command

Conversation

@pelikhan

@pelikhan pelikhan commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Simplifies the gh aw forecast command's console table output by removing the Engines and Triggers columns, adds a Runs total row, guards against NaN/Inf poisoning aggregated totals, and limits the detailed per-run samples section to explicit workflow selections.

Changes

  • pkg/cli/forecast_render.go

    • Removed the Engines and Triggers columns from the rendered forecast table.
    • Deleted the now-unused formatEngineList() and formatTriggerList() helper functions (and the strings import they required).
    • Added a totalRuns counter, now displayed in the TOTAL row.
    • Guarded totalWeeklyP50/totalMonthlyP50 accumulation against NaN/Inf values so a single unreliable projection can't poison the totals.
    • The detailed per-run samples section (printRunSamplesSection) is now only printed when specific --workflow IDs are passed via config.WorkflowIDs, instead of always.
  • pkg/cli/forecast_types.go

    • Removed the Engines and Triggers fields (and their console/json tags) from the forecastTableRow struct used for table rendering.

Impact

  • Breaking (internal): forecastTableRow no longer exposes Engines/Triggers — any code or tests depending on those fields will need updating.
  • Behavioral change: running gh aw forecast without specific workflow IDs no longer prints the per-run samples section, reducing default output verbosity.
  • Correctness fix: NaN/Inf values from unreliable Monte Carlo projections no longer corrupt aggregate weekly/monthly totals.

Files changed

File Type
pkg/cli/forecast_render.go modified
pkg/cli/forecast_types.go modified

Generated by PR Description Updater for #48839 · sonnet50 · 30.8 AIC · ⌖ 4.59 AIC · ⊞ 6.5K ·

- Remove Engines and Triggers columns from the summary table
- Only show detailed per-run samples table when specific workflows are requested
- Compute TOTAL row even when NA values are present (skip NaN/Inf, sum Runs)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f275d7e4-4d62-4ea3-8fb3-2bc485d0e2bf
Copilot AI review requested due to automatic review settings July 29, 2026 10:17

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR refines the forecast CLI table output by simplifying displayed columns and making summary calculations more robust when projections are unreliable.

Changes:

  • Remove Engines/Triggers columns from forecast table output.
  • Prevent NaN/Inf projected values from corrupting weekly/monthly total aggregates.
  • Add Total Runs to the TOTAL row and limit run-sample details to targeted workflow queries.
Show a summary per file
File Description
pkg/cli/forecast_types.go Removes Engines/Triggers fields from the table row schema to simplify rendered output.
pkg/cli/forecast_render.go Skips NaN/Inf in totals, adds total run count, gates sample details rendering, and removes now-unused formatting helpers/import.

Review details

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment on lines 70 to 71
WeeklyP50: formatForecastAIC(weeklyP50),
MonthlyP50: formatForecastAIC(monthlyP50),
Comment on lines +56 to +62
// Skip NaN/Inf so a single unreliable projection can't poison the totals.
if !math.IsNaN(weeklyP50) && !math.IsInf(weeklyP50, 0) {
totalWeeklyP50 += weeklyP50
}
if !math.IsNaN(monthlyP50) && !math.IsInf(monthlyP50, 0) {
totalMonthlyP50 += monthlyP50
}
@pelikhan
pelikhan merged commit c3a4bed into main Jul 29, 2026
29 checks passed
@pelikhan
pelikhan deleted the improve-forecast-command branch July 29, 2026 10:39
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.5

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