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
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/15422-production-s-releases-tool-lists-the-for → main 0 commits fork
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 | ||
| 215 | 215 | const tagName = read?.release?.name; |
| 216 | 216 | const tagCommit = read?.release?.commit; |
| 217 | 217 | 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 | } | |
| 218 | 225 | |
| 219 | 226 | // 3. The stranger journey's last green release, from the check API. |
| 220 | 227 | const checkPath = tagCommit ? `${api}/commits/${tagCommit}/check` : releasePath; |
| 221 | 228 | 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); | |
| 223 | 230 | else { |
| 224 | 231 | const check = await get(checkPath); |
| 225 | 232 | 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 | ||
| 234 | 241 | // 4. /changelog, /changelog.atom and production's version agree with the newest release. |
| 235 | 242 | if (!announced) say("version agrees", "UNKNOWN", "/mcp", typeof init === "string" ? init : `initialize named no version or commit (${init.status})`); |
| 236 | 243 | 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}`); | |
| 238 | 245 | else { |
| 239 | 246 | const r = read.release; |
| 240 | 247 | 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 { | ||
| 18 | 18 | headers: boolean; |
| 19 | 19 | /** What the token-free `releases` tool lists; null when it does not answer. */ |
| 20 | 20 | 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; | |
| 21 | 26 | } |
| 22 | 27 | const green = (): World => ({ |
| 23 | 28 | version: "1.0.0", |
| @@ -26,6 +31,7 @@ const green = (): World => ({ | ||
| 26 | 31 | atomNames: true, |
| 27 | 32 | headers: true, |
| 28 | 33 | releases: [{ repo: "x/y", version: "9.9.9", commit: "d".repeat(40) }, { repo: "o/r", version: "1.0.0", commit: COMMIT }], |
| 34 | hosted: true, | |
| 29 | 35 | }); |
| 30 | 36 | let world = green(); |
| 31 | 37 | const seen: { method: string; path: string; mcp?: string }[] = []; |
| @@ -61,6 +67,8 @@ const server = Bun.serve({ | ||
| 61 | 67 | return json({ jsonrpc: "2.0", id: 1, result: { serverInfo: { name: "forge", version: world.version } } }); |
| 62 | 68 | case `/api/v1/repos/o/r/commits/${COMMIT}/check`: |
| 63 | 69 | 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); | |
| 64 | 72 | case "/api/v1/repos/o/r/schedules": |
| 65 | 73 | return world.runs === null ? json({ error: "not_found" }, 404) : json({ items: [], runs: world.runs }); |
| 66 | 74 | } |
| @@ -171,6 +179,13 @@ describe("v1 probe", () => { | ||
| 171 | 179 | expect(silent["version agrees"]!.evidence).toContain("production says 687c4ae; 403"); |
| 172 | 180 | }); |
| 173 | 181 | |
| 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 | ||
| 174 | 189 | test("sends only GETs, one MCP initialize and one releases call, all to the base host", async () => { |
| 175 | 190 | seen.length = 0; |
| 176 | 191 | const urls: string[] = []; |
new above
offline