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

Production's releases tool lists the forge's own v* releases to an anonymous reader, so the v1 probe's two release lines pass #15423

Merged opened this

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

Merged

mason/forge:mason/15422-production-s-releases-tool-lists-the-for → main 0 commits fork

  • Merged. mason/15422-production-s-releases-tool-lists-the-for was merged into main as b104b99.

Review

Sign in to review this change.
2 files changed +24 −2
scripts/v1-probe.ts +9 −2
@@ -215,11 +215,18 @@ export async function probe(base: string, repo: string, fetcher: Fetcher = fetch
215215 const tagName = read?.release?.name;
216216 const tagCommit = read?.release?.commit;
217217 const unread = typeof shipped === "string" ? shipped : `${shipped.status}, the releases tool did not answer its JSON`;
218 // None listed: a forge that hosts no such repository (an app running this code with its own
219 // database, #15422) says so, rather than looking like a forge that cut no release.
220 let none = `the releases tool lists no release of ${repo}`;
221 if (read && !read.release) {
222 const hosted = await get(api);
223 if (typeof hosted !== "string" && hosted.status === 404) none = `${origin} hosts no ${repo} (${at(api)} answers 404): probe the forge that holds it`;
224 }
218225
219226 // 3. The stranger journey's last green release, from the check API.
220227 const checkPath = tagCommit ? `${api}/commits/${tagCommit}/check` : releasePath;
221228 if (!read) say("stranger journey green on a release", "UNKNOWN", checkPath, `${unread}; a person must open the latest release's check`);
222 else if (!tagName || !tagCommit) say("stranger journey green on a release", "FAIL", checkPath, `the releases tool lists no release of ${repo}`);
229 else if (!tagName || !tagCommit) say("stranger journey green on a release", "FAIL", checkPath, none);
223230 else {
224231 const check = await get(checkPath);
225232 const c = typeof check === "string" ? undefined : (json(check) as { state?: unknown; runId?: unknown; finishedAt?: unknown } | undefined);
@@ -234,7 +241,7 @@ export async function probe(base: string, repo: string, fetcher: Fetcher = fetch
234241 // 4. /changelog, /changelog.atom and production's version agree with the newest release.
235242 if (!announced) say("version agrees", "UNKNOWN", "/mcp", typeof init === "string" ? init : `initialize named no version or commit (${init.status})`);
236243 else if (!read) say("version agrees", "UNKNOWN", releasePath, `production says ${announced.text}; ${unread}`);
237 else if (!read.release) say("version agrees", "FAIL", releasePath, `production says ${announced.text}; the releases tool lists no release of ${repo}`);
244 else if (!read.release) say("version agrees", "FAIL", releasePath, `production says ${announced.text}; ${none}`);
238245 else {
239246 const r = read.release;
240247 const agrees = announced.kind === "version" ? r.version === announced.text : r.commit.startsWith(announced.text);
test/v1-probe.test.ts +15
@@ -18,6 +18,11 @@ interface World {
1818 headers: boolean;
1919 /** What the token-free `releases` tool lists; null when it does not answer. */
2020 releases: { repo: string; version: string; commit: string }[] | null;
21 /**
22 * Whether this forge holds the probed repository: false is an app with a database of its own
23 * (#15422).
24 */
25 hosted: boolean;
2126 }
2227 const green = (): World => ({
2328 version: "1.0.0",
@@ -26,6 +31,7 @@ const green = (): World => ({
2631 atomNames: true,
2732 headers: true,
2833 releases: [{ repo: "x/y", version: "9.9.9", commit: "d".repeat(40) }, { repo: "o/r", version: "1.0.0", commit: COMMIT }],
34 hosted: true,
2935 });
3036 let world = green();
3137 const seen: { method: string; path: string; mcp?: string }[] = [];
@@ -61,6 +67,8 @@ const server = Bun.serve({
6167 return json({ jsonrpc: "2.0", id: 1, result: { serverInfo: { name: "forge", version: world.version } } });
6268 case `/api/v1/repos/o/r/commits/${COMMIT}/check`:
6369 return world.checkState === null ? html("Just a moment...", 403) : json({ state: world.checkState, runId: "run1" });
70 case "/api/v1/repos/o/r":
71 return world.hosted ? json({ ownerName: "o", name: "r", visibility: "public" }) : json({ error: "not_found" }, 404);
6472 case "/api/v1/repos/o/r/schedules":
6573 return world.runs === null ? json({ error: "not_found" }, 404) : json({ items: [], runs: world.runs });
6674 }
@@ -171,6 +179,13 @@ describe("v1 probe", () => {
171179 expect(silent["version agrees"]!.evidence).toContain("production says 687c4ae; 403");
172180 });
173181
182 test("none listed by a forge that hosts no such repository says so, not that no release was cut (#15422)", async () => {
183 const r = await run({ releases: [], hosted: false });
184 expect(r["stranger journey green on a release"]!.verdict).toBe("FAIL");
185 expect(r["stranger journey green on a release"]!.evidence).toBe(`${base} hosts no o/r (${base}/api/v1/repos/o/r answers 404): probe the forge that holds it`);
186 expect(r["version agrees"]!.evidence).toBe(`production says 1.0.0; ${base} hosts no o/r (${base}/api/v1/repos/o/r answers 404): probe the forge that holds it`);
187 });
188
174189 test("sends only GETs, one MCP initialize and one releases call, all to the base host", async () => {
175190 seen.length = 0;
176191 const urls: string[] = [];

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs