You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our current PR cycle time calculation has inaccuracies for PRs that start in draft state. We currently measure:
cycle_time = (time when PR state changed) - (time when PR was created)
This approach inflates the cycle time for PRs that begin as drafts, since the PR isn't actually ready for review when it's created. The clock should start when the PR is first ready for review.
Proposed Solution
We should modify our logic to calculate the first time a PR is open for review as follows:
If PR was opened in a ready-for-review state:
first_open_time = pr.created_at
If PR was opened in draft state:
first_open_time = timestamp when PR first moved to ready-for-review state
If PR later toggles between draft and ready-for-review states:
Ignore subsequent transitions; only the first transition to ready-for-review matters
Implementation Notes
Need to track the PR state transition history
Only consider the first transition from draft to ready-for-review
Update the cycle time calculation to use first_open_time instead of pr.created_at
Benefits
More accurate cycle time metrics
Better representation of actual review time
Prevents inflation of metrics due to draft preparation time
The text was updated successfully, but these errors were encountered:
- Modified cycle time calculation to start timing when PR first becomes ready for review
- Added logic to detect the first transition from draft to ready state
- First ready event timestamp is used instead of PR creation time when applicable
- Provides more accurate metrics by excluding draft preparation time
Resolves issue middlewarehq#634
Problem
Our current PR cycle time calculation has inaccuracies for PRs that start in draft state. We currently measure:
This approach inflates the cycle time for PRs that begin as drafts, since the PR isn't actually ready for review when it's created. The clock should start when the PR is first ready for review.
Proposed Solution
We should modify our logic to calculate the first time a PR is open for review as follows:
If PR was opened in a ready-for-review state:
first_open_time = pr.created_at
If PR was opened in draft state:
first_open_time = timestamp when PR first moved to ready-for-review state
If PR later toggles between draft and ready-for-review states:
Implementation Notes
first_open_time
instead ofpr.created_at
Benefits
The text was updated successfully, but these errors were encountered: