Skip to content

test: add idle-resumed and light-tier coverage for report helpers (#1162)#1163

Open
microsasa wants to merge 1 commit intomainfrom
fix/1162-idle-resumed-and-light-tier-tests-bc7e0c83874df95e
Open

test: add idle-resumed and light-tier coverage for report helpers (#1162)#1163
microsasa wants to merge 1 commit intomainfrom
fix/1162-idle-resumed-and-light-tier-tests-bc7e0c83874df95e

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Closes #1162

Changes

Adds three tests to close coverage gaps identified in the issue:

Gap 1 — _compute_session_totals: idle-resumed state

test_shutdown_only_no_subtraction_for_idle_resumed_session — covers the untested else branch when shutdown_only=True, has_shutdown_metrics=True, but has_active_period_stats() returns False (all active_* counters are 0, last_resume_time is None). Asserts full model_calls and user_messages are returned without subtraction.

Gap 2 — _estimate_premium_cost: light-tier 0.33× multiplier

test_light_tier_model_uses_fractional_multiplier — exercises claude-haiku-4.5 (0.33× multiplier) at 1, 3, and 10 calls, verifying the round() rounding behavior that was previously untested:

  • round(0.33) = 0"~0"
  • round(0.99) = 1"~1"
  • round(3.3) = 3"~3"

Companion — render_live_sessions light-tier Est. Cost column

test_est_cost_light_tier_model — end-to-end render test that verifies a claude-haiku-4.5 session with 3 active model calls shows "~1" in the Est. Cost column.

Warning

⚠️ Firewall blocked 3 domains

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

  • astral.sh
  • pypi.org
  • releaseassets.githubusercontent.com

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

network:
  allowed:
    - defaults
    - "astral.sh"
    - "pypi.org"
    - "releaseassets.githubusercontent.com"

See Network Configuration for more information.

Generated by Issue Implementer · ● 14.2M ·

)

Add three tests to close coverage gaps in _compute_session_totals and
_estimate_premium_cost:

- TestComputeSessionTotals: idle-resumed state (is_active=True,
  has_shutdown_metrics=True, has_active_period_stats=False) verifies
  the else branch returns full counts without subtraction.

- TestEstimatePremiumCost: light-tier 0.33× multiplier (claude-haiku-4.5)
  verifies fractional rounding at 1, 3, and 10 calls.

- TestRenderLiveSessions: end-to-end render check that the Est. Cost
  column shows ~1 for a haiku session with 3 active model calls.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 2, 2026 14:40
@microsasa microsasa added the aw Created by agentic workflow label May 2, 2026
@microsasa microsasa enabled auto-merge May 2, 2026 14:41
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

This PR adds focused regression tests for the reporting layer in copilot_usage, closing coverage gaps around idle-resumed session aggregation and light-tier premium-cost estimation/rendering.

Changes:

  • Add a render_live_sessions test for a light-tier claude-haiku-4.5 session showing the expected estimated cost.
  • Add direct _estimate_premium_cost assertions for 0.33× multiplier rounding behavior.
  • Add _compute_session_totals coverage for idle-resumed sessions where shutdown-only totals must not subtract inactive active_* counters.

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

2 participants