dosubot[bot] commented on issue #8571: URL: https://github.com/apache/incubator-devlake/issues/8571#issuecomment-3284537591
<!-- Answer --> The root cause is that DevLake's GitHub PR ingestion code does not set the merged boolean field from the GitHub API response. Both the REST and GraphQL extractors map the state and merged_at fields, but the merged field in the _tool_github_pull_requests table is always left at its default (false) unless explicitly set. This means merged PRs are stored as closed with merged = false, even when the API reports merged = true, which matches your observations. The relevant code is in backend/plugins/github/tasks/pr_extractor.go and backend/plugins/github_graphql/tasks/pr_extractor.go, specifically in the convertGithubPullRequest functions, which do not assign the merged field from the API response. No recent PRs or docs address this bug, so a patch is needed to set merged = true when the API's merged property is true or merged_at is present. You can review the mapping logic here: [github/tasks/pr_extractor.go](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/plugins/github/tasks/pr_extractor.go) [github_graphql/tasks/pr_extractor.go](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/plugins/github_graphql/tasks/pr_extractor.go) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/89593fc5-4e91-428c-a689-ed1bc2a832c3?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/89593fc5-4e91-428c-a689-ed1bc2a832c3?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/89593fc5-4e91-428c-a689-ed1bc2a832c3?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/89593fc5-4e91-428c-a689-ed1bc2a832c3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/89593fc5-4e91-428c-a689-ed1bc2a832c3?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/89593fc5-4e91-428c-a689-ed1bc2a832c3?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/89593fc5-4e91-428c-a689-ed1bc2a832c3?feedback_type=other)</sup> [](https://app.dosu.dev/b4e8e847-d479-4541-83a8-d88d83fea5c9/ask?utm_source=githu b) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-devlake/issues/8571) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
