diff --git a/dashboard/e2e/audit-runs.spec.ts b/dashboard/e2e/audit-runs.spec.ts index dc3bad0b..89060818 100644 --- a/dashboard/e2e/audit-runs.spec.ts +++ b/dashboard/e2e/audit-runs.spec.ts @@ -434,8 +434,15 @@ const STANDING = { }, review_changes_requested: { code: "review_changes_requested", - text: "CoderHelm's review asks for changes on `9f8e7d6`; what it could not fix is listed as deferred on the pull request.", - next: "CoderHelm does not merge over its own review; the deferred findings say what each needs.", + text: "CoderHelm's review asks for changes on `9f8e7d6`; CoderHelm takes them in its next fix round.", + next: "The fix is pushed and its review reads the new head.", + needs_person: false, + link: null, + }, + building_plan: { + code: "building_plan", + text: "The plan still has tasks in `your-team/api`: CoderHelm is building them.", + next: "Its pull request opens linked to this one, with the order they merge in.", needs_person: false, link: null, }, @@ -525,7 +532,7 @@ test("a finished run never says a fix round is taking its review's findings", as await expect(outcome).not.toContainText("still working"); await expect(outcome).not.toContainText("a fix round is taking them"); await expect(page.getByTestId("merge-standing")).toHaveText("CoderHelm's review asks for changes on 6470f1d and no fix round is running on them."); - await expect(page.getByTestId("run-next")).toContainText("takes them in a fix round, or names on the pull request what only a person can do"); + await expect(page.getByTestId("run-next")).toContainText("CoderHelm takes them in its next fix round"); await expect(page.getByTestId("run-who")).toHaveText("Nothing needed from you"); await shot(page, "run-standing-finished-not-working"); expect(errors).toEqual([]); @@ -604,7 +611,7 @@ test("the top line says what the pull request waits on: a person's approval read await mockApi(page, { run: baseRun({ merge_standing: STANDING.needs_person_approval, checks: GREEN_CHECKS, preview: null }) }); await page.goto("/runs/detail/?id=01RUNDONE000000000000000A"); await expect(page.getByTestId("run-waiting-line")).toHaveText( - "Waiting on: an approving review from a person on #101 (this repo requires one before CoderHelm merges). Ready for review: checks passed.", + "Needs 1 approval from a person (repo rule) on #101. Ready for review: checks passed.", ); // It sits above the outcome card, which keeps its own detail. const line = await page.getByTestId("run-waiting-line").boundingBox(); @@ -617,7 +624,7 @@ test("the top line says what the pull request waits on: a person's approval read test("the server's line is shown as written, and a preview shows its checks and both widths", async ({ page }) => { const errors = watchConsole(page); const line = - "Waiting on: an approving review from a person on #101 (this repo requires one before CoderHelm merges). Ready for review: checks passed, preview checked."; + "Needs 1 approval from a person (repo rule) on #101. Ready for review: checks passed, preview checked."; await mockApi(page, { run: baseRun({ merge_standing: STANDING.needs_person_approval, checks: GREEN_CHECKS, preview: PREVIEW, waiting_line: line }) }); await stubShots(page); await page.goto("/runs/detail/?id=01RUNDONE000000000000000A"); @@ -645,11 +652,66 @@ test("a preview still deploying keeps the line from saying ready, and a check no }), }); await page.goto("/runs/detail/?id=01RUNDONE000000000000000A"); - await expect(page.getByTestId("run-waiting-line")).toHaveText("Waiting on: an approving review from a person on #101 (this repo requires one before CoderHelm merges)."); + await expect(page.getByTestId("run-waiting-line")).toHaveText("Needs 1 approval from a person (repo rule) on #101."); await expect(page.getByTestId("run-preview-check")).toContainText("not run yet"); await expect(page.getByTestId("run-preview-shot")).toHaveCount(0); }); +// One state: the "Needs a person" badge and the top line read the same standing, so the page +// never says a person is needed and "Nothing needed from you" at once. +test("CoderHelm's own review asking for changes is CoderHelm's wait: never a person in the line or the badge", async ({ page }) => { + const errors = watchConsole(page); + // An older gateway's line that named a person for CoderHelm's own review: never shown against the badge. + const stale = "Waiting on: a person, CoderHelm's review asks for changes on #101 it could not make (listed on the pull request)."; + await mockApi(page, { run: baseRun({ merge_standing: STANDING.review_changes_requested, waiting_line: stale }) }); + await page.goto("/runs/detail/?id=01RUNDONE000000000000000A"); + await expect(page.getByTestId("run-who")).toHaveText("Nothing needed from you"); + const line = page.getByTestId("run-waiting-line"); + await expect(line).toHaveText("Waiting on: CoderHelm's next fix round for the changes its review asked for on #101."); + await expect(line).not.toContainText("a person"); + await expect(page.getByText("Needs a person")).toHaveCount(0); + expect(errors).toEqual([]); +}); + +test("a run still building the other repository of its plan says so, and asks nobody", async ({ page }) => { + await mockApi(page, { run: baseRun({ merge_standing: STANDING.building_plan }) }); + await page.goto("/runs/detail/?id=01RUNDONE000000000000000A"); + await expect(page.getByTestId("run-outcome")).toContainText("Pull request #101 is open; CoderHelm is building the rest of the plan"); + await expect(page.getByTestId("run-who")).toHaveText("Nothing needed from you"); + await expect(page.getByTestId("run-waiting-line")).toHaveText("Waiting on: CoderHelm building the rest of the plan (its pull request opens linked to #101)."); +}); + +test("the repo's required approval is the only wait left: it reads exactly that, with the pull request linked", async ({ page }) => { + const errors = watchConsole(page); + await mockApi(page, { run: baseRun({ merge_standing: { ...STANDING.needs_person_approval, approvals: 1 }, checks: GREEN_CHECKS, preview: null }) }); + await page.goto("/runs/detail/?id=01RUNDONE000000000000000A"); + const line = page.getByTestId("run-waiting-line"); + await expect(line).toHaveText("Needs 1 approval from a person (repo rule) on #101. Ready for review: checks passed."); + await expect(page.getByTestId("run-waiting-line-pr")).toHaveAttribute("href", "https://github.com/your-team/web/pull/101"); + await expect(page.getByTestId("run-who")).toHaveText("Needs a person"); + expect(errors).toEqual([]); +}); + +test("a held draft whose reasons are CoderHelm's own never asks a person", async ({ page }) => { + await mockApi(page, { + run: baseRun({ + merge_standing: null, + draft_hold: { + kind: "held", + summary: "Finished, but pull request #101 stays a draft: the security audit didn't run.", + reasons: [{ what: "The security audit didn't run", todo: "" }], + pr_number: 101, + since: iso(5), + needs_person: false, + }, + }), + }); + await page.goto("/runs/detail/?id=01RUNDONE000000000000000A"); + await expect(page.getByTestId("run-who")).toHaveText("Nothing needed from you"); + await expect(page.getByTestId("run-waiting-line")).toContainText("Waiting on: CoderHelm"); + await expect(page.getByText("Needs a person")).toHaveCount(0); +}); + test("a run with no preview and no standing has no top line and no preview block", async ({ page }) => { await mockApi(page, { run: baseRun({ merge_standing: null, preview: { ...PREVIEW, stage: "not_needed" } }) }); await page.goto("/runs/detail/?id=01RUNDONE000000000000000A"); diff --git a/dashboard/e2e/landing-shots-runs.spec.ts b/dashboard/e2e/landing-shots-runs.spec.ts index 4933dafb..39f0ee1d 100644 --- a/dashboard/e2e/landing-shots-runs.spec.ts +++ b/dashboard/e2e/landing-shots-runs.spec.ts @@ -69,7 +69,7 @@ const RUN = { needs_person: true, link: "/reviewer/config", }, - waiting_line: "Waiting on: an approving review from a person on #412. Ready for review: checks passed, review comments answered.", + waiting_line: "Needs 1 approval from a person (repo rule) on #412. Ready for review: checks passed, review comments answered.", checks: { sha: "7c3e91ab52d04f6e8b1a9c2d3e4f5a6b7c8d9e0f", items: [ diff --git a/dashboard/e2e/run-draft-hold.spec.ts b/dashboard/e2e/run-draft-hold.spec.ts index e16861ba..3e7b780c 100644 --- a/dashboard/e2e/run-draft-hold.spec.ts +++ b/dashboard/e2e/run-draft-hold.spec.ts @@ -126,17 +126,18 @@ test("a held run says its pull request is a draft, with each reason and what to await shot(page, "run-draft-hold"); }); -test("a pull request GitHub refused to mark ready reads as needing attention", async ({ page }) => { +test("a pull request GitHub refused to mark ready is CoderHelm's to try again, never a person's", async ({ page }) => { await mockApi(page, run({ status: "completed", waiting_on: null, - draft_hold: { kind: "failed", summary: "Finished, but GitHub refused every try to mark pull request #318 ready.", reasons: [{ what: "GitHub refused to mark it ready (403)", todo: "Mark it ready on GitHub, or check the GitHub App's permissions on the repository." }], pr_number: 318, since: null }, + draft_hold: { kind: "failed", summary: "Finished, but GitHub refused every try to mark pull request #318 ready.", reasons: [{ what: "GitHub refused to mark it ready (403)", todo: "CoderHelm asks GitHub again within the hour." }], pr_number: 318, since: null }, })); await page.goto("/runs/detail?id=01RUNHOLD"); const outcome = page.getByTestId("run-outcome"); await expect(outcome).toHaveAttribute("data-tone", "attention"); await expect(outcome).toContainText("Pull request #318 couldn't be marked ready"); - await expect(outcome).toContainText("What to do: Mark it ready on GitHub"); + await expect(page.getByTestId("run-who")).toHaveText("Nothing needed from you"); + await expect(page.getByTestId("run-next")).toContainText("CoderHelm asks GitHub again within the hour"); await expect(outcome).not.toContainText("Held since"); // Not "Done. The change is ready for review." await expect(page.getByText("Pull request #318 is ready for review")).toHaveCount(0); diff --git a/dashboard/src/app/runs/detail/page.tsx b/dashboard/src/app/runs/detail/page.tsx index e9b095bd..174f7a6c 100644 --- a/dashboard/src/app/runs/detail/page.tsx +++ b/dashboard/src/app/runs/detail/page.tsx @@ -21,7 +21,7 @@ import type { CloseRunRequest } from "@/lib/api"; import { TeamAgentAsks } from "./team-asks"; import { RunOutputs } from "./run-outputs"; import { RunPreviewPanel } from "./run-preview"; -import { waitingLine } from "@/lib/waiting-line"; +import { holdNeedsPerson, waitingLine } from "@/lib/waiting-line"; import { RunAnswered, RunQuestions } from "./run-questions"; import { AsksHistory, WaitingOnYou, useRunApprovals } from "./agent-asks"; import { WorkUsedLine } from "@/components/work-used"; @@ -944,13 +944,16 @@ function RunDetailInner() { : hold.reasons.length > 1 ? `${prWords} is a draft: ${hold.reasons.length} things to deal with` : `${prWords} is a draft: 1 thing to deal with`, - who: hold.kind === "waiting" ? "none" : "you", + // One state: a person only for a reason the platform types as a person's. + who: holdNeedsPerson(hold) ? "you" : "none", next: hold.kind === "waiting" ? "CoderHelm marks it ready for review once the check passes." : hold.kind === "failed" - ? "Mark it ready on GitHub; nothing else is left." - : "Once each item is dealt with, CoderHelm checks again and marks it ready for review.", + ? "CoderHelm asks GitHub again within the hour; nothing is needed from you." + : holdNeedsPerson(hold) + ? "Once each item is dealt with, CoderHelm checks again and marks it ready for review." + : "CoderHelm settles each item itself, checks again and marks it ready for review.", // The summary repeats the first reason word for word; it shows only when there are no reasons. body: hold.reasons.length === 0 ? {hold.summary} : null, content: (hold.reasons.length > 0 || (run.status === "needs_input" && !!run.questions?.length)) && ( @@ -1243,7 +1246,7 @@ function RunDetailInner() { {topLine && (
- {topLine}
+