Skip to content

feat: surface reviewer load in assigned-prs and daily digest#189

Merged
bryangingechen merged 1 commit into
masterfrom
feat/reviewer-load-helper
Jul 13, 2026
Merged

feat: surface reviewer load in assigned-prs and daily digest#189
bryangingechen merged 1 commit into
masterfrom
feat/reviewer-load-helper

Conversation

@bryangingechen

Copy link
Copy Markdown
Contributor

Add a single authority for a reviewer's review-load per repo and wire it into the two reviewer-facing surfaces so reviewers can see how close they are to capacity.

New service analyzer/services/reviewer_load.py:

  • build_reviewer_loads / reviewer_load_for read the latest cached queue snapshot (same resolution as pr_info) and reuse the assignment engine's own collect_assignment_statistics + build_reviewer_catalog. current_load is therefore the exact weighted figure that gates auto-assignment (status-weighted, self-authored PRs excluded), not a raw PR count.
  • format_load_line renders the shared one-liner.

User-visible effects:

  • assigned-prs: per-repo Load: 3 / 10 (7 free) under Thresholds, plus a top-of-report At capacity in K of N repos. only when at capacity.
  • daily reviewer-attention digest: per-repo Load: 9 / 10 (1 free) · 9 assigned under Settings.

Load is weighted and can be fractional, so the formatter shows one decimal (integer when whole). at_capacity mirrors the engine's strict remaining>0 gate; free is derived from the shown used (so they sum to capacity) and a used that rounds up to capacity while the reviewer still has real room is clamped to capacity-0.1, so near-cap loads render as 9.9 / 10 (0.1 free) rather than a contradictory 10 / 10 (0 free).

Load reflects the latest cached snapshot, so it can lag the live queue by one snapshot cycle (same freshness contract as pr-info).

Add a single authority for a reviewer's review-load per repo and wire it
into the two reviewer-facing surfaces so reviewers can see how close they
are to capacity.

New service analyzer/services/reviewer_load.py:
- build_reviewer_loads / reviewer_load_for read the latest cached queue
  snapshot (same resolution as pr_info) and reuse the assignment engine's
  own collect_assignment_statistics + build_reviewer_catalog. current_load
  is therefore the exact weighted figure that gates auto-assignment
  (status-weighted, self-authored PRs excluded), not a raw PR count.
- Read-only: never builds a snapshot; returns {}/None when none exists.
- Case-insensitive login matching.
- format_load_line renders the shared one-liner.

User-visible effects:
- assigned-prs: per-repo `Load: 3 / 10 (7 free)` under Thresholds, plus a
  top-of-report `At capacity in K of N repos.` only when at capacity.
- daily reviewer-attention digest: per-repo `Load: 9 / 10 (1 free) ·
  9 assigned` under Settings.

Load is weighted and can be fractional, so the formatter shows one decimal
(integer when whole). at_capacity mirrors the engine's strict remaining>0
gate; free is derived from the shown used (so they sum to capacity) and a
used that rounds up to capacity while the reviewer still has real room is
clamped to capacity-0.1, so near-cap loads render as `9.9 / 10 (0.1 free)`
rather than a contradictory `10 / 10 (0 free)`.

Load reflects the latest cached snapshot, so it can lag the live queue by
one snapshot cycle (same freshness contract as pr-info).

Testing: uv run ruff check/format; analyzer + zulip_bot suites (724 tests)
green against dockerized Postgres.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bryangingechen
bryangingechen merged commit a1bd5a2 into master Jul 13, 2026
4 checks passed
@bryangingechen
bryangingechen deleted the feat/reviewer-load-helper branch July 13, 2026 03:19
bryangingechen added a commit that referenced this pull request Jul 13, 2026
Build on the reviewer_load service (PR #189) for the acceptance-gate console.

Pending-proposal load (design doc 050):
- build_reviewer_loads now folds a reviewer's active proposals into current_load
  (weight from ANALYZER_ASSIGNMENT_PROPOSAL_PENDING_LOAD_WEIGHT), exactly as the
  assignment engine / area stats already count them. assigned_open still excludes
  proposals (a proposal is load, not an assignee). Data-driven: no proposals => no
  change. Adds a public pending_proposal_load_for_repo() wrapper so reviewer_load
  does not import private helpers.
- Consequence: the assigned-prs command and daily digest now count pending
  proposals in their load too, so the figure matches the engine on every surface.

Reviewer console home is now a per-repo dashboard:
- Load line is computed via the shared helper OUTSIDE the proposal loop, so it
  renders even with zero proposals. Removes the ad-hoc, case-sensitive
  assignees__contains count and the hand-rolled assigned+pending/capacity math.
- Each active repo (has a proposal OR >=1 assigned open PR) shows: load line +
  assigned open PRs with status (from build_reviewer_attention_reports) + the
  proposals to accept/decline. New empty state covers "nothing here".

Testing: uv run ruff check/format; analyzer + zulip_bot + console + core suites
(922 tests) green against dockerized Postgres.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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