Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Check Wall of shame review reports in CI (#2151)

Regan Bellef328f3cac04
diff --git a/.github/workflows/wall-of-shame.yml b/.github/workflows/wall-of-shame.yml
new file mode 100644
index 000000000..dcc09d785
--- /dev/null
+++ b/.github/workflows/wall-of-shame.yml
@@ -0,0 +1,30 @@
+name: Wall of shame review
+
+on:
+ pull_request:
+ types: [opened, edited, synchronize, reopened]
+
+permissions:
+ contents: read
+
+concurrency:
+ group: wall-of-shame-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ wall-of-shame:
+ name: Wall of shame review
+ timeout-minutes: 3
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
+ with:
+ persist-credentials: false
+ - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
+ with:
+ node-version-file: .node-version
+ - name: Check the PR description's review report
+ env:
+ PR_BODY: ${{ github.event.pull_request.body }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: node scripts/wall-of-shame-check.ts
diff --git a/AGENTS.md b/AGENTS.md
index fa5bf8833..8faa9e1f7 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -69,7 +69,8 @@ Two habits that keep task-focused changes from scarring the rest of the repo:
reviewers reassess affected lenses and explicitly carry forward unaffected results.
These reviews run alongside PR work; before merging, every lens must have accepted
and all requested changes must be resolved. They supplement the correctness,
- security, and regression review above.
+ security, and regression review above. The `Wall of shame review` CI check fails
+ until the description's report covers every lens with an accepting verdict for the PR head.
- **Disclose config-matrix and database-schema changes in the PR description.** Name
added, removed, or changed settings, flags, modes, and providers, including changes to
defaults, precedence, and supported combinations. Name changed tables, columns,
diff --git a/scripts/wall-of-shame-check.ts b/scripts/wall-of-shame-check.ts
new file mode 100644
index 000000000..70d2bd01e
--- /dev/null
+++ b/scripts/wall-of-shame-check.ts
@@ -0,0 +1,60 @@
+import { readFileSync } from "node:fs";
+import { pathToFileURL } from "node:url";
+
+const section = (lines: string[], heading: string) => {
+ const start = lines.indexOf(heading);
+ if (start < 0) return undefined;
+ const level = `${heading.split(" ")[0]} `;
+ const end = lines.findIndex((line, i) => i > start && line.startsWith(level));
+ return lines.slice(start + 1, end < 0 ? undefined : end);
+};
+
+const lines = (text: string) => text.replaceAll("\r\n", "\n").split("\n");
+
+export function wallOfShameLenses(spec: string) {
+ return (section(lines(spec), "## Wall of shame") ?? [])
+ .filter((line) => line.startsWith("### "))
+ .map((line) => line.slice(4).split(" (")[0]!.trim());
+}
+
+export function wallOfShameProblems(spec: string, body: string, headSha: string) {
+ const report = section(lines(body), "## Wall of shame review report");
+ if (!report) return ["PR description has no `## Wall of shame review report` section."];
+ const problems: string[] = [];
+ const reviewed = report.find((line) => line.startsWith("Reviewed commit:"))?.split("`")[1];
+ if (reviewed !== headSha)
+ problems.push(`Reviewed commit is ${reviewed ?? "missing"}, but the PR head is ${headSha}.`);
+ const rows = report
+ .filter((line) => line.trim().startsWith("|"))
+ .map((line) =>
+ line
+ .split("|")
+ .slice(1, -1)
+ .map((cell) => cell.replaceAll("*", "").trim()),
+ );
+ for (const lens of wallOfShameLenses(spec)) {
+ const matches = rows.filter((cells) => cells[0] === lens);
+ if (matches.length > 1) problems.push(`${lens}: ${matches.length} review rows; keep one.`);
+ const [, reviewer, verdict, score, assessment] = matches[0] ?? [];
+ if (!verdict) problems.push(`${lens}: no review row.`);
+ else if (verdict.toLowerCase() !== "accept") problems.push(`${lens}: verdict is ${verdict}, not Accept.`);
+ if (verdict && !reviewer) problems.push(`${lens}: reviewer missing.`);
+ if (verdict && !/^(100|\d{1,2})\/100$/.test(score ?? "")) problems.push(`${lens}: score missing (expected N/100).`);
+ if (verdict && !assessment) problems.push(`${lens}: assessment missing.`);
+ }
+ return problems;
+}
+
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
+ const problems = wallOfShameProblems(
+ readFileSync("docs/SPEC.md", "utf8"),
+ process.env.PR_BODY ?? "",
+ process.env.HEAD_SHA ?? "",
+ );
+ if (problems.length) {
+ console.error("Wall of shame review incomplete (see AGENTS.md):");
+ for (const problem of problems) console.error(`- ${problem}`);
+ process.exit(1);
+ }
+ console.log("Wall of shame review: every lens accepted the PR head.");
+}
diff --git a/test/wall-of-shame-check.test.ts b/test/wall-of-shame-check.test.ts
new file mode 100644
index 000000000..911d85eec
--- /dev/null
+++ b/test/wall-of-shame-check.test.ts
@@ -0,0 +1,45 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import { wallOfShameLenses, wallOfShameProblems } from "../scripts/wall-of-shame-check.ts";
+
+const spec =
+ "## Wall of shame\n\n### Overengineering (6 examples)\n\n### Regex\n\n### Honorable mentions\n\n## Later\n\n### Not a lens\n";
+const head = "a".repeat(40);
+const body = (sha: string, rows: string[]) =>
+ `Summary\n\n## Wall of shame review report\n\nReviewed commit: \`${sha}\`.\n\n| Lens | Reviewer | Verdict | Score | Assessment |\n| --- | --- | --- | --- | --- |\n${rows.join("\n")}\n`;
+const row = (lens: string, verdict = "Accept") => `| ${lens} | R1 | ${verdict} | 90/100 | Fine. |`;
+
+test("lenses come from the spec's Wall of shame headings", () => {
+ assert.deepEqual(wallOfShameLenses(spec), ["Overengineering", "Regex", "Honorable mentions"]);
+});
+
+test("a complete accepted report for the head commit passes", () => {
+ assert.deepEqual(
+ wallOfShameProblems(
+ spec,
+ body(
+ head,
+ wallOfShameLenses(spec).map((l) => row(l)),
+ ),
+ head,
+ ),
+ [],
+ );
+});
+
+test("missing, rejected, and stale reviews fail", () => {
+ assert.deepEqual(
+ wallOfShameProblems(
+ spec,
+ body("b".repeat(40), [row("Overengineering", "Request changes"), row("Regex"), row("Regex")]),
+ head,
+ ),
+ [
+ `Reviewed commit is ${"b".repeat(40)}, but the PR head is ${head}.`,
+ "Overengineering: verdict is Request changes, not Accept.",
+ "Regex: 2 review rows; keep one.",
+ "Honorable mentions: no review row.",
+ ],
+ );
+ assert.equal(wallOfShameProblems(spec, "no report", head).length, 1);
+});