Skip to content

fix: apply _check_graphql_errors to query paths#168

Merged
ichoosetoaccept merged 1 commit intomainfrom
02-17-fix-apply-_check_graphql_errors-to-query-paths
Feb 17, 2026
Merged

fix: apply _check_graphql_errors to query paths#168
ichoosetoaccept merged 1 commit intomainfrom
02-17-fix-apply-_check_graphql_errors-to-query-paths

Conversation

@ichoosetoaccept
Copy link
Member

@ichoosetoaccept ichoosetoaccept commented Feb 17, 2026

Apply _check_graphql_errors to the two GraphQL query paths that were missing error checks: _fetch_raw_threads and _fetch_thread_detail.

Previously, these functions silently swallowed GraphQL-level errors (e.g. auth failures, rate limits) because they only checked for data in the response without validating the errors field. Now both paths raise GhError with a descriptive message.

Changes

  • _fetch_raw_threads: added _check_graphql_errors after the paginated GraphQL call
  • _fetch_thread_detail: added _check_graphql_errors after the thread detail query
  • Tests: 3 new tests covering error and success paths

Fixes #145

@greptile-apps
Copy link

greptile-apps bot commented Feb 17, 2026

Greptile Summary

Added missing GraphQL error checks to _fetch_raw_threads and _fetch_thread_detail functions using _check_graphql_errors. This prevents silently swallowing GraphQL-level errors like auth failures and rate limits. The change ensures both query paths now properly raise GhError with descriptive messages when GraphQL returns errors.

  • Added _check_graphql_errors call in _fetch_raw_threads after the paginated GraphQL query (line 432)
  • Added _check_graphql_errors call in _fetch_thread_detail after the thread detail query (line 605)
  • Comprehensive test coverage added with 3 tests covering both error and success scenarios
  • Tests properly validate error messages and successful data flow

Confidence Score: 5/5

  • This PR is safe to merge with no concerns
  • The changes are minimal, well-tested, and follow the existing error handling pattern used elsewhere in the codebase. The fix addresses a real bug where GraphQL errors were being silently ignored, and the implementation correctly applies the existing _check_graphql_errors helper that's already used in other GraphQL calls in the same file
  • No files require special attention

Important Files Changed

Filename Overview
src/codereviewbuddy/tools/comments.py Added _check_graphql_errors calls to _fetch_raw_threads and _fetch_thread_detail to properly handle GraphQL errors
tests/test_comments.py Added comprehensive test coverage with 3 new tests for error and success paths of the modified functions

Flowchart

flowchart TD
    A[GraphQL Query] --> B{Response Received}
    B --> C[_check_graphql_errors]
    C --> D{Errors Field Present?}
    D -->|Yes| E[Raise GhError with context]
    D -->|No| F[Extract data from response]
    F --> G[Process & return data]
    
    style E fill:#ff6b6b
    style G fill:#51cf66
    style C fill:#ffd43b
Loading

Last reviewed commit: a877d2f

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@ichoosetoaccept ichoosetoaccept force-pushed the 02-17-fix-apply-_check_graphql_errors-to-query-paths branch from 95cfa5a to a877d2f Compare February 17, 2026 10:10
@ichoosetoaccept
Copy link
Member Author

@greptileai review

Copy link
Member Author

ichoosetoaccept commented Feb 17, 2026

Merge activity

  • Feb 17, 11:17 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 17, 11:17 AM UTC: @ichoosetoaccept merged this pull request with Graphite.

@ichoosetoaccept ichoosetoaccept merged commit 74d458a into main Feb 17, 2026
11 checks passed
@ichoosetoaccept ichoosetoaccept deleted the 02-17-fix-apply-_check_graphql_errors-to-query-paths branch February 17, 2026 11:17
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.

Apply _check_graphql_errors to query paths (_fetch_raw_threads, _fetch_thread_detail)

1 participant