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
* feat(bitbucket): wire DX Core 4 'code review pickup time' signals
The README cites DX Core 4 'code review pickup time' as a derivable metric
but the inputs weren't all present:
- Only `pr:comment:added` was subscribed. DX defines pickup as the first
ANY reviewer action — silent approvals and `needs_work` flips never
showed up, and the bot comment noergler posts seconds after pr:opened
would have driven every PR's pickup-time to ~0.
- For reviewer-activity events the parser was filling `author` from
`pullRequest.author` (the PR opener) instead of `actor` (the reviewer).
That meant the `author != pr_opener` filter couldn't ever fire.
This PR:
- Adds `pr:reviewer:approved`, `pr:reviewer:needs_work`, and
`pr:reviewer:updated` to the Bitbucket onboarding event list. Together
with the existing `pr:comment:added` they cover every reviewer action
Bitbucket DC emits.
- Teaches the parser that comment / reviewer events are reviewer-activity:
it now picks `actor` (the human or bot performing the action) over
`pullRequest.author` for those event types only. PR-lifecycle events
(opened / merged / from_ref_updated / deleted) keep the existing PR
author semantics; a regression test pins this.
- Adds a `noergler` entry to the example automation config so
`detect_automation_source` flags noergler's instant review comment as
`is_automated=true`. The existing `NOT is_automated` filter in
pickup-time queries then strips it. The README explicitly calls out
that every review-time bot needs a matching automation entry.
Tests cover: actor-as-author for `pr:reviewer:approved` and
`pr:comment:added`, regression guard that `pr:merged` still attributes
to the PR opener (not the merger), and that the config detection picks
up the noergler entry.
* review(#57): subscribe pr:reviewer:unapproved, dedicated comment fixture
- Subscribe pr:reviewer:unapproved and add it to the pickup-time query.
The parser already treated it as reviewer activity but the event was
never delivered (not in REQUIRED_WEBHOOK_EVENTS) and never queried, so
the parser branch was dead. A retracted approval is reviewer engagement
too — same actor-wins rule applies.
- New tests/fixtures/bitbucket_pr_comment_added.json so the comment-route
test doesn't reuse the reviewer:approved fixture with a swapped eventKey
(which left a stale REVIEWER 'participant' block in the payload).
- New test for pr:reviewer:unapproved (actor-as-author).
- New test for the edge case where pullRequest.author is an empty block:
the actor-wins path covers it cleanly, no None author.
branch_prefixes:[] vs missing key concern (raised in review) confirmed
to be semantically identical in config.py: tuple(cfg.get("branch_prefixes") or []).
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ the data captured in v1.
63
63
|**Deployment frequency**|`COUNT(*)` of `argocd_events` per `app_name` / `team` / time window where `operation_phase = 'Succeeded' AND environment = 'prod'`. Drop the `environment` filter (or slice by it) for staging visibility. |
64
64
|**Lead time for changes**| For each merged PR, `MIN(bitbucket_events.occurred_at)` for the PR (first commit) → `argocd_events.occurred_at` of the prod deploy that carries the same `commit_sha` and `environment = 'prod'`. Joined via the SHA. Stratify by `bitbucket_events.change_type` (feature / hotfix / bugfix / …) to see hotfix lead time vs. feature lead time separately. |
65
65
|**PR cycle time**|`pullrequest:fulfilled.occurred_at − pullrequest:created.occurred_at` per PR id. |
66
-
|**Time to first review***(DX Core 4 "code review pickup time")*|First reviewer event timestamp − PR-created timestamp on `bitbucket_events`. |
66
+
|**Time to first review***(DX Core 4 "code review pickup time")*|`MIN(occurred_at) WHERE event_type IN ('pr:comment:added', 'pr:reviewer:approved', 'pr:reviewer:unapproved', 'pr:reviewer:needs_work', 'pr:reviewer:updated') AND author != <pr_opener_handle> AND NOT is_automated` per PR, minus the matching `pr:opened` row. The five-event union covers every reviewer touch Bitbucket DC emits — silent approvals, retracted approvals, "needs work" flips, and bare reviewer-status changes; `NOT is_automated` strips bot comments (noergler / Renovate / etc.) — every review-time bot must have its handle in the `automation` config block, otherwise its instant comment drives the metric toward zero. |
67
67
|**Build success rate**|`pipeline_events` with `phase = 'COMPLETED'` grouped by `status`. Slice by `source` to compare Jenkins vs Tekton, by `pipeline_name` / `team` for ownership. |
68
68
|**Build duration**|`pipeline_events.duration_seconds` (a Postgres `GENERATED ALWAYS AS (finished_at − started_at)` column). |
69
69
|**Deploy success rate**|`argocd_events` with `operation_phase IN ('Succeeded', 'Failed')` aggregated, filtered to `environment = 'prod'` for the prod-only view. |
0 commit comments