Public: anyone can read this; the crew can change it.

The gate's "say how to try it on the preview" rule is a note, not a red check: it turned 449 pulls red in twelve days and approval got worse #14266

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/14247-the-gate-s-say-how-to-try-it-on-the-prev → main 1 commit fork 1 thread · 1 unresolved

  • Merged. mason/14247-the-gate-s-say-how-to-try-it-on-the-prev was merged into main as 59903fa.

Review

Sign in to review this change.
5 files changed +24 −15
scripts/gate.ts +6 −6
@@ -655,10 +655,11 @@ export async function addedRefusal(cwd: string = process.cwd()): Promise<string[
655655 }
656656
657657 /**
658 * A pull that changes a reachable surface must say how to try it on its
659 * preview (#8889). Same base and same pass-when-unknown as `pinRefusal`.
658 * A pull that changes a reachable surface should say how to try it on its
659 * preview (#8889): a note for the reviewer, never a refusal (#14247: it turned 449 pulls red in
660 * twelve days and first-review approval fell). Same base and pass-when-unknown as `pinRefusal`.
660661 */
661 export async function tryItRefusal(cwd: string = process.cwd()): Promise<string[]> {
662 export async function tryItNote(cwd: string = process.cwd()): Promise<string[]> {
662663 const { parseNameStatus } = await import("../src/kernel/pin_edits.ts");
663664 const { tryItProblems } = await import("../src/kernel/try_it.ts");
664665 const base =
@@ -818,7 +819,7 @@ export async function readmeCapRefusal(cwd: string = process.cwd()): Promise<str
818819
819820 /**
820821 * What the gate says of the clone at `cwd`: `notes` are only said, `refusal` fails the check
821 * (exit 2). The look rule is a note (#13362).
822 * (exit 2). The look, wrap and try-it rules are notes (#13362, #14247).
822823 */
823824 export async function gateVerdict(cwd: string = process.cwd()): Promise<{ notes: string[]; refusal: string[] }> {
824825 const present = presentTests(cwd);
@@ -826,7 +827,6 @@ export async function gateVerdict(cwd: string = process.cwd()): Promise<{ notes:
826827 ...gateRefusal(present),
827828 ...slowRefusal(present),
828829 ...(await pinRefusal(cwd)),
829 ...(await tryItRefusal(cwd)),
830830 ...(await bothDoorsRefusal(cwd)),
831831 ...(await testsWithChangeRefusal(cwd)),
832832 ...(await directionRefusal(cwd)),
@@ -838,7 +838,7 @@ export async function gateVerdict(cwd: string = process.cwd()): Promise<{ notes:
838838 ...(await readmeCapRefusal(cwd)),
839839 ...billingDeletesRefusal(cwd),
840840 ];
841 return { notes: [...wrapNote(cwd), ...(await lookNote(cwd))], refusal };
841 return { notes: [...wrapNote(cwd), ...(await lookNote(cwd)), ...(await tryItNote(cwd))], refusal };
842842 }
843843
844844 // `bun scripts/gate.ts`: the audit alone, first in `forge.json`'s check, so
src/kernel/try_it.ts +2 −1
@@ -5,7 +5,8 @@
55 * MCP tool, an action, a terminal screen) therefore says, in a commit
66 * message, `Try: <what to open or call on the preview>`. The check cannot
77 * read the pull description, so the line lives in a commit. It checks that
8 * a way to try the change was written, not that it works.
8 * a way to try the change was written, not that it works. The gate says it as a note and never
9 * fails a check on it (#14247).
910 */
1011
1112 import type { Change } from "./pin_edits.ts";
test/gate-look-note.test.ts +8
@@ -58,3 +58,11 @@ test("readTui reads the root it is given", () => {
5858 expect(readTui(dir, "src/http").map((f) => f.path)).toEqual(["src/http/server.ts"]);
5959 expect(readTui(dir, "src/nowhere")).toEqual([]);
6060 });
61
62 test("a missing Try line is a note for the reviewer and never a refusal (#14247)", async () => {
63 const { dir, base } = repo("Edit flow");
64 process.env.FORGE_CHECK_BASE = base;
65 const { notes, refusal } = await gateVerdict(dir);
66 expect(notes.some((n) => n.includes("say how to try it on the preview"))).toBe(true);
67 expect(refusal.filter((r) => r.includes("try it on the preview"))).toEqual([]);
68 });
test/gate-update-pull.test.ts +4 −4
@@ -2,7 +2,7 @@ import { afterAll, expect, test } from "bun:test";
22 import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
33 import { join } from "node:path";
44 import { tmpdir } from "node:os";
5 import { addedRefusal, dependencyRefusal, judgedHead, readmeCapRefusal, tryItRefusal } from "../scripts/gate.ts";
5 import { addedRefusal, dependencyRefusal, judgedHead, readmeCapRefusal, tryItNote } from "../scripts/gate.ts";
66
77 const root = mkdtempSync(join(tmpdir(), "gate-update-"));
88 afterAll(() => rmSync(root, { recursive: true, force: true }));
@@ -66,21 +66,21 @@ const UPDATE = "Take updates from trevato/forge";
6666 test("an update merge is judged on its own side: upstream's commits owe no Try line and no real timer", async () => {
6767 const { dir, base } = fork("update", UPDATE);
6868 expect(await withBase(base, async () => judgedHead(dir), "upstream")).toBe("HEAD^1");
69 expect(await withBase(base, () => tryItRefusal(dir), "upstream")).toEqual([]);
69 expect(await withBase(base, () => tryItNote(dir), "upstream")).toEqual([]);
7070 expect(await withBase(base, () => addedRefusal(dir), "upstream")).toEqual([]);
7171 });
7272
7373 test("the same merge under another name is judged whole", async () => {
7474 const { dir, base } = fork("plain", "Merge upstream");
7575 expect(await withBase(base, async () => judgedHead(dir), "upstream")).toBe("HEAD");
76 expect((await withBase(base, () => tryItRefusal(dir), "upstream")).length).toBe(1);
76 expect((await withBase(base, () => tryItNote(dir), "upstream")).length).toBe(1);
7777 expect((await withBase(base, () => addedRefusal(dir), "upstream")).length).toBe(1);
7878 });
7979
8080 test("the subject alone proves nothing: a second parent that is not upstream's is judged whole", async () => {
8181 const { dir, base } = fork("impostor", UPDATE, { merged: "sneaky" });
8282 expect(await withBase(base, async () => judgedHead(dir), "upstream")).toBe("HEAD");
83 expect((await withBase(base, () => tryItRefusal(dir), "upstream")).length).toBe(1);
83 expect((await withBase(base, () => tryItNote(dir), "upstream")).length).toBe(1);
8484 expect((await withBase(base, () => addedRefusal(dir), "upstream")).length).toBe(1);
8585 });
8686
test/try-it.test.ts +4 −4
@@ -2,7 +2,7 @@ import { afterAll, expect, test } from "bun:test";
22 import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
33 import { join } from "node:path";
44 import { tmpdir } from "node:os";
5 import { tryItRefusal } from "../scripts/gate.ts";
5 import { tryItNote } from "../scripts/gate.ts";
66 import { surfaceChanged, tryItProblems } from "../src/kernel/try_it.ts";
77
88 const ch = (status: string, path: string) => ({ status, path });
@@ -97,11 +97,11 @@ const withBase = async (base: string, f: () => Promise<string[]>) => {
9797 }
9898 };
9999
100 test("tryItRefusal reads a real repo: refused bare, passed with a Try line", async () => {
100 test("tryItNote reads a real repo: refused bare, passed with a Try line", async () => {
101101 const bare = pull("bare", "Add x");

The title still says "refused", but this is a note now. Rename it to "noted bare, passed with a Try line".

102 const out = await withBase(bare.base, () => tryItRefusal(bare.dir));
102 const out = await withBase(bare.base, () => tryItNote(bare.dir));
103103 expect(out).toHaveLength(1);
104104 expect(out[0]).toContain("say how to try it on the preview");
105105 const ok = pull("ok", "Add x\n\nTry: open /x on the preview and read the heading");
106 expect(await withBase(ok.base, () => tryItRefusal(ok.dir))).toEqual([]);
106 expect(await withBase(ok.base, () => tryItNote(ok.dir))).toEqual([]);
107107 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs