-
Notifications
You must be signed in to change notification settings - Fork 130
Open
Labels
enhancementNew feature or requestNew feature or requestmediumModerate complexity issueModerate complexity issue
Description
Problem
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 ofpr.created_at
Benefits
- More accurate cycle time metrics
- Better representation of actual review time
- Prevents inflation of metrics due to draft preparation time
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestmediumModerate complexity issueModerate complexity issue