incubator-devlake icon indicating copy to clipboard operation
incubator-devlake copied to clipboard

fix(dora): fix wrong change lead time calculator

Open petkostas opened this issue 6 months ago • 0 comments

Summary

Summary of the reviewer’s concern

  • DevLake deliberately excludes the very first deployment_commit in 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:

  1. Direct match: if there exists a successful PRODUCTION deployment in the project whose commit_sha equals the PR’s merge commit, return it. This is precise and does not risk the first deployment over mapping problem.
  2. 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

petkostas avatar Aug 23 '25 15:08 petkostas