From 32980231ad33198f3cf366ba4b5b1d7ea7a358f8 Mon Sep 17 00:00:00 2001 From: "developerz-ai[bot]" <286432749+developerz-ai[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 03:46:23 +0000 Subject: [PATCH] refactor: delete dead _format_pr_comments formatter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GraphQL review-thread formatter _format_pr_comments had no call site anywhere in the codebase or tests. Remove its definition (client_pr_helpers.py:408-434), its __all__ entry (client_pr_helpers.py:477), and the backward-compat re-export import and __all__ entry in client_pr.py (lines 17 and 317) as one atomic change — ruff selects pyflakes (F822), so the definition and the exports must go together. The five live siblings (_get_comment_resolved_map, _build_pr_status_query, _parse_pr_status_response, _parse_check_contexts, _format_pr_comments_from_rest) are unchanged. CHANGELOG Unreleased gains a Removed note. Dz-Task-Id: tsk_a2b402fa733df2802883bdbd46e33a72 --- CHANGELOG.md | 1 + src/claude_task_master/github/client_pr.py | 2 -- .../github/client_pr_helpers.py | 30 ------------------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ae08cc..6146d9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - **Removed the dead public helper `get_context_window` from `claude_task_master.core`.** Defined in `core/agent_models.py`, re-exported through the `core` package facade and referenced by a docstring clause in `core/config.py`, it had no caller anywhere in the codebase, and its return value set no compaction threshold and no SDK context window — a model-to-window mapping nothing consumed. The data behind it is retained: `MODEL_CONTEXT_WINDOWS`, `MODEL_CONTEXT_WINDOWS_STANDARD`, `DEFAULT_COMPACT_THRESHOLD_PERCENT` and `ContextWindowsConfig` are unchanged; only the unreachable accessor and the text naming it are deleted. +- **Removed the dead `_format_pr_comments` GraphQL formatter (`github/client_pr_helpers.py`).** The REST path `_format_pr_comments_from_rest` is the only PR-comment formatter with a caller; the GraphQL variant had no call site anywhere in the codebase and no test references it. Removed together with its entry in both `__all__` lists (`client_pr_helpers.py` and `client_pr.py`) and the corresponding `client_pr` backward-compat re-export; the five live sibling helpers are unchanged. ### Fixed diff --git a/src/claude_task_master/github/client_pr.py b/src/claude_task_master/github/client_pr.py index 9c8c28e..4a6b325 100644 --- a/src/claude_task_master/github/client_pr.py +++ b/src/claude_task_master/github/client_pr.py @@ -14,7 +14,6 @@ from .client_pr_helpers import ( # noqa: F401 — re-exported for backward compat _build_pr_status_query, - _format_pr_comments, _format_pr_comments_from_rest, _get_comment_resolved_map, _parse_check_contexts, @@ -314,6 +313,5 @@ def get_pr_comments( "_build_pr_status_query", "_parse_pr_status_response", "_parse_check_contexts", - "_format_pr_comments", "_format_pr_comments_from_rest", ] diff --git a/src/claude_task_master/github/client_pr_helpers.py b/src/claude_task_master/github/client_pr_helpers.py index c7e280e..6b688bd 100644 --- a/src/claude_task_master/github/client_pr_helpers.py +++ b/src/claude_task_master/github/client_pr_helpers.py @@ -405,35 +405,6 @@ def _parse_check_contexts(contexts: list[dict[str, Any]]) -> list[dict[str, Any] return check_details -def _format_pr_comments(threads: list[dict[str, Any]], only_unresolved: bool) -> str: - """Format PR review threads into a readable string. - - Args: - threads: List of review thread nodes. - only_unresolved: If True, only include unresolved threads. - - Returns: - Formatted string of comments. - """ - formatted = [] - for thread in threads: - if only_unresolved and thread["isResolved"]: - continue - - for comment in thread["comments"]["nodes"]: - # GraphQL author is null for ghost/deleted accounts. - author = (comment.get("author") or {}).get("login") or "unknown" - is_bot = author.endswith("[bot]") - bot_marker = " (bot)" if is_bot else "" - - formatted.append( - f"**{author}{bot_marker}** on {comment.get('path', 'PR')}:" - f"{comment.get('line', 'N/A')}\n{comment['body']}\n" - ) - - return "\n---\n\n".join(formatted) - - def _format_pr_comments_from_rest( comments: list[dict[str, Any]], resolved_map: dict[int, bool], only_unresolved: bool ) -> str: @@ -474,6 +445,5 @@ def _format_pr_comments_from_rest( "_build_pr_status_query", "_parse_pr_status_response", "_parse_check_contexts", - "_format_pr_comments", "_format_pr_comments_from_rest", ]