GitHub user CedricConday added a comment to the discussion: Median Lead Time 
for Changes: how to configure for GitFlow

The metric does not look at the default branch at all, so there is no branch 
setting to change.

`CalculateChangeLeadTime` walks every PR in the project's mapped repos with a 
non-null
`merged_date`. No predicate on `base_ref`. The deployment side is what pairs a 
PR with a lead time —
`batchFetchDeployments` reads `cicd_deployment_commits` with:

```sql
WHERE dc.environment = 'PRODUCTION' AND dc.result = 'SUCCESS'
```

and matches a PR when its merge commit is the deployed commit, or falls in the 
`commits_diffs`
range between that deployment and the previous successful one.

So your "Elite" figures mean the pipelines on `develop` are being recorded as 
successful PRODUCTION
deployments. The deployment definition is wrong, not the branch.

Fix, in the scope/transformation settings for the Bitbucket CI connection:

1. Narrow what counts as a deployment so only the release pipeline matches, and 
make sure its
   environment resolves to `PRODUCTION`. `PRODUCTION` is hardcoded in the query 
above — any other
   value is excluded, which is what you want for `develop`.
2. Re-run the DORA subtasks. `CalculateChangeLeadTime` deletes the project's 
`project_pr_metrics`
   rows first, so it recomputes clean.
3. Verify on the `dora-details-lead-timefor-changes` dashboard, which lists 
individual PRs — a
   misclassified deployment is obvious there.

GitFlow caveat: if release merges into `master` are the deployed commits, 
feature PRs into `develop`
are only attributed when they fall inside the commit diff between two 
production deployments. That
needs RefDiff collecting commit diffs, and `master` containing those commits. 
With that in place the
lead time spans merge into `develop` through to the release reaching production.

GitHub link: 
https://github.com/apache/devlake/discussions/9141#discussioncomment-18486200

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to