Repository navigation
fix: count bot-merged prs and bot-closed issues in development widgets - #2412
Conversation
Refs linuxfoundation/lfx-cdp-insights-ops#790 Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
PR SummaryMedium Risk Overview The Pull requests path now calls The frontend Tinybird data layer and tests/mocks are updated in parallel so widgets and API stay aligned. Docs clarify which Development metrics include bots (PR/issue-related widgets and health-score issue/PR sub-signals) versus people-only metrics. Deploy note: requires Reviewed by Cursor Bugbot for commit 5861eaa. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
🔵 Needs a closer look
Human confirmation is needed that the dependent Tinybird pipes are deployed and application tokens have the required read permissions.
No open issues 🎉
What changed in this PR
Updates Development widgets and matching public API routes to count bot-inclusive pull request and issue lifecycle data.
Changes:
- Replaces activity counts with dedicated Tinybird count pipes.
- Updates tests and mocks for the new response fields.
- Clarifies bot inclusion in Development and health-score documentation.
| File | Description |
|---|---|
| frontend/server/mocks/tinybird-pull-requests-response.mock.ts | Uses pullRequestCount in fixtures. |
| frontend/server/mocks/tinybird-issues-response.mock.ts | Uses issueCount in fixtures. |
| frontend/server/data/tinybird/development/pull-requests.ts | Fetches PR lifecycle counts by state. |
| frontend/server/data/tinybird/development/pull-requests.test.ts | Updates query and response expectations. |
| frontend/server/data/tinybird/development/issues-resolution.ts | Fetches issue lifecycle counts by state. |
| frontend/server/data/tinybird/development/issues-resolution.test.ts | Updates summary count expectations. |
| frontend/docs/metrics/health-score/index.md | Documents bot-inclusive health metrics. |
| frontend/docs/metrics/development/index.md | Clarifies which metrics include bots. |
| api/tests/development-pull-requests.test.ts | Updates PR endpoint integration tests. |
| api/tests/development-issues-resolution.test.ts | Updates issue endpoint integration tests. |
| api/src/versions/v1-alpha/development/pull-requests.ts | Switches API counts to the PR pipe. |
| api/src/versions/v1-alpha/development/issues-resolution.ts | Switches API counts to the issue pipe. |
Review effort: Balanced
[Medium impact] The PR appears safe to merge with the documented upstream deployment order. SummarySwitches the Development widgets and public API routes from activity counts to issue and pull request counts that include bot actions.
Reviews (2) · Last reviewed commit: "Merge branch 'main' into fix/issue-790-d..." · Reviewed by Greptile |
gaspergrom
left a comment
There was a problem hiding this comment.
LGTM. I checked the call parameters (state, repos, platform, granularity, project/collectionSlug) and the response fields (pullRequestCount, issueCount) against the pull_requests_count and issues_count pipes in crowd.dev#5028, and they match. No other widget or route still reads activities_count for PR or issue opened/merged/closed counts. Merge after the pipes are deployed.
Symptom
The Pull requests widget on the Development tab shows 0 merged PRs for repositories that merge through a bot. istio/istio reported 1,305 opened and 0 merged over the past year (#2369), even though GitHub lists thousands of merged PRs.
Root cause
The opened, merged and closed counts come from
activities_count, which reads the bot-filtered activity buckets. A merge activity belongs to the account that clicked merge. istio merges every PR with its Prow bot,istio-testing, so every istio merge is dropped before the widget counts it. The Development docs say these metrics include bots, but only the widgets built onpull_requests_analyzeddid. Issues resolution had the same gap: an issue closed by a stale bot did not count as closed.Change
pull_requests_countpipe, which readspull_requests_analyzed, the same table its average velocity already uses. Each PR is counted once, and a PR a bot merged counts as merged.issues_countpipe, which readsissues_analyzed. That table now includes issues opened or closed by bots./development/pull-requestsand/development/issues-resolutionmake the same switch, so the API and the widgets return the same numbers.istio/istio over the past year, checked against production data:
Deploy order
This PR depends on linuxfoundation/crowd.dev#5028, which adds the
pull_requests_countandissues_countpipes and the bot-inclusiveissues_analyzed. Push those pipes to the production Tinybird workspace before deploying this PR. Until then the two widgets and API routes have no pipe to call. Both pipes declare read access for the insights app token, so no separate grant is needed.Closes linuxfoundation/lfx-cdp-insights-ops#790