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
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/14247-the-gate-s-say-how-to-try-it-on-the-prev → main 1 commit fork 1 thread · 1 unresolved
5 files
changed +24
−15
scripts/gate.ts +6 −6
| @@ -655,10 +655,11 @@ export async function addedRefusal(cwd: string = process.cwd()): Promise<string[ | ||
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | /** |
| 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`. | |
| 660 | 661 | */ |
| 661 | export async function tryItRefusal(cwd: string = process.cwd()): Promise<string[]> { | |
| 662 | export async function tryItNote(cwd: string = process.cwd()): Promise<string[]> { | |
| 662 | 663 | const { parseNameStatus } = await import("../src/kernel/pin_edits.ts"); |
| 663 | 664 | const { tryItProblems } = await import("../src/kernel/try_it.ts"); |
| 664 | 665 | const base = |
| @@ -818,7 +819,7 @@ export async function readmeCapRefusal(cwd: string = process.cwd()): Promise<str | ||
| 818 | 819 | |
| 819 | 820 | /** |
| 820 | 821 | * 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). | |
| 822 | 823 | */ |
| 823 | 824 | export async function gateVerdict(cwd: string = process.cwd()): Promise<{ notes: string[]; refusal: string[] }> { |
| 824 | 825 | const present = presentTests(cwd); |
| @@ -826,7 +827,6 @@ export async function gateVerdict(cwd: string = process.cwd()): Promise<{ notes: | ||
| 826 | 827 | ...gateRefusal(present), |
| 827 | 828 | ...slowRefusal(present), |
| 828 | 829 | ...(await pinRefusal(cwd)), |
| 829 | ...(await tryItRefusal(cwd)), | |
| 830 | 830 | ...(await bothDoorsRefusal(cwd)), |
| 831 | 831 | ...(await testsWithChangeRefusal(cwd)), |
| 832 | 832 | ...(await directionRefusal(cwd)), |
| @@ -838,7 +838,7 @@ export async function gateVerdict(cwd: string = process.cwd()): Promise<{ notes: | ||
| 838 | 838 | ...(await readmeCapRefusal(cwd)), |
| 839 | 839 | ...billingDeletesRefusal(cwd), |
| 840 | 840 | ]; |
| 841 | return { notes: [...wrapNote(cwd), ...(await lookNote(cwd))], refusal }; | |
| 841 | return { notes: [...wrapNote(cwd), ...(await lookNote(cwd)), ...(await tryItNote(cwd))], refusal }; | |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | // `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 @@ | ||
| 5 | 5 | * MCP tool, an action, a terminal screen) therefore says, in a commit |
| 6 | 6 | * message, `Try: <what to open or call on the preview>`. The check cannot |
| 7 | 7 | * 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). | |
| 9 | 10 | */ |
| 10 | 11 | |
| 11 | 12 | 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", () => { | ||
| 58 | 58 | expect(readTui(dir, "src/http").map((f) => f.path)).toEqual(["src/http/server.ts"]); |
| 59 | 59 | expect(readTui(dir, "src/nowhere")).toEqual([]); |
| 60 | 60 | }); |
| 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"; | ||
| 2 | 2 | import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; |
| 3 | 3 | import { join } from "node:path"; |
| 4 | 4 | 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"; | |
| 6 | 6 | |
| 7 | 7 | const root = mkdtempSync(join(tmpdir(), "gate-update-")); |
| 8 | 8 | afterAll(() => rmSync(root, { recursive: true, force: true })); |
| @@ -66,21 +66,21 @@ const UPDATE = "Take updates from trevato/forge"; | ||
| 66 | 66 | test("an update merge is judged on its own side: upstream's commits owe no Try line and no real timer", async () => { |
| 67 | 67 | const { dir, base } = fork("update", UPDATE); |
| 68 | 68 | 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([]); | |
| 70 | 70 | expect(await withBase(base, () => addedRefusal(dir), "upstream")).toEqual([]); |
| 71 | 71 | }); |
| 72 | 72 | |
| 73 | 73 | test("the same merge under another name is judged whole", async () => { |
| 74 | 74 | const { dir, base } = fork("plain", "Merge upstream"); |
| 75 | 75 | 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); | |
| 77 | 77 | expect((await withBase(base, () => addedRefusal(dir), "upstream")).length).toBe(1); |
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | 80 | test("the subject alone proves nothing: a second parent that is not upstream's is judged whole", async () => { |
| 81 | 81 | const { dir, base } = fork("impostor", UPDATE, { merged: "sneaky" }); |
| 82 | 82 | 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); | |
| 84 | 84 | expect((await withBase(base, () => addedRefusal(dir), "upstream")).length).toBe(1); |
| 85 | 85 | }); |
| 86 | 86 |
test/try-it.test.ts +4 −4
| @@ -2,7 +2,7 @@ import { afterAll, expect, test } from "bun:test"; | ||
| 2 | 2 | import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; |
| 3 | 3 | import { join } from "node:path"; |
| 4 | 4 | import { tmpdir } from "node:os"; |
| 5 | import { tryItRefusal } from "../scripts/gate.ts"; | |
| 5 | import { tryItNote } from "../scripts/gate.ts"; | |
| 6 | 6 | import { surfaceChanged, tryItProblems } from "../src/kernel/try_it.ts"; |
| 7 | 7 | |
| 8 | 8 | const ch = (status: string, path: string) => ({ status, path }); |
| @@ -97,11 +97,11 @@ const withBase = async (base: string, f: () => Promise<string[]>) => { | ||
| 97 | 97 | } |
| 98 | 98 | }; |
| 99 | 99 | |
| 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 () => { | |
| 101 | 101 | const bare = pull("bare", "Add x"); |
| 102 | const out = await withBase(bare.base, () => tryItRefusal(bare.dir)); | |
| 102 | const out = await withBase(bare.base, () => tryItNote(bare.dir)); | |
| 103 | 103 | expect(out).toHaveLength(1); |
| 104 | 104 | expect(out[0]).toContain("say how to try it on the preview"); |
| 105 | 105 | 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([]); | |
| 107 | 107 | }); |
new above
offline
The title still says "refused", but this is a note now. Rename it to "noted bare, passed with a Try line".