Skip to content

Remove conditions ty redundant-condition-strict flags as always true/false - #954

Merged
Sun Haoran (haoranpb) merged 1 commit into
ty/strict-unsound-returnfrom
ty/strict-redundant-condition
Oct 8, 2026
Merged

Sun Haoran (haoranpb) merged 1 commit into
ty/strict-unsound-returnfrom
ty/strict-redundant-condition

Conversation

@haoranpb

@haoranpb Sun Haoran (haoranpb) commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

What

Remove conditions ty redundant-condition-strict proves always true/false:

  • bc_eval_capi_bridge.py: drop redundant mod is None (getattr(None, ...) already handles it).
  • _normalize_error_message: drop dead None guard.
  • mcp_gateway: extract _forward_upstream so _response_started checks are no longer mis-narrowed.

Python only.

Part of the stack that makes ty strict (all = "error") across the whole uv workspace. Each PR fixes one rule in Python code only; the config change lands in #956.

@haoranpb
Sun Haoran (haoranpb) added this pull request to stack #957 October 7, 2026 12:57
@github-code-quality

github-code-quality Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest

The overall line coverage in commit 0a3f853 in the ty/strict-redundant-... branch remains at 86%, unchanged from commit c30246c in the ty/strict-unsound-re... branch.

Show a line coverage summary of the most impacted files.
File ty/strict-unsound-re... c30246c ty/strict-redundant-... 0a3f853 +/-
src/bcbench/eva...stgeneration.py 46% 41% -5%
src/bcbench/col...t_codereview.py 89% 88% -1%
src/bcbench/ope...p_operations.py 92% 91% -1%
src/bcbench/ope...n_operations.py 88% 87% -1%
src/bcbench/age...opilot/agent.py 74% 73% -1%
src/bcbench/eva...view_parsing.py 70% 70% 0%
src/bcbench/types.py 91% 92% +1%
src/bcbench/config.py 97% 98% +1%
src/bcbench/age.../mcp_gateway.py 91% 92% +1%
src/bcbench/age...t/shared/mcp.py 92% 95% +3%

Updated October 08, 2026 11:25 UTC

@haoranpb
Sun Haoran (haoranpb) force-pushed the ty/strict-redundant-condition branch from ec6d7b8 to ff6192b Compare October 7, 2026 13:46
@haoranpb
Sun Haoran (haoranpb) force-pushed the ty/strict-redundant-condition branch 3 times, most recently from af18843 to 7bd0832 Compare October 8, 2026 09:23
@haoranpb
Sun Haoran (haoranpb) force-pushed the ty/strict-redundant-condition branch from 7bd0832 to 8cf4dec Compare October 8, 2026 09:59
@haoranpb
Sun Haoran (haoranpb) force-pushed the ty/strict-redundant-condition branch 2 times, most recently from 3d67c55 to 8658692 Compare October 8, 2026 10:13
@haoranpb
Sun Haoran (haoranpb) marked this pull request as ready for review October 8, 2026 11:06
Copilot AI balanced review requested due to automatic review settings October 8, 2026 11:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused refactors preserve existing behavior and correctly address the strict ty diagnostics.

0 open findings

What changed in this PR

Removes conditions that ty proves redundant while preserving runtime behavior for artifact analysis, MCP proxying, and CAPI credential patching.

Changes:

  • Removes unreachable None guards.
  • Extracts MCP upstream forwarding to avoid incorrect type narrowing.
File Description
tools/​altest/​bcbench_analyze_artifacts.py Removes a dead None check.
src/​bcbench/​agent/​shared/​mcp_gateway.py Extracts upstream forwarding into a helper method.
src/​bcbench/​agent/​bcal/​bc_eval_capi_bridge.py Relies on safe getattr handling for None modules.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

…false

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 70c54f79-d7a0-4cde-baf2-e53dfff3deb4
@haoranpb
Sun Haoran (haoranpb) force-pushed the ty/strict-redundant-condition branch from 8658692 to 0a3f853 Compare October 8, 2026 11:24
@haoranpb
Sun Haoran (haoranpb) merged commit b64e88a into main Oct 8, 2026
17 checks passed
@haoranpb
Sun Haoran (haoranpb) deleted the ty/strict-redundant-condition branch October 8, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants