Skip to content

feat: switch issue-comments fetch to GraphQL with isMinimized filter - #150

Merged
twistedmelonman merged 2 commits into
mainfrom
claude/feat-scraper-skip-minimized-20260501
May 2, 2026
Merged

twistedmelonman merged 2 commits into
mainfrom
claude/feat-scraper-skip-minimized-20260501

Conversation

@twistedmelonman

Copy link
Copy Markdown
Owner

Summary

Coordinating change to smartwatermelon/github-workflows#83 (tracking issue: #82). That upstream PR taught the CI claude-blocking-review workflow to call GraphQL minimizeComment(classifier: RESOLVED) on its own PASS comment after posting it, so PASS comments end up collapsed in the PR thread (audit trail preserved, visual noise reduced).

However, scripts/post-push-status.sh was still fetching issues/comments via the REST API, and the REST endpoint does not return isMinimized — that field is GraphQL-only. The result: the scraper kept surfacing those minimized PASS comments as FINDING lines, polluting the post-push loop with phantom findings.

What changed

  • New _fetch_issue_comments_gql helper that:
    • Issues a GraphQL pullRequest.comments(last: 100) query selecting body, createdAt, isMinimized, and author { __typename, login }.
    • Uses --jq to filter out minimized comments (select(.isMinimized == false)) and reshape GraphQL nodes into the REST-compatible JSON shape (user.login, created_at, body, path, line) the existing python parser already expects.
    • Re-appends [bot] to Bot-typename logins (GraphQL strips it), so BOT_PATTERN (claude\[bot\]|sentry\[bot\]|coderabbit\[bot\]) keeps matching.
    • Falls back to [] on any failure (matches _safe_api_array semantics).
  • Replaces the single _safe_api_array "repos/.../issues/<N>/comments" call with the new helper.
  • No python parser changes — the jq projection makes the GraphQL output drop in transparently.

Why pulls/comments stays on REST

Pulls/comments are inline diff review comments — they're typically real findings (e.g., from sentry[bot]), they're not subject to the new minimization workflow, and the REST shape works fine. Switching that path too would be churn without benefit.

Test plan

  • bash -n scripts/post-push-status.sh — clean
  • shellcheck -S info scripts/post-push-status.sh scripts/tests/test-post-push-status.sh — zero findings
  • bash scripts/tests/test-post-push-status.sh — 17/17 pass (added 1 new assertion: assert_not_contains "minimized PASS comment dropped" "VERDICT: PASS"). The test mock now extracts --jq from the call's argv and pipes the raw GraphQL response through the real production filter via jq -c, so the test exercises the actual projection (Bot→<login>[bot] reshape + minimized drop) rather than baking that behavior into the fixtures.
  • Smoke test against PR refactor(run-review): parallelize reviewers, CLI preflight, cache versioning, remove dead detection #128 (real-world: contains a minimized claude[bot] PASS comment): baseline produced 3 findings (2 sentry[bot] inline + 1 claude[bot] PASS); after fix, produces 2 findings (PASS correctly skipped, real findings preserved).
  • Smoke test against PR feat: add commit message context to chunked code reviewer #149 (un-minimized claude[bot] PASS): still surfaces correctly — proves Bot login reconstruction works and we don't break the un-minimized path.
  • Pre-commit + pre-push reviewers (code-reviewer, adversarial-reviewer, codebase reviewer): all PASS.

🤖 Generated with Claude Code

Claude Code Bot and others added 2 commits May 1, 2026 17:13
Coordinating change to smartwatermelon/github-workflows#83, which now
minimizes PASS review comments via GraphQL minimizeComment(RESOLVED).
The REST issues/comments endpoint does not return isMinimized, so the
scraper still treated those minimized PASS comments as unresolved
findings.

Switch the issues/comments fetch to GraphQL with `isMinimized` and
filter out minimized comments via jq before the existing python parser
sees them. The jq projection reshapes GraphQL nodes into the REST-
compatible JSON shape the parser already expects, so no parser changes
are needed. Pulls/comments (inline review comments) stay on REST —
they're typically real findings and don't have the minimization
pollution issue.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous commit switched issue-comments fetch from REST to GraphQL,
but the test mock only routed REST `issues/<N>/comments` patterns. The
new GraphQL call fell through to the UNEXPECTED-call fallback, causing
`[]` to be returned and the existing SQL-injection assertion to fail.

Update the mock to detect the GraphQL comments query (by the `comments(last:`
selector in a `pullRequest(number:` operation), return raw GraphQL-shaped
JSON for PRs 42, 43, and 99, and apply the actual `--jq` filter from the
call's args to the raw response. Applying the real production projection
in the mock means the test exercises the real Bot→`<login>[bot]` login
reconstruction and the `isMinimized==false` filter, rather than baking
that behavior into the mock fixtures.

Add a new assertion that the minimized claude[bot] PASS comment in PR 42
is dropped — this is the headline behavior of the GraphQL switch and
needs explicit coverage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented May 2, 2026

Copy link
Copy Markdown

No blocking issues found. The GraphQL helper correctly reshapes PR comment nodes into the REST-compatible shape the downstream Python parser expects, the [bot]-suffix reconstruction matches BOT_PATTERN, and all failure paths (network error, malformed response, non-array result) fall back to [] — same behavior as the old REST call. The comments(last: 100) limit is at least as broad as the default REST page size, so no regression there. Test mock updates accurately reflect the new GraphQL code path.

VERDICT: PASS

@twistedmelonman
twistedmelonman merged commit 4eb7987 into main May 2, 2026
4 checks passed
@twistedmelonman
twistedmelonman deleted the claude/feat-scraper-skip-minimized-20260501 branch May 2, 2026 00:25
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