Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 68 additions & 6 deletions dashboard/e2e/audit-runs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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([]);
Expand Down Expand Up @@ -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();
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion dashboard/e2e/landing-shots-runs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
7 changes: 4 additions & 3 deletions dashboard/e2e/run-draft-hold.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
34 changes: 28 additions & 6 deletions dashboard/src/app/runs/detail/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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";
Expand Down Expand Up @@ -326,7 +326,7 @@
if (idx > max) max = idx;
});
return max;
}, [run?.current_pass, run?.pass_history]);

Check warning on line 329 in dashboard/src/app/runs/detail/page.tsx

View workflow job for this annotation

GitHub Actions / Lint & Build

React Hook useMemo has a missing dependency: 'run'. Either include it or remove the dependency array

if (!runId) {
return (
Expand Down Expand Up @@ -944,13 +944,16 @@
: 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 ? <span className="whitespace-pre-wrap [overflow-wrap:anywhere]" data-testid="draft-hold-summary">{hold.summary}</span> : null,
content: (hold.reasons.length > 0 || (run.status === "needs_input" && !!run.questions?.length)) && (
Expand Down Expand Up @@ -1243,7 +1246,7 @@

{topLine && (
<p className="mt-4 text-sm font-medium text-zinc-100 [overflow-wrap:anywhere]" data-testid="run-waiting-line">
{topLine}
<WithPrLink line={topLine} number={prNumber} url={run.pr_url} />
</p>
)}

Expand Down Expand Up @@ -1583,15 +1586,34 @@
...standing,
code: "review_changes_requested",
text: `CoderHelm's review asks for changes${sha ? ` on \`${sha.slice(0, 7)}\`` : ""} and no fix round is running on them.`,
next: "CoderHelm looks at the pull request again: it takes them in a fix round, or names on the pull request what only a person can do and why.",
next: "CoderHelm takes them in its next fix round, and its review reads the new head.",
needs_person: false,
};
}

/** The line with its pull request's number ("#101") as a link to it. */
function WithPrLink({ line, number, url }: { line: string; number?: number | null; url?: string | null }) {
const token = number ? `#${number}` : "";
const at = token ? line.indexOf(token) : -1;
if (at < 0 || !url || !url.startsWith("https://github.com/")) return <>{line}</>;
return (
<>
{line.slice(0, at)}
<a href={url} target="_blank" rel="noopener noreferrer" className="underline underline-offset-2" data-testid="run-waiting-line-pr">
{token}
</a>
{line.slice(at + token.length)}
</>
);
}

/** The outcome's title for where a finished run's pull request stands: what is true now, never "still working" for a finished run. */
function standingTitle(standing: RunMergeStanding, prWords: string): string {
if (standing.code === "plan_needs_access") return `${prWords} is open; the rest of the plan needs access`;
if (standing.needs_person) return standing.code === "auto_merge_off" ? `${prWords} is ready to merge` : `${prWords} is ready for review`;
switch (standing.code) {
case "building_plan":
return `${prWords} is open; CoderHelm is building the rest of the plan`;
case "merged":
return `${prWords} is merged`;
case "closed":
Expand Down
4 changes: 4 additions & 0 deletions dashboard/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2568,6 +2568,8 @@ export interface RunDraftHold {
pr_number: number;
/** When it was first held for these reasons. */
since?: string | null;
/** A person must act: a reason only a person has (the platform's typed hand-off). Older gateways leave it out. */
needs_person?: boolean | null;
}

/** Where a finished run's pull request stands on its way to merge: the one reason that is true now. */
Expand All @@ -2580,6 +2582,8 @@ export interface RunMergeStanding {
next: string;
/** A person has to act for the merge to happen. */
needs_person: boolean;
/** Approving reviews from people the repository's rule requires (`needs_person_approval`, `repo_requires_person_review`); absent when not known. */
approvals?: number | null;
/** Where the rule is set, when a setting decides it: a dashboard path or a GitHub URL. */
link?: string | null;
}
Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/lib/openapi-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// docs/api/openapi.json. Do not edit; run `npm run openapi:fields` instead.

/** The platform commit this was generated from. */
export const OPENAPI_REF = "c0206416f191a0c9bde29d3a6bb87622dd13a77a";
export const OPENAPI_REF = "eb8f8f7c000a728eba36f7ca2cc373401effbdce";

/** The fields each public API schema has. */
export interface OpenApiFields {
Expand Down Expand Up @@ -76,10 +76,10 @@ export interface OpenApiFields {
RunCoderExploration: "calls_before_first_write" | "map_commit" | "tool_calls";
RunCoveredBy: "author" | "carried" | "note" | "number" | "open_items" | "outcome" | "own" | "reason" | "repo" | "superseded" | "title" | "url";
RunCoveredCarried: "branch" | "commits" | "files" | "head" | "rebuilt";
RunDraftHold: "kind" | "pr_number" | "reasons" | "since" | "summary";
RunDraftHold: "kind" | "needs_person" | "pr_number" | "reasons" | "since" | "summary";
RunDraftHoldReason: "todo" | "what";
RunExploration: "code_map" | "coder";
RunMergeStanding: "code" | "link" | "needs_person" | "next" | "text";
RunMergeStanding: "approvals" | "code" | "link" | "needs_person" | "next" | "text";
RunNoChange: "checks" | "open_pr" | "reason";
RunNoChangePr: "closed" | "line" | "number" | "repo" | "title" | "url" | "verdict" | "why";
RunNote: "message" | "timestamp";
Expand Down
Loading
Loading