Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISL: gh: Field 'mergeQueueEntry' doesn't exist on type 'PullRequest' #906

Open
xEtherealx opened this issue Jun 19, 2024 · 5 comments
Open

Comments

@xEtherealx
Copy link

I'm seeing the error gh: Field 'mergeQueueEntry' doesn't exist on type 'PullRequest' when viewing ISL.

I think this is because my enterprise GH version (3.10) doesn't support this field, as it looks to be introduced in 3.12. I saw similar issues filed to the GH pull requests extension, and they worked around it somehow -- I'm guessing by using different/legacy query fields.

Failed to fetch Diffs
Command failed with exit code 1: gh api graphql -f searchQuery=repo:... is:pr author:@me -F numToFetch=50 --hostname github.robot.car -f query= query YourPullRequestsQuery($searchQuery: String!, $numToFetch: Int!) { search(query: $searchQuery, type: ISSUE, first: $numToFetch) { nodes { ... on PullRequest { __typename number title body state isDraft url reviewDecision comments { totalCount } mergeQueueEntry { estimatedTimeToMerge } commits(last: 1) { nodes { commit { statusCheckRollup { state } } } } } } } } gh: Field 'mergeQueueEntry' doesn't exist on type 'PullRequest' {"errors":[{"path":["query YourPullRequestsQuery","search","nodes","... on PullRequest","mergeQueueEntry"],"extensions":{"code":"undefinedField","typeName":"PullRequest","fieldName":"mergeQueueEntry"},"locations":[{"line":17,"column":9}],"message":"Field 'mergeQueueEntry' doesn't exist on type 'PullRequest'"}]}
Error: Command failed with exit code 1: gh api graphql -f searchQuery=repo:... is:pr author:@me -F numToFetch=50 --hostname github.robot.car -f query=
    query YourPullRequestsQuery($searchQuery: String!, $numToFetch: Int!) {
  search(query: $searchQuery, type: ISSUE, first: $numToFetch) {
    nodes {
      ... on PullRequest {
        __typename
        number
        title
        body
        state
        isDraft
        url
        reviewDecision
        comments {
          totalCount
        }
        mergeQueueEntry {
          estimatedTimeToMerge
        }
        commits(last: 1) {
          nodes {
            commit {
              statusCheckRollup {
                state
              }
            }
          }
        }
      }
    }
  }
}
    
gh: Field 'mergeQueueEntry' doesn't exist on type 'PullRequest'
{"errors":[{"path":["query YourPullRequestsQuery","search","nodes","... on PullRequest","mergeQueueEntry"],"extensions":{"code":"undefinedField","typeName":"PullRequest","fieldName":"mergeQueueEntry"},"locations":[{"line":17,"column":9}],"message":"Field 'mergeQueueEntry' doesn't exist on type 'PullRequest'"}]}
    at makeError (/home/russ.brennan/.vscode-server/extensions/node_modules/execa/lib/error.js:60:11)
    at /home/russ.brennan/.vscode-server/extensions/node_modules/execa/index.js:118:26
    at process.stdout (node:internal/process/task_queues:95:5)
    at allSummaries (/home/russ.brennan/.vscode-server/extensions/isl-server/src/github/queryGraphQL.ts:42:12)
    at /home/russ.brennan/.vscode-server/extensions/isl-server/src/github/githubCodeReviewProvider.ts:78:15
@skrud
Copy link

skrud commented Jun 26, 2024

I’m seeing this as well.

@luyiyang16
Copy link

luyiyang16 commented Jul 5, 2024

+1 I am seeing in on GHE3.7 and 3.9. Could we please have a workaround if not able to upgrading GHE version?

@zhuhan1
Copy link

zhuhan1 commented Jul 24, 2024

I'm also seeing this, and it's not possible for me to upgrade GHE.

@alex-statsig
Copy link
Contributor

Same issue as #830. I can try and contribute a fix for this

alex-statsig added a commit to alex-statsig/sapling that referenced this issue Jul 25, 2024
Summary:
facebook#830 and facebook#906 reported sapling not working for old Github Enterprise versions since their graphql schema doesnt include merge queue.

This adds a query to detect if merge queue is supported in the graphql version. Then, it will issue a different "YourPullRequestsQuery" depending on if merge queue is supported.

I considered a few other approaches:
- Just detect the error message and retry without merge queue field - a little gross to extract from the error
- Use "@include" instead of an entirely separate query - didn't seem to count as a valid query still via graphiql at least (unsure if the query client here would strip out the unused field though)

Test Plan:
Haven't had a chance to test yet, will try and validate that both versions work and that the detection logic works.
facebook-github-bot pushed a commit that referenced this issue Jul 25, 2024
Summary:
Fix handling of GHE without merge queue support
#830 and #906 reported sapling not working for old Github Enterprise versions since their graphql schema doesnt include merge queue.

This adds a query to detect if merge queue is supported in the graphql version. Then, it will issue a different "YourPullRequestsQuery" depending on if merge queue is supported.

I considered a few other approaches:
- Just detect the error message and retry without merge queue field - a little gross to extract from the error
- Use "include" instead of an entirely separate query - didn't seem to count as a valid query still via graphiql at least (unsure if the query client here would strip out the unused field though)

Pull Request resolved: #926

Test Plan: Haven't had a chance to test yet, will try and validate that both versions work and that the detection logic works.

Reviewed By: evangrayk

Differential Revision: D60215245

fbshipit-source-id: cb36a77fbe0665353740d7fa97bc21ee9c86e0e8
@evangrayk
Copy link
Contributor

The attached PR is now in sapling-scm VS Code extension version 0.1.54 release, please let me know if this fix works for folks using GHE affected by this!

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

No branches or pull requests

7 participants
@skrud @evangrayk @xEtherealx @zhuhan1 @alex-statsig @luyiyang16 and others