Skip to content

fix: remove structurally unreachable unreadable < 0 branch (#1001)#1004

Merged
microsasa merged 1 commit intomainfrom
fix/remove-unreachable-unreadable-branch-1001-211fe375b24370e2
Apr 19, 2026
Merged

fix: remove structurally unreachable unreadable < 0 branch (#1001)#1004
microsasa merged 1 commit intomainfrom
fix/remove-unreachable-unreadable-branch-1001-211fe375b24370e2

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Closes #1001

Changes

src/copilot_usage/vscode_report.py

  • Removed the dead if unreadable < 0: branch from _format_log_files_line. The invariant parsed ≤ found is guaranteed by construction in get_vscode_summary (parsed starts at 0 and only increments on success, while found = len(logs)), so unreadable can never be negative.
  • Updated the docstring to drop the "or inconsistent counts" reference.

tests/copilot_usage/test_vscode_report.py

  • Removed test_inconsistent_counts_shown_when_parsed_exceeds_found which tested this impossible state.

Verification

  • The two remaining branch tests (test_unreadable_files_shown_when_found_exceeds_parsed and test_happy_path_no_unreadable_annotation) still pass.
  • make check passes cleanly: lint ✅, typecheck ✅, security ✅, unit tests (99% coverage) ✅, e2e tests (86 passed) ✅.

Generated by Issue Implementer · ● 3.8M ·

…at_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>
Copilot AI review requested due to automatic review settings April 19, 2026 10:04
@microsasa microsasa added the aw Created by agentic workflow label Apr 19, 2026
@microsasa microsasa enabled auto-merge April 19, 2026 10:04
@microsasa microsasa added the aw Created by agentic workflow label Apr 19, 2026
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 removes a structurally unreachable “inconsistent counts” reporting branch from the VS Code summary renderer, aligning the output logic with the invariants enforced by get_vscode_summary.

Changes:

  • Removed the dead unreadable < 0 branch in _format_log_files_line and updated its docstring accordingly.
  • Deleted the unit test that exercised the impossible parsed > found state.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/copilot_usage/vscode_report.py Simplifies log-file count formatting by removing an unreachable “inconsistent counts” branch and updating the docstring.
tests/copilot_usage/test_vscode_report.py Removes the test covering the unreachable branch, leaving coverage for the two reachable cases.

@microsasa microsasa added the aw-quality-gate-approved Quality gate approved the PR label Apr 19, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Low-impact dead code removal. The unreadable < 0 branch in _format_log_files_line is structurally unreachable because get_vscode_summary sets log_files_found=len(logs) and only increments log_files_parsed on success (line 767/789 of vscode_parser.py), guaranteeing parsed ≤ found. Removing the branch and its impossible-state test is correct. All CI checks pass. Auto-approving for merge.

@microsasa microsasa merged commit b35465b into main Apr 19, 2026
8 checks passed
@microsasa microsasa deleted the fix/remove-unreachable-unreadable-branch-1001-211fe375b24370e2 branch April 19, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow aw-quality-gate-approved Quality gate approved the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw][code health] dead code branch in _format_log_files_lineunreadable < 0 is structurally unreachable

2 participants