Skip to content

test(github): pagination, 51-check, rate-limit backoff, and run-id tests#123

Merged
sebyx07 merged 5 commits into
mainfrom
feat/efficiency-caching-github-client
Jul 19, 2026
Merged

test(github): pagination, 51-check, rate-limit backoff, and run-id tests#123
sebyx07 merged 5 commits into
mainfrom
feat/efficiency-caching-github-client

Conversation

@sebyx07

@sebyx07 sebyx07 commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 2-page comments: TestGetCommentResolvedMapPagination (6 tests) — verifies _get_comment_resolved_map fetches a second page using the cursor from pageInfo.endCursor, merges both pages' resolved maps, and degrades gracefully on GraphQL errors
  • 51 checks: TestPRStatusContextsPagination (4 tests) — verifies get_pr_status logs a warning when contexts.pageInfo.hasNextPage=True, counts all visible checks correctly, and handles mixed conclusions
  • rate-limit stderr→backoff: 4 new cases in TestRunGhCommandRateLimit — abuse-detection marker, too-many-requests/HTTP 429, exponential delay growth across attempts, and check=False still retries
  • mixed green/red run-id selection: TestFindFailedRunIdMixedRuns (8 tests) — verifies _find_failed_run_id picks the first failed run (not green), returns None for all-green or empty lists, treats cancelled as failed, ignores in-progress runs, and passes the current branch name to get_workflow_runs

All 28 new tests pass; 13 pre-existing failures are unchanged.

sebyx07 and others added 4 commits July 18, 2026 21:19
- Memoize `_get_repo_info` per cwd in GitHubClient to eliminate duplicate
  `gh repo view` calls; each unique working directory gets its own cache entry
- Cache branch protection rules once per CI wait in WorkflowStageHandler
  instead of re-fetching on every 10-second poll iteration
- Route all direct `subprocess.run(["gh", ...])` calls in PRContextManager
  through `self.github_client._run_gh_command()` to gain timeout support and
  consistent error handling (GitHubError instead of CalledProcessError)
- Add `timeout=` to all git subprocess calls in fix_pr.py and workflow_stages.py
  with TimeoutExpired handlers to prevent indefinite hangs
- Update tests in test_client.py, test_client_merge.py, test_pr_context.py,
  and test_ci_comments_combined.py to reflect the new routing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- client_pr.py + pr_context.py: use --jq '.[]' with --paginate → parse
  NDJSON (one object per line) instead of json.loads on concatenated pages
- ci_logs.py: paginate /jobs with --jq '.jobs[]'; parse NDJSON output
- pr_context.py: paginate GraphQL reviewThreads/contexts via pageInfo;
  clear CI/comment dirs only AFTER successful fetch (not before), so stale
  data is preserved on API failure
- pr_context.py: collect distinct run IDs from failing checks only; refuse
  "0 unresolved" when reviewThreads hasNextPage is true
- client_ci.py: scope _find_failed_run_id to current git branch; remove
  green-run fallback (only return ID for genuinely failed runs)
- ci_logs.py: anchor _is_error_line with word-bounded regex (FAILED/Failed,
  ##[error]) to eliminate false positives from substrings like FAILSAFE
- Tests: update all mocks to NDJSON format; add preserve-on-failure and
  clear-after-success tests for both CI and comments paths

Co-Authored-By: Claude <noreply@anthropic.com>
- client.py _run_gh_command: detect 403/429 (primary/secondary/abuse),
  honor Retry-After, exponential backoff + equal jitter, bounded retries.
- pr_context: batch aliased resolveReviewThread mutations (per-thread
  fallback) in post_comment_replies + resolve_addressed_threads.
- resolve_addressed_threads: only auto-resolve bot-last threads; prune
  human-reopened threads from the addressed set so feedback re-surfaces.
- save_pr_comments: fetch /issues/{n}/comments conversation feedback that
  was previously invisible to the pipeline.
- state_pr: add unmark_threads_addressed for pruning.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- TestGetCommentResolvedMapPagination: 6 tests covering 2-page cursor
  pagination in _get_comment_resolved_map (including integration with
  get_pr_comments and graceful error handling)
- TestPRStatusContextsPagination: 4 tests for get_pr_status with
  hasNextPage=True on CI contexts (51 checks warning, count correctness,
  mixed conclusions)
- TestFindFailedRunIdMixedRuns: 8 tests for _find_failed_run_id with
  mixed green/red/cancelled/in-progress runs; verifies no green fallback
  and branch scoping
- TestRunGhCommandRateLimit +4: abuse detection, too-many-requests,
  exponential delay growth, and check=False retry coverage

Co-Authored-By: Claude <noreply@anthropic.com>
@sebyx07 sebyx07 added the claudetm PRs created by Claude Task Master label Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 11 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 6fb0ce1f-5295-4291-b6fa-2f86b0c8c54e

📥 Commits

Reviewing files that changed from the base of the PR and between 3de84d8 and ec164c1.

📒 Files selected for processing (17)
  • src/claude_task_master/cli_commands/fix_pr.py
  • src/claude_task_master/core/pr_context.py
  • src/claude_task_master/core/state_pr.py
  • src/claude_task_master/core/workflow_stages.py
  • src/claude_task_master/github/ci_logs.py
  • src/claude_task_master/github/client.py
  • src/claude_task_master/github/client_ci.py
  • src/claude_task_master/github/client_pr.py
  • tests/core/test_ci_comments_combined.py
  • tests/core/test_pr_context.py
  • tests/core/test_state_pr_context.py
  • tests/github/test_ci_logs.py
  • tests/github/test_client.py
  • tests/github/test_client_ci.py
  • tests/github/test_client_errors.py
  • tests/github/test_client_merge.py
  • tests/github/test_client_pr.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/efficiency-caching-github-client

Comment @coderabbitai help to get the list of available commands.

@blacksmith-sh

This comment has been minimized.

CI failures were all stale test mocks not matching this PR's new
GitHubClient behavior:

- get_pr_comments tests: emit NDJSON (as `gh api --paginate --jq '.[]'`
  does) instead of a single JSON array, which parsed to `[[...]]`.
- get_failed_run_logs tests: mock the `git rev-parse` branch-detection
  call added by branch-scoped run lookup; no-failed case now reports
  "No workflow runs found" (green fallback removed).
- rate-limit test: patch time.sleep/console.warning so the backoff
  retry loop runs instantly instead of hitting the pytest timeout.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sebyx07
sebyx07 merged commit 082ca4c into main Jul 19, 2026
11 checks passed
@sebyx07
sebyx07 deleted the feat/efficiency-caching-github-client branch July 19, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudetm PRs created by Claude Task Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant