Skip to content

fix(scm-github): cover 18-check CI in GraphQL batch#1971

Open
whoisasx wants to merge 1 commit into
mainfrom
feat/1969
Open

fix(scm-github): cover 18-check CI in GraphQL batch#1971
whoisasx wants to merge 1 commit into
mainfrom
feat/1969

Conversation

@whoisasx

Copy link
Copy Markdown
Contributor

Fixes #1969

Summary

  • Add a CI_CONTEXTS_FIRST constant set to 20 for GitHub GraphQL batch PR enrichment.
  • Use the new limit in statusCheckRollup.contexts(first: ...) so AO's current 18-check CI fits in the batch response.
  • Keep pageInfo.hasNextPage handling so repos with more than 20 contexts still fall back to REST for complete details.
  • Update comments and unit tests to reflect the bounded 20-context page.

Tests

  • pnpm --filter @aoagents/ao-core build && pnpm --filter @aoagents/ao-plugin-scm-github test -- graphql-batch.test.ts
  • pnpm build
  • pnpm typecheck
  • pnpm lint (passes with existing warnings)
  • pnpm test (fails on existing/unrelated environment-sensitive tests: notifier-desktop integration expectations on macOS with terminal-notifier, and canonicalCompareKey > expands ~ to HOME path normalization)

@github-actions

Copy link
Copy Markdown
Contributor

Test Coverage Report

Changed files have no coverage data (not instrumented or no tests ran).

@greptile-apps

greptile-apps Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a GraphQL batch enrichment bug where AO's 18-check CI pipeline exceeded the previous contexts(first: 11) cap, causing all individual check details to be silently dropped and forcing an unnecessary REST fallback on every PR. The fix extracts the limit into a named constant (CI_CONTEXTS_FIRST = 20) and wires it into the query template, while the existing pageInfo.hasNextPage guard ensures repos with more than 20 contexts still fall back to REST safely.

  • New constant CI_CONTEXTS_FIRST = 20 is exported from graphql-batch.ts and interpolated into PR_FIELDS at module load time, giving clear visibility into the per-PR context budget and making the value testable by name.
  • Test suite updated to import the constant, assert the generated query contains the correct contexts(first: 20) fragment, and rename the constants describe block to "GraphQL batch sizing constants" for clarity.

Confidence Score: 5/5

Safe to merge — the change raises a context fetch limit that was silently dropping check details, and the existing REST fallback guards correctness for any repo that exceeds the new limit.

The change is narrowly scoped: one new named constant, one template interpolation, and corresponding test updates. The pageInfo.hasNextPage guard that triggers the REST fallback was already in place and is untouched, so repos with more than 20 CI contexts remain correct. No logic paths are removed or bypassed.

No files require special attention.

Important Files Changed

Filename Overview
packages/plugins/scm-github/src/graphql-batch.ts Introduces CI_CONTEXTS_FIRST = 20 constant and substitutes it into the GraphQL template; preserves pageInfo.hasNextPage REST fallback; updates inline comments for accuracy.
packages/plugins/scm-github/test/graphql-batch.test.ts Imports and asserts CI_CONTEXTS_FIRST, adds a query-generation assertion for contexts(first: 20), renames/updates test descriptions to match new behaviour, and refreshes stale fixture comments.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[GraphQL batch query\ncontexts first: CI_CONTEXTS_FIRST=20] --> B{pageInfo.hasNextPage?}
    B -- false\ncomplete page --> C[parseCheckContexts\nreturn ciChecks]
    B -- true\ntruncated --> D[ciChecks = undefined]
    D --> E[maybeDispatchCIFailureDetails\nfalls back to REST getCIChecks]
    C --> F[Use ciChecks directly\nno REST call needed]
Loading

Reviews (2): Last reviewed commit: "fix(scm-github): cover 18-check CI in Gr..." | Re-trigger Greptile

Comment thread packages/plugins/scm-github/src/graphql-batch.ts
Raise the bounded statusCheckRollup context page to 20 so normal AO PRs include individual CI details without REST fallback, while preserving hasNextPage fallback for larger repos.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the GitHub SCM plugin’s GraphQL batch PR enrichment query to request a larger (but still bounded) page of CI check contexts so AO’s current 18-check CI fits within the initial batch response, reducing unnecessary REST fallback for typical PRs.

Changes:

  • Introduces and exports CI_CONTEXTS_FIRST = 20 as the bounded per-PR CI context page size.
  • Updates the GraphQL batch query to use statusCheckRollup.contexts(first: ${CI_CONTEXTS_FIRST}) instead of a hardcoded smaller value.
  • Adjusts unit tests and comments to reflect the new bounded 20-context behavior and its truncation fallback semantics.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/plugins/scm-github/src/graphql-batch.ts Adds CI_CONTEXTS_FIRST and applies it to the GraphQL batch query’s statusCheckRollup.contexts(first: ...) selection, with updated explanatory comments.
packages/plugins/scm-github/test/graphql-batch.test.ts Updates tests to assert the query includes the new contexts(first: ${CI_CONTEXTS_FIRST}) and adds coverage for the new sizing constant.

@whoisasx whoisasx requested a review from yyovil May 21, 2026 07:57
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.

increase GraphQL batch CI context limit for 18-check PRs

2 participants