cedriclecoz opened a new issue, #9150:
URL: https://github.com/apache/devlake/issues/9150

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   The GitHub tool-layer pull-request records are current, but corresponding 
DevLake domain records in `pull_requests` are missing or remain `OPEN` after 
GitHub reports the PR as closed or merged.
   
   This causes incorrect dashboard data despite successful GitHub collection.
   
   Observed in two independent deployments:
   - Deployment A: 124 affected PRs across 50 repositories: 88 missing domain 
records and 36 stale OPEN records.
   - Deployment B: 479 affected PRs across 55 repositories: 421 missing domain 
records and 58 stale OPEN records.
   
   The GitHub tool record has the correct state and timestamps. The domain 
record is absent, or has `status = 'OPEN'` and no close/merge dates.
   
   ### What do you expect to happen
   
   After GitHub collection completes, every GitHub tool pull-request record 
should have a corresponding `pull_requests` domain record. Closed or merged 
GitHub PRs should not remain OPEN in the domain table, and their close/merge 
dates should be populated.
   
   A full sync should reconcile previously missing or stale domain records.
   
   ### How to reproduce
   
   This query identifies closed or merged GitHub tool records whose domain 
representation is missing or still open. Replace `[CONNECTION_ID]` with the 
GitHub connection being investigated.
   
   ```sql
   SELECT
     repo.name AS repository,
     tool_pr.number AS pull_request_number,
     tool_pr.github_id,
     tool_pr.state AS github_state,
     tool_pr.merged AS github_merged,
     tool_pr.github_updated_at,
     tool_pr.merged_at AS github_merged_at,
     tool_pr.closed_at AS github_closed_at,
     domain_pr.id AS domain_pull_request_id,
     domain_pr.status AS domain_status,
     domain_pr.original_status AS domain_original_status,
     domain_pr.merged_date AS domain_merged_date,
     domain_pr.closed_date AS domain_closed_date,
     domain_pr.updated_at AS domain_updated_at
   FROM _tool_github_pull_requests AS tool_pr
   LEFT JOIN pull_requests AS domain_pr
     ON domain_pr.id = CONCAT(
       'github:GithubPullRequest:',
       tool_pr.connection_id,
       ':',
       tool_pr.github_id
     )
   LEFT JOIN _tool_github_repos AS repo
     ON repo.connection_id = tool_pr.connection_id
     AND repo.github_id = tool_pr.repo_id
   WHERE tool_pr.connection_id = [CONNECTION_ID]
     AND (tool_pr.merged = 1 OR tool_pr.state = 'closed')
     AND (domain_pr.id IS NULL OR domain_pr.status = 'OPEN')
   ORDER BY repo.name, tool_pr.number;
   ```
   
   The expected domain ID convention is:
   
   ```text
   github:GithubPullRequest:[CONNECTION_ID]:[GITHUB_PULL_REQUEST_ID]
   ```
   
   ### Anything else
   
   ### Stale domain record
   
   ```text
   GitHub tool record
     state: closed
     merged: true
     merged_at: 2026-09-16 09:45:46
     closed_at: 2026-09-16 09:45:46
   
   Domain record
     status: OPEN
     original_status: open
     merged_date: null
     closed_date: null
     updated_at: 2026-09-16 16:24:00.910
   ```
   
   ### Missing domain record
   
   ```text
   GitHub tool record
     state: closed
     merged: true
     closed_at: 2026-09-16 20:55:37
   
   Domain record
     no row exists for 
github:GithubPullRequest:[CONNECTION_ID]:[GITHUB_PULL_REQUEST_ID]
   ```
   
   
   Question:
   
   - Is there a supported way to re-run or reconcile only the GitHub 
pull-request domain conversion stage?
   
   ### Version
   
   v1.0.3-beta17
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to