incubator-devlake
incubator-devlake copied to clipboard
fix(dora): fix wrong change lead time calculator
Summary
Summary of the reviewer’s concern
- DevLake deliberately excludes the very first
deployment_commitin a scope when mapping PRs to deployments using commit diffs, because:- Data is typically collected within a time window.
- For the first deployment in that window, there is no previous deployment to diff against, so its set of deployed commits is unknown.
- If included, the first deployment could incorrectly swallow many unrelated PRs merged between an unknown previous deployment and that first one.
This PR:
Adjusts getDeploymentCommit to use a two-phase strategy:
- Direct match: if there exists a successful PRODUCTION deployment in the project whose
commit_shaequals the PR’s merge commit, return it. This is precise and does not risk the first deployment over mapping problem. - Fallback to diff-based mapping: retain the current strategy (including the filter
dc.prev_success_deployment_commit_id <> '') to avoid mapping to the first deployment via diffs
Does this close any open issues?
Closes #8188
Screenshots
⚠️ Test pending