Skip to content

Link reviews and sessions both ways; show a run's CI checks and review verdict - #546

Merged
nambok merged 1 commit into
mainfrom
feat/review-run-fields
Nov 10, 2026
Merged

nambok merged 1 commit into
mainfrom
feat/review-run-fields

Conversation

@nambok

@nambok nambok commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds four optional fields the dashboard's review and run pages need. All are additive; older records return null.

Changes

  • Review to session (/api/reviewer/review, /api/reviewer/reviews): session_id: string | null, the review job that wrote that exact review. The worker now writes it on the review record (only when the job opened its session page).
  • Session to review (/api/reviewer/session): review_sk: string | null, the review record the session wrote. A verdict always sets it; a question answer sets it only when the job wrote no review first.
  • Run checks (/api/runs/{run_id}): checks: { sha, items: [{ name, state, conclusion, required, started_at, completed_at, url }], counts: { passed, failed, running, queued, skipped } } | null for the head of the run's open pull request. Read from GitHub check runs and commit statuses with the installation token, on read, through in-memory caches: pull request head 30s, checks 45s keyed by repo and sha, required checks 10 min, token 45 min. A refused read is cached too, so a rate-limited install isn't asked again on each poll. Required checks come from branch rules and classic protection when readable, else required stays false; a required check that hasn't reported shows as queued. Whole read is capped at 6s; any failure gives null, never an error.
  • Run review verdict (/api/runs/{run_id}): pr_review: { verdict, review_sk, session_id, reviewed_sha, at } | null, the latest APPROVE or REQUEST_CHANGES on the run's pull request from the team's review records (answers and old error reviews skipped).
  • docs/api/openapi.json regenerated.

Verification

  • cargo fmt --all, cargo clippy -p common -p gateway -p worker --all-targets -- -D warnings clean.
  • cargo test -p common -p gateway -p worker: common 1636, gateway 806, worker 1426 (+2 in a separate target), all passing.
  • New unit tests: check state mapping, counts, required marking (including unreadable rules), the cache key and expiry, open pull request selection, the latest verdict lookup, the session link update expressions, and the round trip of session_id and review_sk from record to API JSON.

…w verdict

A review record now keeps the review job (session) that wrote it, and the
session keeps the review it wrote. The reviewer API returns them as
session_id on a review and review_sk on a session; older records show null.

The run API gains checks (the CI checks on the open pull request's head,
read from GitHub through short caches) and pr_review (CoderHelm's latest
verdict on the run's pull request). Both are null when there is nothing
to show, and never fail the run.
@nambok
nambok merged commit fd8174a into main Nov 10, 2026
10 checks passed
@nambok
nambok deleted the feat/review-run-fields branch November 10, 2026 08:13
coderhelm Bot pushed a commit that referenced this pull request Dec 6, 2026
Moves dashboardRef to coderhelm main (e65ef06), which adds the Pull requests
page (#544), the follow-up on main (#545) and the pull requests overview
(#546). The API they read shipped in #985 and #988.
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