From ce28bf32db8af11f360cb2387755671d19c86787 Mon Sep 17 00:00:00 2001 From: Sasa Junuzovic <44276455+microsasa@users.noreply.github.com> Date: Sun, 19 Apr 2026 03:04:18 -0700 Subject: [PATCH] fix: remove structurally unreachable `unreadable < 0` branch in _format_log_files_line Remove the dead `if unreadable < 0` branch from _format_log_files_line in vscode_report.py and its companion test test_inconsistent_counts_shown_when_parsed_exceeds_found. The invariant parsed <= found is guaranteed by construction in get_vscode_summary, so the branch can never execute. Closes #1001 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/copilot_usage/vscode_report.py | 7 +------ tests/copilot_usage/test_vscode_report.py | 16 ---------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/copilot_usage/vscode_report.py b/src/copilot_usage/vscode_report.py index f770c1f6..5a84193d 100644 --- a/src/copilot_usage/vscode_report.py +++ b/src/copilot_usage/vscode_report.py @@ -16,7 +16,7 @@ def _format_log_files_line(summary: VSCodeLogSummary) -> str: - """Build the 'Log Files' line, surfacing unreadable or inconsistent counts.""" + """Build the 'Log Files' line, surfacing unreadable file counts.""" found = summary.log_files_found parsed = summary.log_files_parsed unreadable = found - parsed @@ -27,11 +27,6 @@ def _format_log_files_line(summary: VSCodeLogSummary) -> str: f" ({found} found, " f"[red]{unreadable} unreadable[/red])" ) - if unreadable < 0: - return ( - f"[bold]Log Files:[/bold] {parsed}" - f" ([yellow]{found} found; inconsistent counts[/yellow])" - ) return f"[bold]Log Files:[/bold] {parsed}" diff --git a/tests/copilot_usage/test_vscode_report.py b/tests/copilot_usage/test_vscode_report.py index 3827aa1f..9e560c7b 100644 --- a/tests/copilot_usage/test_vscode_report.py +++ b/tests/copilot_usage/test_vscode_report.py @@ -431,19 +431,3 @@ def test_happy_path_no_unreadable_annotation(self) -> None: assert "Log Files: 4" in log_line assert "unreadable" not in log_line assert "found" not in log_line - - def test_inconsistent_counts_shown_when_parsed_exceeds_found(self) -> None: - """When parsed > found, a yellow warning about inconsistent counts appears.""" - summary = _make_summary( - total_requests=10, - log_files_parsed=5, - log_files_found=3, - ) - output = _capture(summary) - log_line = _strip_ansi( - next(line for line in output.splitlines() if "Log Files" in line) - ) - assert "Log Files: 5" in log_line - assert "3 found" in log_line - assert "inconsistent counts" in log_line - assert "unreadable" not in log_line