Skip to content

feat(flare_git): add pr_status action for terse, resolution-aware PR review data - #268

Merged
getappz merged 5 commits into
masterfrom
feat/flare-git-pr-status
Jul 19, 2026
Merged

feat(flare_git): add pr_status action for terse, resolution-aware PR review data#268
getappz merged 5 commits into
masterfrom
feat/flare-git-pr-status

Conversation

@getappz

@getappz getappz commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a pr_status action to the flare_git MCP tool that bundles PR detail, CI check runs, review verdicts, review comments, and issue comments into one call — replacing the 4-5 separate flare_git round trips a review-and-fix loop previously needed.
  • Filters review comments against GraphQL's reviewThread.isResolved (REST has no such field) so old-but-fixed comments don't get re-surfaced as outstanding.
  • Accepts an optional since (ISO8601) that's passed to GitHub's native ?since= filter on both comment endpoints, so repeated calls only pull what's new.
  • Output is trimmed to actionable data only: passing checks collapse to a checks_ok count, reviews dedupe to the latest verdict per reviewer, and timestamps/redundant fields are dropped.

Test plan

  • cargo build, cargo clippy --workspace --all-features -- -D warnings, cargo test --workspace --all-features all clean
  • 82 unit tests under github:: (11 new: models, actions, pulls incl. GraphQL resolved-ids + since-query, issues, mcp assembly)
  • Manually smoke-tested against a real PR (fix(agent-registry): canonicalize known assignee-agent aliases (claude -> claude-code) #266) via a temporary #[ignore]d test — confirmed correct mergeable_state, failing-checks list, checks_ok count, empty unresolved/reviews, and CodeRabbit's summary comment coming through intact (test was reverted before commit, not part of the suite)

Summary by CodeRabbit

  • New Features
    • Added a pr_status action to fetch pull request details, CI check runs, reviews, review comments, and issue comments in a streamlined JSON response.
    • Added API support for listing CI check runs, pull request reviews, pull request review comments, resolved review thread IDs, and general issue comments.
    • Added optional time-based filtering for returned comments (via since).
    • Enhanced pull request data coverage (e.g., draft/mergeability, additions/deletions, and head/base references).
  • Documentation
    • Updated tool descriptions and request schema to document pr_status inputs and comment filtering behavior.

getappz added 2 commits July 19, 2026 22:42
…ents

Review-and-fix loops previously needed separate pr_get, run_list, and
raw comment/review API calls per PR. pr_status fetches PR detail, CI
check runs, review verdicts (incl. bot reviewers like CodeRabbit),
line comments, and issue-level comments in one MCP round trip, and
returns a single JSON payload.

Known limitation: the REST API has no isResolved field for review
threads (GraphQL-only), so review_comments includes resolved threads
too -- callers should use judgment on older/superseded ones.
Two problems with the first pass: REST has no thread-resolution field
at all (only GraphQL's reviewThread.isResolved), so old-but-fixed
review comments were indistinguishable from live ones; and every call
re-fetched full comment history with no way to ask for just what's
new.

- pulls::resolved_review_comment_ids: GraphQL lookup of resolved
  review-thread comment ids; pr_status filters review_comments against
  it so only unresolved (still-outstanding) ones survive.
- since (ISO8601) on GitHubRequest, threaded into the REST comment
  fetches (both support ?since= server-side) so repeated pr_status
  calls only pull what's new since the caller's last check.
- Output trimmed to what a fix loop actually needs: passing checks
  become a count instead of a list, reviews dedupe to one entry (the
  latest) per reviewer, and timestamps/html_url/redundant fields are
  dropped entirely.
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: da7c698c-ed6b-4126-b75b-effb40d50486

📥 Commits

Reviewing files that changed from the base of the PR and between 6989cf6 and afbd2ea.

📒 Files selected for processing (5)
  • src/github/actions.rs
  • src/github/models.rs
  • src/github/pulls.rs
  • src/mcp_server/flare_git.rs
  • src/mcp_server/types.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/mcp_server/types.rs
  • src/github/actions.rs
  • src/github/pulls.rs
  • src/mcp_server/flare_git.rs
  • src/github/models.rs

📝 Walkthrough

Walkthrough

Adds GitHub models and endpoints for pull request checks, reviews, review comments, resolved threads, and issue comments. Adds status JSON aggregation and exposes the combined data through the MCP pr_status action with optional time filtering.

Changes

Pull request status

Layer / File(s) Summary
Status data models
src/github/models.rs
Extends PullRequest and adds typed models for checks, reviews, review comments, comments, users, and refs, with tests for optional GitHub fields.
GitHub status retrieval
src/github/actions.rs, src/github/issues.rs, src/github/pulls.rs
Adds paginated REST APIs for checks, reviews, review comments, and issue comments, plus GraphQL retrieval of resolved review comment IDs and request-path/error tests.
Status JSON aggregation
src/github/mcp.rs
Builds a trimmed JSON payload with passing-check counts, non-passing checks, latest reviews, unresolved comments, and simplified issue comments.
MCP action integration
src/mcp_server/flare_git.rs, src/mcp_server/types.rs, src/mcp_server.rs
Registers the pr_status request shape and dispatches its GitHub lookups using the optional since timestamp before serializing the result.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MCPClient
  participant flare_git_impl
  participant GitHubAPI
  participant pr_status_json
  MCPClient->>flare_git_impl: pr_status(number, since)
  flare_git_impl->>GitHubAPI: Fetch PR, checks, reviews, and comments
  GitHubAPI-->>flare_git_impl: Return status data and resolved IDs
  flare_git_impl->>pr_status_json: Aggregate status data
  pr_status_json-->>MCPClient: Return serialized PR status
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds flare_git pr_status APIs, but linked issue #39 requires typed error wiring in auth/auth_runner instead. Either implement the typed-error/auth/auth_runner work from #39 or move this unrelated pr_status feature to a separate PR.
Out of Scope Changes check ⚠️ Warning The pr_status feature set is unrelated to linked issue #39, so these additions appear out of scope for this branch. Split pr_status into a separate PR and keep this branch focused on the typed-error/auth/auth_runner work from #39.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the new pr_status action and its PR review data focus.
Description check ✅ Passed The description covers the summary and test plan well, and only omits the non-critical Notes for reviewers section.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/flare-git-pr-status

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/github/pulls.rs (2)

106-145: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Silent truncation risk in the resolved-thread GraphQL query.

reviewThreads(first:100) / comments(first:50) caps are documented as an accepted tradeoff, but the query never requests pageInfo, so hitting the cap is undetectable. For a PR with more than 100 review threads (or >50 comments in one thread), already-resolved comments beyond the cap silently fall out of resolved_ids, causing them to reappear as "unresolved" in pr_status output.

Requesting pageInfo { hasNextPage } on reviewThreads (and ideally on comments) is a small addition that would let callers at least detect/log truncation, ahead of implementing real cursor pagination.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/github/pulls.rs` around lines 106 - 145, The resolved_review_comment_ids
GraphQL query cannot detect when its reviewThreads or per-thread comments limits
truncate results. Add pageInfo { hasNextPage } to both reviewThreads and
comments, then inspect those flags after parsing and surface truncation through
the existing error/logging mechanism available to this function, while
preserving the current resolved-ID collection behavior.

87-105: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Same since-filtered pagination pattern duplicated across pulls.rs and issues.rs. Both functions repeat an identical "conditionally append ?since=..., then paginate and parse" sequence; the shared root cause is the lack of a common helper for optional-since paginated GETs.

  • src/github/pulls.rs#L87-L105: extract the since-append + get_paginated + serde_json::from_value sequence in list_review_comments into a shared helper.
  • src/github/issues.rs#L72-L91: reuse the same helper in list_comments instead of duplicating the sequence.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/github/pulls.rs` around lines 87 - 105, Extract the shared optional-since
paginated GET and JSON parsing flow from list_review_comments in
src/github/pulls.rs (lines 87-105) into a common helper, preserving query
encoding and GitHubError parsing. Update list_comments in src/github/issues.rs
(lines 72-91) to reuse that helper instead of duplicating the sequence; both
sites require these changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/github/pulls.rs`:
- Around line 106-145: The resolved_review_comment_ids GraphQL query cannot
detect when its reviewThreads or per-thread comments limits truncate results.
Add pageInfo { hasNextPage } to both reviewThreads and comments, then inspect
those flags after parsing and surface truncation through the existing
error/logging mechanism available to this function, while preserving the current
resolved-ID collection behavior.
- Around line 87-105: Extract the shared optional-since paginated GET and JSON
parsing flow from list_review_comments in src/github/pulls.rs (lines 87-105)
into a common helper, preserving query encoding and GitHubError parsing. Update
list_comments in src/github/issues.rs (lines 72-91) to reuse that helper instead
of duplicating the sequence; both sites require these changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 23da1fe5-31e7-494e-8003-8ef7f5e0becc

📥 Commits

Reviewing files that changed from the base of the PR and between d3ce544 and 6989cf6.

📒 Files selected for processing (8)
  • src/github/actions.rs
  • src/github/issues.rs
  • src/github/mcp.rs
  • src/github/models.rs
  • src/github/pulls.rs
  • src/mcp_server.rs
  • src/mcp_server/flare_git.rs
  • src/mcp_server/types.rs

@getappz
getappz merged commit 3415dbe into master Jul 19, 2026
12 checks passed
@getappz
getappz deleted the feat/flare-git-pr-status branch July 19, 2026 18:55
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.

1 participant