Skip to content

Compute manager stats across all source-control providers#335

Merged
daniel-lxs merged 3 commits into
developfrom
feat/per-provider-pr-analytics
Jul 14, 2026
Merged

Compute manager stats across all source-control providers#335
daniel-lxs merged 3 commits into
developfrom
feat/per-provider-pr-analytics

Conversation

@daniel-lxs

Copy link
Copy Markdown
Member

What

PR C — the last of the three PRs eliminating removable "GitHub only" badges (follows #320, #325).

The weekly manager-stats digest now covers GitLab, Gitea, Azure DevOps, and Bitbucket repositories, not just GitHub.

The pleasant surprise

The plan assumed this needed per-provider review/approval APIs. Exploration showed the digest never consumed review-API data — its authored-vs-reviewed split comes from Roomote's own task-PR records. So the change is small and DB/list-primitive-based:

  • Non-GitHub repos contribute via the existing provider-neutral list primitives (open + merged-in-window per repo, bounded); GitHub keeps its analytics path byte-identical
  • The classification join is now provider-qualified, fixing a latent same-name cross-provider key collision
  • Eligibility: any active repository; the GitHub actor is only resolved for the GitHub data path

Honest degradations (marked, not fabricated)

  • LOC added/removed has no bulk API off GitHub → the digest line says "(GitHub PRs only)" when non-GitHub PRs are in scope
  • Closed-without-merge PRs aren't counted off GitHub (list primitive is open|merged) — documented undercount
  • Rows without timestamps are dropped

With exception-only badges (#332), manager_stats' pill disappears; the only remaining "GitHub only" badges are Dependabot triage and CI-failure triage — GitHub products, not missing work.

Testing

  • New per-provider normalizer tests (window filtering, drafts, null timestamps/authors, dedupe), cross-provider key separation, LOC-line rendering both scopes
  • Full suites green: sdk (532), db (262), types (545), web (1994); lint/types/knip clean

🤖 Generated with Claude Code

The weekly digest was computed exclusively from GitHub's analytics
API. Non-GitHub repositories now contribute via the provider-neutral
list primitives (open + merged-in-window per repo), mapped through a
pure per-provider normalizer; the GitHub path is unchanged. The
authored-vs-reviewed classification joins task PRs with provider-
qualified keys, fixing a latent same-name cross-provider collision.

Honest degradations, marked in the digest rather than fabricated: the
LOC line is labeled "(GitHub PRs only)" when non-GitHub PRs are
counted (no bulk additions/deletions API elsewhere), closed-without-
merge PRs are not counted off-GitHub, and rows without timestamps are
dropped. Eligibility requires any active repository; the GitHub actor
is only needed for the GitHub data path.

manager_stats declares all source-control providers — with exception-
only badges, its "GitHub only" pill disappears, leaving only the
inherently-GitHub Dependabot and CI-failure triage automations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roomote-roomote

roomote-roomote Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

No code issues found. See task

  • packages/sdk/src/server/lib/manager-stats.ts:341-352 — The non-GitHub reads are capped at 200 PRs per state, but the digest silently drops any provider truncation warning. In repositories with more than 200 recently updated open or merged PRs, valid PRs created this week are omitted from the weekly totals.
  • packages/sdk/src/server/lib/manager-stats.ts:341-360 — The concurrent open and merged reads can return the same PR when it merges between requests. Concatenating open results first makes toAnalyticsPullRequests retain the stale open row, so the authored merged count is underreported; prefer the merged summary when deduplicating.
  • packages/sdk/src/server/lib/manager-stats.ts:538-558 — Counts are now provider-qualified, but the returned and displayed fullName still drops the provider. A GitHub and GitLab acme/app remain indistinguishable in the digest, and an equal-count tie is selected by input order; return/display provider identity or add a deterministic provider-qualified tie-breaker.

Reviewed 948f2ac

daniel-lxs and others added 2 commits July 14, 2026 13:56
… repo counts

Provider list warnings are logged per repo instead of silently
dropped; dedup prefers the merged summary when a PR merges between the
concurrent open and merged reads; most-active-repo counts are keyed by
provider-qualified identity. Per product direction, outbound digest
copy carries no scope qualifiers: the LOC line renders only when it
covers every counted PR and is omitted otherwise, and repo labels stay
bare names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Equal-count same-name repos across providers now tie-break on the
provider-qualified key instead of input order. The digest deliberately
keeps bare repository names: outbound message copy carries no provider
qualifiers by product direction; the settings-page capability badges
own that story.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@daniel-lxs

Copy link
Copy Markdown
Member Author

On the display half of the last finding: keeping the bare repository name in the digest is deliberate product direction — outbound message copy carries no provider/scope qualifiers; the settings-page capability badges are the single place limitations and provider identity are communicated. The nondeterministic tie-break half is fixed with a provider-qualified comparator.

@daniel-lxs daniel-lxs merged commit 3ec03fc into develop Jul 14, 2026
16 of 17 checks passed
@daniel-lxs daniel-lxs deleted the feat/per-provider-pr-analytics branch July 14, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant