chenwei791129 opened a new pull request, #9183: URL: https://github.com/apache/devlake/pull/9183
### Summary `calculateDeploymentCommitsDiff` skips pairs already recorded in `_tool_refdiff_finished_commits_diffs`. For a deployment commit without a previous successful deployment, the `LEFT JOIN` yields `p.commit_sha = NULL`, but the finished pair is stored with an empty `old_commit_sha` (the column is `NOT NULL`). The guard `fcd.old_commit_sha = p.commit_sha` then evaluates `'' = NULL`, which is never true, so every such pair is selected and recalculated against the full commit history **on every run**. On projects with many deploy jobs that never ran (e.g. GitLab manual jobs left `blocked`), this turns the subtask into hours of repeated work every day. The details and numbers are in the linked issue. Changes: - Compare against `COALESCE(p.commit_sha, '')` so pairs without a previous successful deployment are recognised as finished. `COALESCE` is only applied to the outer value, so the primary key `(new_commit_sha, old_commit_sha)` is still usable, and the syntax works on both MySQL and PostgreSQL. - Extend `TestDeploymentCommitDiffDataFlow` with a second run that must not recalculate any finished pair. The existing fixture already contains deployments without a previous success. Without the fix, the second run recalculates 2 `commits_diffs` rows and the test fails. No migration is needed. Existing finished markers with an empty `old_commit_sha` are honoured as-is. ### Does this close any open issues? Closes #9182 ### Screenshots N/A ### Other Information - Tested locally with `go test ./plugins/refdiff/...` against MySQL 8.4.11: the new assertion fails before the fix and passes after it. - De-duplicating pairs before calculation, which speeds up the first calculation, is intentionally left out to keep this fix minimal. It can follow separately. - I don't have permission to add labels; this should be `pr-type/bug-fix`. -- 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]
