Skip to content

Fix empty AIC cells in daily guardrail summary when no prior runs exist in 24h window#38304

Merged
mnkiefer merged 4 commits into
mainfrom
copilot/investigate-missing-ai-credit-data
Jun 10, 2026
Merged

Fix empty AIC cells in daily guardrail summary when no prior runs exist in 24h window#38304
mnkiefer merged 4 commits into
mainfrom
copilot/investigate-missing-ai-credit-data

Conversation

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

When the daily AIC guardrail finds no completed runs within the 24-hour window, all stats are zero. formatAIC(0) intentionally returns "", leaving the summary table with blank cells for total, average, std dev, and min/max AIC — visually indistinguishable from missing data.

Changes

  • renderDailyAICSummary: detect stats.count === 0 and render explicit fallbacks instead of relying on formatAICCredits to produce something meaningful for zero values:
    • 24h total AIC"0" (correct: no credits consumed)
    • Avg AIC / run, Std dev AIC, Min / Max AIC"—" (undefined without data points)
const noRunData = stats.count === 0;
const totalAICFormatted = formatAICCredits(stats.total) || "0";
const avgAICFormatted = noRunData ? "—" : formatAICCredits(stats.average) || "0";
const stddevAICFormatted = noRunData ? "—" : formatAICCredits(stats.stddev) || "0";
const minMaxAICFormatted = noRunData ? "— / —" : `${formatAICCredits(stats.min)} / ${formatAICCredits(stats.max)}`;
  • check_daily_aic_workflow_guardrail.test.cjs: adds a dedicated test asserting the zero-runs rendering produces 0 and values rather than empty strings.

…24h window

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate missing data in AI Credit usage Fix empty AIC cells in daily guardrail summary when no prior runs exist in 24h window Jun 10, 2026
Copilot AI requested a review from mnkiefer June 10, 2026 07:56
@mnkiefer mnkiefer marked this pull request as ready for review June 10, 2026 07:58
Copilot AI review requested due to automatic review settings June 10, 2026 07:58

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

This PR improves the daily AI Credits (AIC) guardrail summary rendering when there are no completed runs in the 24-hour inspection window, avoiding misleading empty table cells caused by formatAICCredits(0) returning an empty string.

Changes:

  • Updates renderDailyAICSummary to render explicit fallback values for the “zero prior runs” case (e.g., 24h total AIC0, and stats that are undefined without data → ).
  • Adds a unit test covering the zero-runs rendering to ensure the markdown includes 0/ rather than blank cells.
Show a summary per file
File Description
actions/setup/js/check_daily_aic_workflow_guardrail.cjs Adds stats.count === 0 handling and formatted fallbacks for AIC summary stats to avoid empty markdown cells.
actions/setup/js/check_daily_aic_workflow_guardrail.test.cjs Adds a test validating correct markdown output when no prior runs exist in the 24h window.

Copilot's findings

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread actions/setup/js/check_daily_aic_workflow_guardrail.cjs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mnkiefer

Copy link
Copy Markdown
Collaborator

@copilot Fix tests and lint errors

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Fix tests and lint errors

Fixed in the latest commit. The previous commit accidentally merged two template literal lines together (missing a comma between them), causing a TS2796 tagged template expression error that broke the typecheck and tests. The comma is now restored.

Copilot AI requested a review from mnkiefer June 10, 2026 08:14
@mnkiefer mnkiefer merged commit fd39436 into main Jun 10, 2026
@mnkiefer mnkiefer deleted the copilot/investigate-missing-ai-credit-data branch June 10, 2026 08:25
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.

Missing data in AI Credit usage (activation summary)

3 participants