Skip to content

fix(forge/github): sanitize gql query docs based on gated feature compatibility - #3178

Open
setchy wants to merge 4 commits into
mainfrom
fix/gh-gql-gated-directive-with-sanitizing
Open

fix(forge/github): sanitize gql query docs based on gated feature compatibility#3178
setchy wants to merge 4 commits into
mainfrom
fix/gh-gql-gated-directive-with-sanitizing

Conversation

@setchy

@setchy setchy commented Aug 13, 2026

Copy link
Copy Markdown
Member

Fixes: #3174 (attempt two 😅)

GHES doesn't expose PullRequest.stackEntry (or Discussion.isAnswered before 3.12).

The old @include(if:) guard didn't help, since GraphQL Servers will validate the query document field names regardless of client-side directives, and rejected the unused variable, breaking PR enrichment for all GHE users.

This adds a custom @gated(requires: "...") directive, marks the two fields with it, and strips unsupported fields (plus the directive) from the query before sending via stripGatedSelections().

@include/@skip only affect execution, so physically removing the selection is the only reliable fix; the directive keeps it declarative in the sources and codegen still types the fields.

…patibility

Signed-off-by: Adam Setch <adam.setch@outlook.com>
@setchy
setchy requested a review from afonsojramos as a code owner August 13, 2026 13:39
@setchy
setchy marked this pull request as draft August 13, 2026 13:41
@setchy
setchy marked this pull request as ready for review August 13, 2026 13:41
@github-actions github-actions Bot added bug Something isn't working forge:github GitHub Cloud, GitHub Enterprise labels Aug 13, 2026
@sonarqubecloud

Copy link
Copy Markdown

@setchy

setchy commented Aug 14, 2026

Copy link
Copy Markdown
Member Author

@sphinxrave - if you have a moment, we would appreciate if you could test the build from this branch. Should resolve the GHE stacked issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working forge:github GitHub Cloud, GitHub Enterprise

Development

Successfully merging this pull request may close these issues.

GitHub Enterprise: PR enrichment fails because PullRequest.stackEntry is queried unconditionally in 7.3.x

1 participant