fix(github_graphql): set the merged flag on pull requests - #9087
Closed
zyv4yk wants to merge 1 commit into
Closed
Conversation
The GraphQL extractor filled MergedAt, MergedBy and MergeCommit but never Merged, so every pull request collected through GraphQL is stored with merged = false, including the merged ones. apache#8573 fixed the same gap on the REST side; the GraphQL extractor was not part of it. The flag is derived from mergedAt, which GitHub sets exactly when a pull request is merged, so rows already sitting in the raw layer are repaired by re-running the extractor and no re-collect is needed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Author
|
Closing this one — the domain layer does not read this column today ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pr-type/bug-fix,pr-type/feature-development, etc.Summary
_tool_github_pull_requests.mergedisfalsefor every pull request collected through GraphQL, merged ones included.convertGithubPullRequestinbackend/plugins/github_graphql/tasks/pr_extractor.gofillsMergedAt,MergedByandMergeCommitSha, but neverMerged, so the column keeps its zero value:#8573 closed the same gap on the REST side — it added
Merged: pull.Mergedtoplugins/github/tasks/pr_extractor.go— but the GraphQL extractor was not part of that change, so a connection running on GraphQL still stores the flag asfalse.The flag is derived from
mergedAtrather than collected as a separatemergedfield, for a practical reason:mergedAtis already present in_raw_github_graphql_prsfor existing installs, so re-running the extractor repairs rows that are already collected. Queryingmergedwould only fix data going forward and would need a full re-collect for the rest.The two are equivalent by construction — GitHub sets
mergedAtexactly when a pull request is merged. Checked against the API over the 50 most recent pull requests ingrafana/grafana(18 merged): zero rows wherebool(merged) != (mergedAt != null).Does this close any open issues?
No open issue. It is the GraphQL half of #8571, which was closed by #8573 for the REST collector only.
Other Information
Impact is limited today because the domain layer does not read this column for status:
pr_convertor.gocomputesStatusfrompr.State == "MERGED" || (pr.State == "closed" && (pr.Merged || pr.MergedAt != nil)), and the GraphQL state is alreadyMERGED. Any consumer that reads_tool_github_pull_requests.mergeddirectly, or any future query that keys onmerged = true, gets nothing for GraphQL-collected data.go build,go vetandgolangci-lint run ./plugins/github_graphql/...are clean.pr_extractor_test.gocovers merged, closed-unmerged and open. Thee2epackage needsE2E_DB_URLand was not run locally; the onlygithub_graphqle2e fixture covers deployments, which this PR does not touch.I do not have permission to set labels; this is
pr-type/bug-fix.