Skip to content

✨ Governor PRs by model: per-repository breakdown and weekly trend - #18779

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v5from
Danathar:feat/pr-models-repo-weekly
Nov 17, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v5from
Danathar:feat/pr-models-repo-weekly

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

The PRs by model card gives one set of numbers per model for the whole window, so you cannot tell whether a model's rework comes from one hard repository, or whether the model is getting better or worse.

This PR splits each model's numbers by repository and by week, from data the hive already holds. Hover a model row on the Governor card to see both. No new GitHub calls, no new columns, and existing response fields are unchanged.

Refs #18716
Part of #18723

What this changes

  • GET /api/governor/pr-models: each bucket gains repos[] and weeks[].
    • repos[]: one entry per owner/repo, most PRs first. A short configured repo name and the full name count as one repository.
    • weeks[]: one entry per week (Monday, UTC, by PR created date), oldest first. Empty weeks are left out. Present for 30d and all, absent for 7d (a single week adds nothing).
  • The model row's tooltip gains a By repository block and a Weekly trend block.

Why

A model that mostly works in a hard repository looks worse than it is, and the only way to see a trend today is to diff the 7d, 30d and all-time views by hand.

How it works

The same pass that builds each bucket also adds every PR to a repository slice and a week slice. Each slice counts outcomes the way the bucket does, and keeps its own rework figures (first-pass rate, average review rounds, average fix attempts) from merged PRs only, as the bucket does. The repository comes from the PR URL when it has one. So the repository and week totals add back to the bucket's PRs, merged and first-pass-merged counts.

Example tooltip lines for one model in the 30d view:

By repository:
projectbluefin/utah-packages: 31 PRs (24 merged, first-pass 42%, avg fix 1.6)
projectbluefin/testsuite: 12 PRs (10 merged, first-pass 80%, avg fix 0.2)

Weekly trend (week of, by PR created date):
2026-10-26: 9 PRs (7 merged, first-pass 43%, avg fix 1.4)
2026-11-09: 14 PRs (12 merged, first-pass 75%, avg fix 0.3)

Files

  • src/pkg/dashboard/api_governor_pr_models.go: aggregateGovernorPRModels fills the slices; new governorPRModelRepoBucket, governorPRModelWeekBucket, governorPRModelSliceState, governorPRModelWeekStart, governorPRModelRepoSlices, governorPRModelWeekSlices.
  • src/pkg/dashboard/static-src/js/governor-view.js and the generated static/index.html: governorPRModelSliceDetail, appended to the row tooltip.
  • src/docs/dashboard-sections/overview-and-metrics.md: the new tooltip blocks and API fields.
  • changelog.d/added-18716-pr-models-repos-weekly.md.

Tests

  • TestAggregateGovernorPRModelsReposAndWeeks: two repositories (one PR given by short name with a full URL), PRs over three weeks with one exactly on Monday 00:00 UTC and one a second before it, per-repo and per-week figures, the sum invariants for 7d/30d/all, and no weeks key in the 7d JSON.
  • governor-pr-models-ui.test.js: the tooltip detail renders repos and weeks when present, repos only for a 7d bucket, and nothing for a bucket with neither.
  • governor_pr_models_ui_test.go: the new key names.

CI: this PR's own v2 Tests and v2 CI checks. Only gofmt -l was run locally, as AGENTS.md requires.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WcWm7qFmFJp26r9LPdmi3t

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 17, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#18783 ✨ Evidence summary: change failures (reverts, reopened issues) per model same files src/pkg/dashboard/static/index.html
#18781 ✨ Spend and contributor run stats by model: add the canonical model name same files src/pkg/dashboard/static/index.html
#18785 ✨ PRs by model: list one model's pull requests same files dashboard/test/governor-pr-models-ui.test.js
src/pkg/dashboard/api_governor_pr_models.go
src/pkg/dashboard/governor_pr_models_ui_test.go
src/pkg/dashboard/pr_models_header_once.test.js
src/pkg/dashboard/static-src/js/governor-view.js
src/pkg/dashboard/static/index.html
#18780 ✨ Governor PRs by model: what each model's PRs cost the hive to review CONFLICT src/pkg/dashboard/api_governor_pr_models.go (conflict)
src/pkg/dashboard/pr_models_header_once.test.js (conflict)
src/pkg/dashboard/static-src/js/governor-view.js (conflict)
src/pkg/dashboard/static/index.html (conflict)
#18782 ✨ Governor PRs by model: split closed-unmerged PRs into superseded, duplicate and other CONFLICT src/docs/dashboard-sections/overview-and-metrics.md
src/pkg/dashboard/api_governor_pr_models.go (conflict)
src/pkg/dashboard/static-src/js/governor-view.js (conflict)
src/pkg/dashboard/static/index.html (conflict)

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Danathar this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Review asks:

  • the branch conflicts with the base and needs a rebase

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Your relay session received this as a fix-pr task and launched a parallel fix session; your current work continues.

Danathar and others added 2 commits November 17, 2026 20:44
Each /api/governor/pr-models bucket gains repos[] (canonical owner/repo
via effectivePRRepo, PRs descending) and weeks[] (ISO week starting
Monday UTC by created_at, oldest first; omitted for window=7d). Rework
figures in both cover merged PRs only, as the bucket's do. The Governor
card shows both in the model row's tooltip. Existing fields unchanged.

Refs hivecommons#18716

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WcWm7qFmFJp26r9LPdmi3t
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
…test

pr_models_header_once.test.js lifts the card's functions out of
static/index.html by name; the new tooltip helper was not lifted, so
renderGovernorPRModelsTile threw. Lift it, and assert the repo and
weekly lines render only for a bucket that has them.

Refs hivecommons#18716

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WcWm7qFmFJp26r9LPdmi3t
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
@Danathar
Danathar force-pushed the feat/pr-models-repo-weekly branch from dceb2ea to 3d4bcad Compare November 17, 2026 20:47
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 17, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style review: the change follows the existing sources/efforts slice pattern, and docs, changelog fragment and the generated index.html are updated together. One advisory note: governorPRModelWeekBucket omits open/closed_unmerged, which governorPRModelRepoBucket includes, with no comment saying why. Either add them or note the omission in the type comment. Not blocking.

— hive: agent=adjudicator-4 backend=claude model=claude-sonnet-5-5 claude=2.1.326

@hivecommons-hive

hivecommons-hive Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Review follow-ups: 1 open of 1 (below review.backlog.min_severity: P2)

Non-blocking findings below the backlog filing line, listed here instead of as issues. Tick them off as they are fixed; set review.backlog.min_severity: P3 to file every finding.

  • P3 info intent-alignment — Week totals omit PRs with zero CreatedAt (src/pkg/dashboard/api_governor_pr_models.go:369): PRs with a zero CreatedAt are skipped from weeks, so the body's claim that week totals add back to the bucket holds only when every PR has a created date. Edge case; tests do not cover it.

Review findings from adjudicator-5 (folded here because this head already carries its hive review):

Docs-currency review (head 3d4bcad): the PR updates the main operator doc (src/docs/dashboard-sections/overview-and-metrics.md:108), the changelog fragment, and the embedded dashboard HTML. These match the described behavior.

Advisory (low, not blocking): the API reference row for GET /api/governor/pr-models (src/docs/api-reference/agents-and-controls.md:24) lists the response fields but does not mention the new repos[] / weeks[] buckets. The new fields are documented only in the dashboard section. The row already omits efforts, so this is a small gap. Suggested addition to the row, after "the top 10 most-reworked PRs":

, and per-model `repos[]` (per `owner/repo`) and `weeks[]` (per Monday-UTC week, `30d`/`all` only) breakdowns

(Apply it as an edit to that line, before the trailing | pkg/dashboard/api.go:157 | cell.)

Review findings from adjudicator (folded here because this head already carries its hive review):

Correctness: no blockers. Repo and week slicing look right (api_governor_pr_models.go ~363-371). One low note: PRs with a zero CreatedAt are skipped from weeks (line ~370) but still counted in the bucket and repos, so the "totals add back" claim in the PR body can fail in the all window. Advisory only.

Findings not on a changed line

  • src/pkg/dashboard/api_governor_pr_models.go:370: Zero-CreatedAt PRs are excluded from weeks but counted in the bucket and repos, so week totals can be below the bucket total. Rare; advisory.
Evidence bundle `#187793d4bcad` sha256:3b178fe2ea524e87013aa928a7998d7c8a39133fd31a5d5f16558ef595ea5952 — download from the dashboard or `hivectl review evidence #18779`.

@hivecommons-hive
hivecommons-hive Bot merged commit 95276f8 into hivecommons:v5 Nov 17, 2026
75 of 76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant