diff --git a/dashboard/e2e/reviewer-session.spec.ts b/dashboard/e2e/reviewer-session.spec.ts index 42429718..9cdfd99b 100644 --- a/dashboard/e2e/reviewer-session.spec.ts +++ b/dashboard/e2e/reviewer-session.spec.ts @@ -1,5 +1,7 @@ import { expect, test, type Page, type Route } from "@playwright/test"; import { + activityHeading, + droppedNote, findingsLabel, isSessionId, kindLabel, @@ -8,6 +10,7 @@ import { sessionSeconds, statusNote, stepOffset, + timeline, triggerLabel, } from "../src/app/reviewer/session/session"; @@ -15,7 +18,12 @@ import { // API call is answered here; nothing reaches a real backend. const ID = "3f2c9a1e-5b7d-4c8e-9a0b-1c2d3e4f5a6b"; -const now = Date.now(); +// Fresh for each test: a shard can reach a test minutes after the file loads, +// and the running elapsed time is measured against the real clock. +let now = Date.now(); +test.beforeEach(() => { + now = Date.now(); +}); const iso = (secsAgo: number) => new Date(now - secsAgo * 1000).toISOString(); // ---- The helpers ------------------------------------------------------------ @@ -72,6 +80,34 @@ test.describe("session helpers", () => { }); }); +test.describe("activity helpers", () => { + test("steps and activity groups merge into one timeline by time", () => { + const at = (s: number) => `2026-10-22T14:18:${String(s).padStart(2, "0")}.000Z`; + const steps = [{ at: at(0), text: "Started" }, { at: at(5), text: "Reviewing the code" }, { at: at(40), text: "Posted" }]; + const groups = [ + { started_at: at(5), title: "Checking callers" }, + { started_at: at(9), title: "Search 3 times" }, + { started_at: "not a time", title: "View 2 files" }, + ]; + const order = timeline(steps, groups).map((e) => (e.kind === "step" ? e.step.text : e.group.title)); + // A step and a group at the same second keep the step first; a group + // without a readable time stays after the one before it. + expect(order).toEqual(["Started", "Reviewing the code", "Checking callers", "Search 3 times", "View 2 files", "Posted"]); + expect(timeline([], [])).toEqual([]); + }); + + test("the activity heading and the dropped note read as words", () => { + expect(activityHeading("reviewing")).toBe("Reviewing pull request"); + expect(activityHeading("done")).toBe("Reviewed pull request"); + expect(activityHeading("reviewing", "question")).toBe("Reading the comment"); + expect(activityHeading("failed")).toBe("Reviewing pull request"); + expect(droppedNote(0)).toBeNull(); + expect(droppedNote(undefined)).toBeNull(); + expect(droppedNote(1)).toBe("1 more step wasn't recorded."); + expect(droppedNote(12)).toBe("12 more steps weren't recorded."); + }); +}); + // ---- The page --------------------------------------------------------------- type Session = Record; @@ -180,7 +216,7 @@ test("a running review shows its steps live, then its verdict and the posted rev await expect(page.getByTestId("session-facts")).toContainText("New commits"); await expect(page.getByTestId("session-facts")).toContainText("Still running"); await expect(page.getByRole("link", { name: /9fceb02/ })).toHaveAttribute("href", "https://github.com/acme/web/commit/9fceb02d0ae598e95dc970b74767f19372d61af8"); - const steps = page.getByTestId("session-steps").getByRole("listitem"); + const steps = page.locator('[data-testid="timeline-entry"][data-kind="step"]'); await expect(steps).toHaveCount(2); await expect(steps.nth(1)).toContainText("Read the change: 2 files changed"); // A step's detail opens on demand. @@ -283,3 +319,174 @@ test("the PR page links to its latest review session", async ({ page }) => { await expect(page.getByRole("heading", { level: 1, name: "Rate-limit the login form" })).toBeVisible(); await expect(page.getByRole("link", { name: "View session" })).toHaveCount(0); }); + +// ---- What the reviewer did, and the overview -------------------------------- + +const msIso = (secsAgo: number) => new Date(now - secsAgo * 1000).toISOString(); + +function activity(): unknown[] { + return [ + { kind: "note", title: "Evaluating rate-limit semantics", started_at: msIso(78), ended_at: msIso(78), text: "The limiter now counts failed logins per address.", items: [] }, + { + kind: "search", + title: "Search 3 times", + started_at: msIso(76), + ended_at: msIso(70), + text: "", + items: [ + { at: msIso(76), label: "checkLimit(", detail: "", failed: false }, + { at: msIso(73), label: "LOGIN_LIMIT", detail: "", failed: false }, + { at: msIso(70), label: "callers of checkLimit", detail: "", failed: false }, + ], + }, + { + kind: "view", + title: "View 2 files", + started_at: msIso(66), + ended_at: msIso(60), + text: "", + items: [ + { at: msIso(66), label: "src/auth/limits.ts:1-48", detail: "", failed: false }, + { at: msIso(63), label: "src/auth/limits.ts:90-120", detail: "", failed: false }, + { at: msIso(60), label: "src/auth/login.test.ts", detail: "", failed: true }, + ], + }, + ]; +} + +function overview(files: number): Record { + return { + summary: "Rate-limits the login form by address.", + changes: ["Counts failed logins per address", "Locks the form for a minute after five"], + files: Array.from({ length: files }, (_, i) => + i === 0 ? { path: "src/auth/limits.ts", description: "Adds the per-address counter" } : { path: `src/auth/file-${i}.ts`, description: `Change ${i}` }, + ), + files_total: files, + }; +} + +test("the activity timeline shows each step live, grouped like a run log", async ({ page }) => { + const errors = watchConsole(page); + const running = session({ activity: activity() }); + const done = session({ + status: "done", + in_flight: false, + finished_at: iso(5), + verdict: "REQUEST_CHANGES", + findings: 2, + activity: [ + ...activity(), + { + kind: "comment", + title: "Store 2 comments", + started_at: msIso(20), + ended_at: msIso(20), + text: "", + items: [ + { at: msIso(20), label: "src/auth/limits.ts:31", detail: "The counter never resets", failed: false }, + { at: msIso(20), label: "src/auth/login.ts:12", detail: "Missing test for the lockout", failed: false }, + ], + }, + ], + activity_dropped: 3, + steps: [...(session().steps as unknown[]), { at: iso(5), text: "Posted the review on GitHub", detail: "" }], + }); + // Running until the test says the review is done, whatever the poll timing. + const db = await mockApi(page, { sessions: [running] }); + await page.goto(`/reviewer/session?id=${ID}`); + + const card = page.getByTestId("session-activity"); + await expect(card.getByRole("heading", { name: "Reviewing pull request" })).toBeVisible(); + await expect(page.getByTestId("activity-elapsed")).toHaveText(/^1m \d+s$/); + const entries = card.getByTestId("timeline-entry"); + // Two setup steps, then a note, the searches and the file views. + await expect(entries).toHaveCount(5); + await expect(entries.nth(0)).toHaveAttribute("data-kind", "step"); + await expect(entries.nth(2)).toHaveAttribute("data-kind", "note"); + await expect(entries.nth(2)).toContainText("Evaluating rate-limit semantics"); + await expect(entries.nth(2)).toContainText("The limiter now counts failed logins per address."); + // Only the newest entry runs. + await expect(card.locator('[data-state="running"]')).toHaveCount(1); + await expect(entries.nth(4)).toHaveAttribute("data-state", "running"); + + // A group is one line until opened; then it lists its queries or files. + const search = entries.nth(3); + await expect(search).toContainText("Search 3 times"); + await expect(search.getByText("LOGIN_LIMIT")).toBeHidden(); + await search.getByText("Search 3 times").click(); + await expect(search.getByText("LOGIN_LIMIT")).toBeVisible(); + await expect(search.getByText("callers of checkLimit")).toBeVisible(); + const views = entries.nth(4); + await expect(views).toContainText("1 failed"); + await views.getByText("View 2 files").click(); + await expect(views.getByText("src/auth/limits.ts:90-120")).toBeVisible(); + await expect(views.getByTestId("activity-items").getByRole("listitem").nth(2)).toContainText("(failed)"); + + // The whole timeline folds away and back. + await card.getByRole("heading", { name: "Reviewing pull request" }).click(); + await expect(page.getByTestId("session-timeline")).toBeHidden(); + await card.getByRole("heading", { name: "Reviewing pull request" }).click(); + await expect(page.getByTestId("session-timeline")).toBeVisible(); + + // Once the review ends: done, the comments it kept, the step it posted with. + db.sessions.push(done); + await expect(card.getByRole("heading", { name: "Reviewed pull request" })).toBeVisible({ timeout: 15_000 }); + await expect(card.locator('[data-state="running"]')).toHaveCount(0); + await expect(entries).toHaveCount(7); + const comments = entries.nth(5); + await expect(comments).toHaveAttribute("data-kind", "comment"); + await comments.getByText("Store 2 comments").click(); + await expect(comments).toContainText("src/auth/limits.ts:31"); + await expect(comments).toContainText("The counter never resets"); + await expect(entries.nth(6)).toContainText("Posted the review on GitHub"); + await expect(page.getByTestId("activity-elapsed")).toHaveText("1m 25s"); + await expect(page.getByTestId("activity-dropped")).toHaveText("3 more steps weren't recorded."); + expect(errors).toEqual([]); +}); + +test("the overview says what the PR does, file by file", async ({ page }) => { + const errors = watchConsole(page); + await mockApi(page, { sessions: [session({ status: "done", in_flight: false, finished_at: iso(5), verdict: "APPROVE", findings: 0, overview: overview(3) })] }); + await page.goto(`/reviewer/session?id=${ID}`); + const card = page.getByTestId("session-overview"); + await expect(card.getByRole("heading", { name: "PR Overview" })).toBeVisible(); + await expect(card).toContainText("Rate-limits the login form by address."); + await expect(page.getByTestId("overview-changes").getByRole("listitem")).toHaveText([ + "Counts failed logins per address", + "Locks the form for a minute after five", + ]); + await expect(card).toContainText("3 changed files"); + const table = card.getByRole("table", { name: "Reviewed changes" }); + await expect(table.getByRole("columnheader")).toHaveText(["File", "Description"]); + await expect(table.getByRole("row")).toHaveCount(4); + await expect(table.getByRole("row").nth(1)).toContainText("src/auth/limits.ts"); + await expect(table.getByRole("row").nth(1)).toContainText("Adds the per-address counter"); + await expect(card.getByText("Show a summary per file")).toHaveCount(0); + + // A session without an overview (an older review, or one still running) shows none. + await mockApi(page, { sessions: [session()] }); + await page.goto(`/reviewer/session?id=${ID}`); + await expect(page.getByTestId("session-status")).toHaveText("Reviewing"); + await expect(page.getByTestId("session-overview")).toHaveCount(0); + expect(errors).toEqual([]); +}); + +test("a large PR's file table starts folded, and nothing scrolls sideways on a phone", async ({ page }) => { + const big = overview(20); + big.files_total = 140; + await mockApi(page, { sessions: [session({ status: "done", in_flight: false, finished_at: iso(5), verdict: "APPROVE", overview: big, activity: activity() })] }); + await page.goto(`/reviewer/session?id=${ID}`); + const card = page.getByTestId("session-overview"); + await expect(card).toContainText("140 changed files"); + await expect(card).toContainText("And 120 more files."); + const table = card.getByRole("table", { name: "Reviewed changes" }); + await expect(table).toBeHidden(); + await card.getByText("Show a summary per file").click(); + await expect(table).toBeVisible(); + await expect(table.getByRole("row")).toHaveCount(21); + + await page.setViewportSize({ width: 390, height: 800 }); + await page.getByTestId("timeline-entry").nth(4).getByText("View 2 files").click(); + const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth); + expect(overflow).toBeLessThanOrEqual(0); +}); diff --git a/dashboard/src/app/reviewer/session/page.tsx b/dashboard/src/app/reviewer/session/page.tsx index e0f1b9fb..b006bd5a 100644 --- a/dashboard/src/app/reviewer/session/page.tsx +++ b/dashboard/src/app/reviewer/session/page.tsx @@ -12,7 +12,7 @@ import { secondaryButton } from "@/components/ui"; import { ExternalLinkIcon } from "@/components/icons"; import { Page, PageHeader } from "@/components/page"; import { isSessionId, SESSION_POLL_MS, sessionLook } from "./session"; -import { SessionFacts, SessionNotice, SessionOutcome, SessionTimeline } from "./sections"; +import { SessionActivity, SessionFacts, SessionNotice, SessionOutcome, SessionOverview } from "./sections"; // One review job, step by step (`?id=`). A PR's "Coderhelm review" // check links here from its Details link. Each job has its own session, so an @@ -117,8 +117,9 @@ function SessionPage() { /> + + - ); } diff --git a/dashboard/src/app/reviewer/session/sections.tsx b/dashboard/src/app/reviewer/session/sections.tsx index 16ecdb9d..5824e4dd 100644 --- a/dashboard/src/app/reviewer/session/sections.tsx +++ b/dashboard/src/app/reviewer/session/sections.tsx @@ -1,14 +1,28 @@ "use client"; import type { ReactNode } from "react"; -import type { ReviewSession, SessionStep } from "@/lib/api"; +import type { ActivityGroup, OverviewFile, ReviewSession, SessionStep } from "@/lib/api"; import { Callout } from "@/components/callout"; import { cardClass } from "@/components/page"; import { formatDate, formatDuration, Time } from "@/components/list"; -import { ExternalLinkIcon } from "@/components/icons"; +import { DataTable } from "@/components/data-table"; +import { Code } from "@/components/settings/code"; +import { Disclosure } from "@/components/disclosure"; +import { ChatIcon, ChevronRightIcon, EyeIcon, ExternalLinkIcon, LayersIcon, PenIcon, SearchIcon, WrenchIcon } from "@/components/icons"; import { focusRing } from "@/components/ui"; import { VerdictPill } from "../labels"; -import { findingsLabel, kindLabel, sessionSeconds, statusNote, stepOffset, triggerLabel } from "./session"; +import { + activityHeading, + droppedNote, + findingsLabel, + kindLabel, + offsetLabel, + OVERVIEW_FOLD_AFTER, + sessionSeconds, + statusNote, + timeline, + triggerLabel, +} from "./session"; // The session page's parts. Each takes the session and draws one card, so a // new kind of detail is one more section on the page. @@ -106,47 +120,223 @@ export function SessionOutcome({ session }: { session: ReviewSession }) { ); } -function StepRow({ step, startedAt, last, live }: { step: SessionStep; startedAt: string; last: boolean; live: boolean }) { - const offset = stepOffset(startedAt, step.at); +// ---- What the reviewer did ------------------------------------------------ + +const GROUP_ICONS: Record ReactNode> = { + search: SearchIcon, + view: EyeIcon, + find: LayersIcon, + lookup: WrenchIcon, + note: PenIcon, + comment: ChatIcon, +}; + +/** The dot on the timeline's line: pulsing while the entry is the one running now. */ +function Dot({ running }: { running: boolean }) { + return ( + + ); +} + +/** One row of the timeline, with the line down to the next row. */ +function Row({ kind, running, last, children }: { kind: string; running: boolean; last: boolean; children: ReactNode }) { return ( -
  • +
  • ); } -/** Every step so far, oldest first; the last one pulses while it runs. */ -export function SessionTimeline({ session }: { session: ReviewSession }) { - const steps = session.steps ?? []; +function Offset({ startedAt, at }: { startedAt: string; at: string }) { + const label = offsetLabel(startedAt, at, formatDuration); + if (!label) return null; + return ( + + ); +} + +function StepEntry({ step, startedAt }: { step: SessionStep; startedAt: string }) { + return ( + <> +
    + {step.text} + +
    + {step.detail && ( +
    + More +
    + {step.detail} +
    +
    + )} + + ); +} + +function NoteEntry({ group, startedAt }: { group: ActivityGroup; startedAt: string }) { + return ( + <> +
    + {group.title} + +
    + {group.text &&

    {group.text}

    } + + ); +} + +/** A group of steps of one kind: its title, and its queries, files or comments when opened. */ +function GroupEntry({ group, startedAt }: { group: ActivityGroup; startedAt: string }) { + const Icon = GROUP_ICONS[group.kind] ?? WrenchIcon; + const failed = group.items.filter((i) => i.failed).length; + return ( +
    + + + + {group.title} + {failed > 0 && {failed} failed} + + +
      + {group.items.map((item, i) => ( +
    • + {item.detail && group.kind === "lookup" && {item.detail}{item.label ? ": " : ""}} + {item.label && {item.label}} + {item.detail && group.kind === "comment" && {item.detail}} + {item.failed && (failed)} +
    • + ))} +
    +
    + ); +} + +/** + * The review as it happened, like a run log: setup steps, then what the + * reviewer searched, read and looked up (grouped by kind), the notes it wrote + * on what it was checking, and the comments it kept. Collapsible; the last + * entry pulses while the review runs. + */ +export function SessionActivity({ session, now }: { session: ReviewSession; now: number }) { + const entries = timeline(session.steps ?? [], session.activity ?? []); + const seconds = sessionSeconds(session, now); + const live = session.in_flight; + const dropped = droppedNote(session.activity_dropped); + return ( +
    +
    + + +

    + {activityHeading(session.status, session.kind)} +

    + {live &&
    + {entries.length ? ( +
      + {entries.map((e, i) => { + const last = i === entries.length - 1; + const running = last && live; + if (e.kind === "step") { + return ( + + + + ); + } + return ( + + {e.group.kind === "note" ? ( + + ) : ( + + )} + + ); + })} +
    + ) : ( +

    No steps yet.

    + )} + {dropped &&

    {dropped}

    } +
    +
    + ); +} + +// ---- The overview the review posted --------------------------------------- + +function FilesTable({ files }: { files: OverviewFile[] }) { + return ( + f.path} + columns={[ + { key: "file", header: "File", width: "grow", cell: (f) => {f.path} }, + { key: "description", header: "Description", width: "grow", cell: (f) => {f.description} }, + ]} + /> + ); +} + +/** What the PR does, its changes, and one line per file: the overview the review led with on GitHub. */ +export function SessionOverview({ session }: { session: ReviewSession }) { + const o = session.overview; + if (!o) return null; + const files = o.files ?? []; + const changes = o.changes ?? []; + const more = Math.max(0, (o.files_total ?? files.length) - files.length); + const total = o.files_total || files.length; return ( - - {steps.length ? ( -
      - {steps.map((s, i) => ( - - ))} -
    - ) : ( -

    No steps yet.

    + + {o.summary &&

    {o.summary}

    } + {changes.length > 0 && ( + <> +

    Changes

    +
      + {changes.map((c, i) => ( +
    • {c}
    • + ))} +
    + + )} + {files.length > 0 && ( + <> +

    Reviewed Changes

    +

    {total === 1 ? "1 changed file" : `${total} changed files`}

    +
    + {files.length > OVERVIEW_FOLD_AFTER ? ( + + + + ) : ( + + )} +
    + {more > 0 &&

    And {more} more {more === 1 ? "file" : "files"}.

    } + )}
    ); diff --git a/dashboard/src/app/reviewer/session/session.ts b/dashboard/src/app/reviewer/session/session.ts index ce0be215..7dccdfa0 100644 --- a/dashboard/src/app/reviewer/session/session.ts +++ b/dashboard/src/app/reviewer/session/session.ts @@ -112,3 +112,60 @@ export function findingsLabel(n: number | null | undefined): string | null { export function sessionHref(id: string): string { return `/reviewer/session?${new URLSearchParams({ id })}`; } + +/** One row of the activity timeline: a session step, or a group of what the reviewer did. */ +export type TimelineEntry = { kind: "step"; at: string; step: S } | { kind: "group"; at: string; group: G }; + +/** + * The session's steps (setup, posting) and the reviewer's activity groups in + * one list, oldest first. A step and a group at the same moment keep the + * step first; entries without a readable time keep their place after the + * ones before them. + */ +export function timeline( + steps: S[], + groups: G[], +): TimelineEntry[] { + const keyed: { entry: TimelineEntry; order: number; t: number }[] = []; + let last = -Infinity; + steps.forEach((step, i) => { + const t = ms(step.at) ?? last; + last = t; + keyed.push({ entry: { kind: "step", at: step.at, step }, order: i, t }); + }); + last = -Infinity; + groups.forEach((group, i) => { + const t = ms(group.started_at) ?? last; + last = t; + keyed.push({ entry: { kind: "group", at: group.started_at, group }, order: i, t }); + }); + keyed.sort( + (a, b) => + a.t - b.t || (a.entry.kind === b.entry.kind ? a.order - b.order : a.entry.kind === "step" ? -1 : 1), + ); + return keyed.map((k) => k.entry); +} + +/** The activity card's heading, by how the review stands. */ +export function activityHeading(status: string, kind = "review"): string { + const answering = kind === "question"; + if (status === "reviewing") return answering ? "Reading the comment" : "Reviewing pull request"; + if (status === "done") return answering ? "Read the comment" : "Reviewed pull request"; + if (status === "skipped") return "Looked at the pull request"; + return answering ? "Reading the comment" : "Reviewing pull request"; +} + +/** "+1m 4s" from the session's start; empty without a time. */ +export function offsetLabel(startedAt: string, at: string, format: (s: number) => string): string { + const s = stepOffset(startedAt, at); + return s === null ? "" : `+${format(s)}`; +} + +/** "3 more steps weren't recorded" past the review's cap; null when none were left out. */ +export function droppedNote(n: number | null | undefined): string | null { + if (!n || n <= 0) return null; + return n === 1 ? "1 more step wasn't recorded." : `${n} more steps weren't recorded.`; +} + +/** Above this many files the overview's table starts folded, as on GitHub. */ +export const OVERVIEW_FOLD_AFTER = 15; diff --git a/dashboard/src/lib/api-contract.ts b/dashboard/src/lib/api-contract.ts index 95a003a9..2908c3d5 100644 --- a/dashboard/src/lib/api-contract.ts +++ b/dashboard/src/lib/api-contract.ts @@ -6,7 +6,7 @@ // Nothing here runs; it is checked by the compiler only. import type { OpenApiFields } from "./openapi-fields"; -import type { AnswerRunResult, Plan, ReviewSession, Run, RunAnswer, RunDetail, RunDraftHold, RunDraftHoldReason, RunQuestion, RunTrigger, SessionStep, Task, api } from "./api"; +import type { ActivityGroup, ActivityItem, AnswerRunResult, OverviewFile, Plan, ReviewOverview, ReviewSession, Run, RunAnswer, RunDetail, RunDraftHold, RunDraftHoldReason, RunQuestion, RunTrigger, SessionStep, Task, api } from "./api"; type Answer = Awaited>; @@ -39,3 +39,8 @@ export type TaskContract = None>; // A review's session (the page a PR's "Coderhelm review" check links to). export type ReviewSessionContract = None>; export type SessionStepContract = None>; +// What the reviewer did while it read the PR, and the overview it posted. +export type ActivityGroupContract = None>; +export type ActivityItemContract = None>; +export type ReviewOverviewContract = None>; +export type OverviewFileContract = None>; diff --git a/dashboard/src/lib/api.ts b/dashboard/src/lib/api.ts index 1c675dec..483f6f09 100644 --- a/dashboard/src/lib/api.ts +++ b/dashboard/src/lib/api.ts @@ -1944,6 +1944,55 @@ export interface ReviewSession { check_run_id?: number | null; /** Oldest first. */ steps: SessionStep[]; + /** + * What the reviewer did while it read the PR, in groups of one kind + * ("Search 3 times", "View 4 files") and the notes it wrote. Oldest first; + * live while it runs. Only where it looked, never what it read. + */ + activity?: ActivityGroup[]; + /** Steps left out of `activity` past the review's cap. */ + activity_dropped?: number; + /** The "PR Overview" the review posted, once there is one. */ + overview?: ReviewOverview | null; +} + +/** One entry of an activity group: a query, a `path:lines`, a comment's place. */ +export interface ActivityItem { + /** RFC 3339. */ + at: string; + /** Empty for a tool shown by its name only. */ + label: string; + /** A comment's title, or the tool's name in words. */ + detail: string; + failed: boolean; +} + +/** Consecutive steps of one kind, or one note the reviewer wrote. */ +export interface ActivityGroup { + /** search · view · find · lookup · note · comment */ + kind: string; + /** "Search 3 times", or a note's heading. */ + title: string; + started_at: string; + ended_at: string; + /** A note's sentences. */ + text: string; + items: ActivityItem[]; +} + +export interface OverviewFile { + path: string; + description: string; +} + +/** The "PR Overview" a review leads with on GitHub. */ +export interface ReviewOverview { + /** What the PR does, in one sentence. */ + summary: string; + changes: string[]; + /** One line per changed file, in the diff's order (at most 100). */ + files: OverviewFile[]; + files_total: number; } export interface GateControlResult { diff --git a/dashboard/src/lib/openapi-fields.ts b/dashboard/src/lib/openapi-fields.ts index 95f95bb3..c5640fb7 100644 --- a/dashboard/src/lib/openapi-fields.ts +++ b/dashboard/src/lib/openapi-fields.ts @@ -2,10 +2,12 @@ // docs/api/openapi.json. Do not edit; run `npm run openapi:fields` instead. /** The platform commit this was generated from. */ -export const OPENAPI_REF = "bb81e2c5e8aa6a7eb152dbd602bc5406abc84aee"; +export const OPENAPI_REF = "96909edf327a381888d554ebd42c1a111147a6c7"; /** The fields each public API schema has. */ export interface OpenApiFields { + ActivityGroup: "ended_at" | "items" | "kind" | "started_at" | "text" | "title"; + ActivityItem: "at" | "detail" | "failed" | "label"; AnswerRun: "answers"; AnswerRunResult: "comment_url" | "posted" | "run_id" | "status"; Backfill: "complete"; @@ -37,6 +39,7 @@ export interface OpenApiFields { MeApiKey: "created_by" | "expires_at" | "id" | "name" | "rate_limit_per_minute"; MeFlags: "plugins"; NewPlanTask: "acceptance_criteria" | "description" | "destination" | "jira_project" | "repo" | "title"; + OverviewFile: "description" | "path"; Plan: "chat_id" | "created_at" | "description" | "destination" | "executed_at" | "executed_by" | "mcp_servers" | "plan_id" | "repo" | "status" | "task_count" | "title" | "tokens_in" | "tokens_out" | "updated_at"; PlanDestination: never; PlanExecution: "status" | "tasks_queued"; @@ -56,7 +59,8 @@ export interface OpenApiFields { ReposList: "repos"; Review: "action_summary" | "applied_standards" | "body" | "created_at" | "findings" | "head_sha" | "posted_as" | "pr_number" | "pr_title" | "rating_comments" | "repo" | "risk" | "sk" | "thumbs_down" | "thumbs_up" | "trigger" | "verdict"; ReviewFinding: "blocks" | "body" | "category" | "end_line" | "evidence" | "file" | "line" | "lookups" | "severity" | "suggestion" | "title"; - ReviewSession: "attempt" | "check_run_id" | "findings" | "finished_at" | "head_sha" | "id" | "in_flight" | "kind" | "pr_number" | "pr_title" | "reason" | "repo" | "review_url" | "started_at" | "status" | "steps" | "trigger" | "verdict"; + ReviewOverview: "changes" | "files" | "files_total" | "summary"; + ReviewSession: "activity" | "activity_dropped" | "attempt" | "check_run_id" | "findings" | "finished_at" | "head_sha" | "id" | "in_flight" | "kind" | "overview" | "pr_number" | "pr_title" | "reason" | "repo" | "review_url" | "started_at" | "status" | "steps" | "trigger" | "verdict"; ReviewsPage: "next" | "reviews"; RotateBody: "overlap_hours"; RotatedSecret: "previous_secret_expires_at" | "secret"; diff --git a/docs/content/docs/getting-started/reviewer.mdx b/docs/content/docs/getting-started/reviewer.mdx index af8f2d12..e82097dd 100644 --- a/docs/content/docs/getting-started/reviewer.mdx +++ b/docs/content/docs/getting-started/reviewer.mdx @@ -5,6 +5,10 @@ description: Turn on CoderHelm's reviewer for your team's pull requests, and con The reviewer reviews pull requests written by people (and by CoderHelm). It posts a real GitHub review, either **Approve** or **Request changes**, with comments on the lines that matter, and a risk level of low, medium or high. Changes that touch migrations, authentication, secrets or payments are always rated high. +## What a review looks like + +The review opens with a **PR Overview**: one sentence on what the pull request does, a short **Changes** list, and a **Reviewed Changes** table with one line per changed file. When more than 15 files changed, the table is folded so the review stays short. The verdict and the findings follow, and each finding is also a comment on the line it is about. + ## When it requests changes It requests changes only for a named correctness, security or data-loss problem, with the file and line and the evidence that shows it (the code path, a test or CI result, a data query, or the documentation of the tool involved). Before it posts, a final check looks at the whole pull request and its threads; when nothing named holds up, it approves instead and says what it assumed. @@ -31,6 +35,8 @@ Add the label to a pull request to get a review. Once a pull request has the lab While a review runs, the pull request shows a **CoderHelm review** check. Its **Details** link opens the review's session in CoderHelm: the steps so far, live while it runs, and the verdict with a link to the posted review once it is done. Each review has its own session, so an older check keeps showing its own review. +The session shows every step the reviewer took, grouped the way it worked: the searches it ran (with each query), the files it read (with the lines), the folders it listed and the other lookups it made, the short notes it wrote on what it was checking, and the comments it kept. Open a group to see its entries; the time beside each one is how far into the review it happened. Only where the reviewer looked is kept, never the contents it read, and secrets are removed before anything is saved. A long review keeps its first 200 steps and says how many more there were. The same page shows the review's PR Overview with its file table. + When the review is done, the check ends as neutral if the review has findings, and as success when it found nothing. The check needs the **Checks** permission on the GitHub App. Without it, reviews work as before, just with no check on the pull request. ## Talk to it on a pull request diff --git a/src/content/site.ts b/src/content/site.ts index 0920ff75..f16a3743 100644 --- a/src/content/site.ts +++ b/src/content/site.ts @@ -44,6 +44,7 @@ export const SITE = { "GitHub issue to pull request", "Jira ticket to pull request", "AI code review on any GitHub pull request", + "Code reviews that show every step they took and a file by file overview", "Fixes failing CI on its own pull requests", "Answers review comments and pushes fixes", "Learns from pull request outcomes, CI results and review feedback",