Skip to content

Conversation

petkostas
Copy link
Contributor

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 petkostas self-assigned this Aug 23, 2025
@petkostas petkostas added the pr-type/bug-fix This PR fixes a bug label Aug 23, 2025
@petkostas petkostas requested review from Startrekzky and klesh August 23, 2025 18:11
Copy link
Contributor

@Startrekzky Startrekzky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I think it could partly solve the original problem. The key is to find a set of paths to reproduce the 'mis-matching' issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-type/bug-fix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][DORA-change_lead_time_calculator] Wrong deployment reference

2 participants