Skip to content

test: add pure-active empty-metrics coverage for render_summary (#1197)#1199

Open
microsasa wants to merge 1 commit intomainfrom
test/pure-active-empty-metrics-1197-fcb7a7f068025bb9
Open

test: add pure-active empty-metrics coverage for render_summary (#1197)#1199
microsasa wants to merge 1 commit intomainfrom
test/pure-active-empty-metrics-1197-fcb7a7f068025bb9

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Closes #1197

Summary

Adds two tests to TestRenderSummary exercising a pure-active session (never shut down) where model_metrics={} but active_output_tokens > 0.

Tests Added

  1. test_pure_active_empty_metrics_shows_active_output_tokens — verifies the Totals panel correctly shows active_output_tokens (1.5K) via total_output_tokens when model_metrics is empty. Guards against regressions where total_output_tokens might be incorrectly short-circuited to return 0 for empty-metrics sessions.

  2. test_pure_active_empty_metrics_no_model_table — verifies _aggregate_model_metrics returns {} for empty model_metrics and no per-model breakdown table appears in the render_summary output. Guards against regressions where a synthetic model row might be incorrectly added.

Regression Scenarios Covered

  • Change total_output_tokens to not return active_output_tokens when model_metrics is empty → test 1 catches it
  • Change _aggregate_model_metrics to synthesize a fallback model row for empty-metrics sessions → test 2 catches it

Warning

⚠️ Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • astral.sh
  • pypi.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "astral.sh"
    - "pypi.org"

See Network Configuration for more information.

Generated by Issue Implementer · ● 8.4M ·

Add two tests to TestRenderSummary exercising a pure-active session
(never shut down) where model_metrics={} but active_output_tokens > 0:

1. test_pure_active_empty_metrics_shows_active_output_tokens — verifies
   the Totals panel correctly shows active_output_tokens (1.5K) via
   total_output_tokens when model_metrics is empty.

2. test_pure_active_empty_metrics_no_model_table — verifies
   _aggregate_model_metrics returns {} and no per-model breakdown
   table appears in the output.

Closes #1197

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 07:31
@microsasa microsasa added the aw Created by agentic workflow label May 6, 2026
@microsasa microsasa enabled auto-merge May 6, 2026 07:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds targeted unit-test coverage for copilot_usage.report.render_summary when rendering a pure-active session that has model_metrics={} but non-zero active_output_tokens, ensuring totals/token counting and model-table behavior don’t regress.

Changes:

  • Add a TestRenderSummary case asserting active_output_tokens contribute to totals when model_metrics is empty.
  • Add a TestRenderSummary case asserting no per-model breakdown table is rendered when model_metrics is empty.

output = _capture_summary([session])
# _aggregate_model_metrics returns {} for empty model_metrics,
# so no per-model breakdown table should appear.
assert "claude-" not in output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw][test audit] render_summary: pure-active session with active_output_tokens > 0 and model_metrics={} not covered

2 participants