Public: anyone can read this; the crew can change it.
Revert "Production's releases tool lists the forge's own v* releases to an anonymous reader, so the v1 probe's two release lines pass" #15430
Check · Review · Land · Live done — Landed and live in production.
revert-15423 → main 0 commits
2 files
changed +2
−24
scripts/v1-probe.ts +2 −9
| @@ -215,18 +215,11 @@ 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 | } | |
| 225 | 218 | |
| 226 | 219 | // 3. The stranger journey's last green release, from the check API. |
| 227 | 220 | const checkPath = tagCommit ? `${api}/commits/${tagCommit}/check` : releasePath; |
| 228 | 221 | if (!read) say("stranger journey green on a release", "UNKNOWN", checkPath, `${unread}; a person must open the latest release's check`); |
| 229 | else if (!tagName || !tagCommit) say("stranger journey green on a release", "FAIL", checkPath, none); | |
| 222 | else if (!tagName || !tagCommit) say("stranger journey green on a release", "FAIL", checkPath, `the releases tool lists no release of ${repo}`); | |
| 230 | 223 | else { |
| 231 | 224 | const check = await get(checkPath); |
| 232 | 225 | const c = typeof check === "string" ? undefined : (json(check) as { state?: unknown; runId?: unknown; finishedAt?: unknown } | undefined); |
| @@ -241,7 +234,7 @@ export async function probe(base: string, repo: string, fetcher: Fetcher = fetch | ||
| 241 | 234 | // 4. /changelog, /changelog.atom and production's version agree with the newest release. |
| 242 | 235 | if (!announced) say("version agrees", "UNKNOWN", "/mcp", typeof init === "string" ? init : `initialize named no version or commit (${init.status})`); |
| 243 | 236 | else if (!read) say("version agrees", "UNKNOWN", releasePath, `production says ${announced.text}; ${unread}`); |
| 244 | else if (!read.release) say("version agrees", "FAIL", releasePath, `production says ${announced.text}; ${none}`); | |
| 237 | else if (!read.release) say("version agrees", "FAIL", releasePath, `production says ${announced.text}; the releases tool lists no release of ${repo}`); | |
| 245 | 238 | else { |
| 246 | 239 | const r = read.release; |
| 247 | 240 | const agrees = announced.kind === "version" ? r.version === announced.text : r.commit.startsWith(announced.text); |
test/v1-probe.test.ts −15
| @@ -18,11 +18,6 @@ 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; | |
| 26 | 21 | } |
| 27 | 22 | const green = (): World => ({ |
| 28 | 23 | version: "1.0.0", |
| @@ -31,7 +26,6 @@ const green = (): World => ({ | ||
| 31 | 26 | atomNames: true, |
| 32 | 27 | headers: true, |
| 33 | 28 | releases: [{ repo: "x/y", version: "9.9.9", commit: "d".repeat(40) }, { repo: "o/r", version: "1.0.0", commit: COMMIT }], |
| 34 | hosted: true, | |
| 35 | 29 | }); |
| 36 | 30 | let world = green(); |
| 37 | 31 | const seen: { method: string; path: string; mcp?: string }[] = []; |
| @@ -67,8 +61,6 @@ const server = Bun.serve({ | ||
| 67 | 61 | return json({ jsonrpc: "2.0", id: 1, result: { serverInfo: { name: "forge", version: world.version } } }); |
| 68 | 62 | case `/api/v1/repos/o/r/commits/${COMMIT}/check`: |
| 69 | 63 | 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); | |
| 72 | 64 | case "/api/v1/repos/o/r/schedules": |
| 73 | 65 | return world.runs === null ? json({ error: "not_found" }, 404) : json({ items: [], runs: world.runs }); |
| 74 | 66 | } |
| @@ -179,13 +171,6 @@ describe("v1 probe", () => { | ||
| 179 | 171 | expect(silent["version agrees"]!.evidence).toContain("production says 687c4ae; 403"); |
| 180 | 172 | }); |
| 181 | 173 | |
| 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 | ||
| 189 | 174 | test("sends only GETs, one MCP initialize and one releases call, all to the base host", async () => { |
| 190 | 175 | seen.length = 0; |
| 191 | 176 | const urls: string[] = []; |
new above
offline