diff --git a/src/copilot_usage/report.py b/src/copilot_usage/report.py index 809e214..1630450 100644 --- a/src/copilot_usage/report.py +++ b/src/copilot_usage/report.py @@ -554,9 +554,7 @@ def _render_active_section_from( ) return - table = Table( - title="🟢 Active Sessions (Since Last Shutdown)", border_style="green" - ) + table = Table(title="🟢 Active Sessions", border_style="green") table.add_column("Name", style="bold", max_width=40) table.add_column("Model") table.add_column("Model Calls", justify="right") @@ -594,7 +592,7 @@ def render_full_summary( """Render the two-section summary for interactive mode. Section 1: Historical shutdown data (totals, per-model, per-session). - Section 2: Active sessions since last shutdown. + Section 2: Currently active sessions. *sessions* must be in descending ``start_time`` order — the contract guaranteed by :func:`~copilot_usage.parser.get_all_sessions`. No diff --git a/tests/copilot_usage/test_report.py b/tests/copilot_usage/test_report.py index b5ecb7d..38690e7 100644 --- a/tests/copilot_usage/test_report.py +++ b/tests/copilot_usage/test_report.py @@ -3656,9 +3656,9 @@ def test_resumed_free_session_appears_in_active_section(self) -> None: }, ) output = _capture_full_summary([session]) - # Active section table title should indicate it is scoped to the period - # since the last shutdown, which distinguishes it from the historical table. - assert "Since Last Shutdown" in output + # Active section table title should NOT contain the misleading + # "Since Last Shutdown" qualifier (issue #1072). + assert "Since Last Shutdown" not in output # The same resumed session should appear in both the historical and active sections. assert output.count("ResumedFreeSession") == 2 # And the generic empty-active message should not be shown. @@ -3683,6 +3683,27 @@ def test_pure_active_session_not_in_historical(self) -> None: output = _capture_full_summary([session]) assert "No historical shutdown data" in output + def test_pure_active_section_title_no_since_last_shutdown(self) -> None: + """Issue #1072 — pure-active session (has_shutdown_metrics=False) + must NOT show 'Since Last Shutdown' in the active-section title.""" + session = SessionSummary( + session_id="pure-active-title-1234", + name="PureActiveTitle", + model="gpt-5-mini", + start_time=datetime(2025, 1, 15, 10, 0, tzinfo=UTC), + is_active=True, + has_shutdown_metrics=False, + total_premium_requests=0, + user_messages=2, + model_calls=1, + active_model_calls=1, + active_output_tokens=100, + ) + output = _capture_full_summary([session]) + assert "Since Last Shutdown" not in output + # The generic title should still be present. + assert "Active Sessions" in output + class TestBuildEventDetailsCatchAll: """Issue #230 — _build_event_details catch-all branch for event types without explicit details.""" diff --git a/tests/e2e/test_e2e.py b/tests/e2e/test_e2e.py index ec72a3e..8e36437 100644 --- a/tests/e2e/test_e2e.py +++ b/tests/e2e/test_e2e.py @@ -809,7 +809,7 @@ def test_not_found_shows_available_list(self) -> None: # --------------------------------------------------------------------------- # Marker that separates the historical section from the active section -_ACTIVE_MARKER = "Active Sessions (Since Last Shutdown)" +_ACTIVE_MARKER = "Active Sessions" # Minimal completed session with zero premium requests (free-tier model only). # Used to verify that the historical filter's ``not s.is_active`` branch