Public: anyone can read this; the crew can change it.
The v1 probe reads the running release from the running commit, so it cannot FAIL for a missing listing while production is live #15476
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15473-the-v1-probe-reads-the-running-release-f → main 0 commits fork
3 files
changed +29
−7
docs/OPERATING.md +1
| @@ -364,6 +364,7 @@ of this check only, never loaded by the server: its rules need a rendered page | ||
| 364 | 364 | and an accessibility tree, which nothing dependency-free gives. |
| 365 | 365 | |
| 366 | 366 | `bun scripts/v1-probe.ts https://forge.open-platform.sh` reads production (GETs and one MCP initialize, never signed in) and prints PASS, FAIL or UNKNOWN per v1.0.0 item with its URL and evidence. |
| 367 | The release it checks is the newest the MCP `releases` tool lists for the repository; when none is listed but the answer names the running `version` and `commit` (production live, `"live":[]`), that running build is the release, read from `GET /api/v1/repos/<repo>/commits/<sha>/check` and compared to what production announces, and its lines say `running v…`. Only an answer that lists none and names no running commit FAILs for a missing release (#15473). | |
| 367 | 368 | `--edition <url>` names a public page a scheduled app prints (the morning paper's latest edition): its newest `<time datetime>` proves the schedules line, PASS within 24 h, FAIL older, UNKNOWN when the page is not public. Without it that line is UNKNOWN, because the schedules API answers 404 to an anonymous read. No public page prints a dated edition yet: the morning paper posts only in the signed-in Captain thread. #15393 adds one, and that page is the URL to pass. |
| 368 | 369 | The `schedules ran in 24 h` line reads a public page's newest `<time datetime>`: pass `--edition https://forge.open-platform.sh/edition`. That page (`src/http/edition.ts`) prints when the newest morning paper ran and nothing of the thread it was posted in; before any paper has run it prints no `<time>`. Its ETag holds the newest run and the build, so a deploy never answers 304 to older markup; signed-in and flash responses are never tagged. The paper is written by the routine clock (`startRoutines` in `src/crew/routines.ts`, a pass every minute, the paper at 07:00 UTC), which starts only when the crew does: a preview, where the crew is held off, never prints one and its `/edition` stays without a `<time>`. Probe production, not a preview (#15405). |
| 369 | 370 | The owner tags v1.0.0 only when every line is PASS; an UNKNOWN line names what a person must check, and is not a pass. |
scripts/v1-probe.ts +11 −4
| @@ -121,11 +121,15 @@ export interface Release { | ||
| 121 | 121 | readonly name: string; |
| 122 | 122 | readonly version: string | undefined; |
| 123 | 123 | readonly commit: string; |
| 124 | /** True when no release is listed and this is the running build the answer names (#15473). */ | |
| 125 | readonly running?: true; | |
| 124 | 126 | } |
| 125 | 127 | |
| 126 | 128 | /** |
| 127 | 129 | * The newest release of `repo` from a `tools/call releases` JSON-RPC answer: undefined when the |
| 128 | * answer is not the tool's JSON (no source answered), `{ release: undefined }` when it lists none. | |
| 130 | * answer is not the tool's JSON (no source answered), `{ release: undefined }` when it lists none | |
| 131 | * and names no running commit. A production whose release is not listed (`"live":[]`) still names | |
| 132 | * the `version` and `commit` it runs: that build is the release (#15473). | |
| 129 | 133 | */ |
| 130 | 134 | export function newestRelease(answer: unknown, repo: string): { release: Release | undefined } | undefined { |
| 131 | 135 | const text = (answer as { result?: { content?: { text?: unknown }[] } } | undefined)?.result?.content?.[0]?.text; |
| @@ -143,7 +147,10 @@ export function newestRelease(answer: unknown, repo: string): { release: Release | ||
| 143 | 147 | const version = typeof item.version === "string" && item.version !== "" ? item.version.replace(/^v/, "") : undefined; |
| 144 | 148 | return { release: { name: version ? `v${version}` : item.commit.slice(0, 7), version, commit: item.commit } }; |
| 145 | 149 | } |
| 146 | return { release: undefined }; | |
| 150 | const top = value as { version?: unknown; commit?: unknown }; | |
| 151 | if (typeof top.commit !== "string" || !/^[0-9a-f]{40}$/.test(top.commit)) return { release: undefined }; | |
| 152 | const version = typeof top.version === "string" && /^v?\d+\.\d+\.\d+$/.test(top.version) ? top.version.replace(/^v/, "") : undefined; | |
| 153 | return { release: { name: `running ${version ? `v${version}` : top.commit.slice(0, 7)}`, version, commit: top.commit, running: true } }; | |
| 147 | 154 | } |
| 148 | 155 | |
| 149 | 156 | /** |
| @@ -223,7 +230,7 @@ export async function probe(base: string, repo: string, fetcher: Fetcher = fetch | ||
| 223 | 230 | // 3. The stranger journey's last green release, from the check API. |
| 224 | 231 | const checkPath = tagCommit ? `${api}/commits/${tagCommit}/check` : releasePath; |
| 225 | 232 | if (!read) say("stranger journey green on a release", "UNKNOWN", checkPath, `${unread}; a person must open the latest release's check`); |
| 226 | else if (!tagName || !tagCommit) say("stranger journey green on a release", "FAIL", checkPath, `the releases tool lists no release of ${repo}`); | |
| 233 | else if (!tagName || !tagCommit) say("stranger journey green on a release", "FAIL", checkPath, `the releases tool lists no release of ${repo} and names no running commit`); | |
| 227 | 234 | else { |
| 228 | 235 | const check = await get(checkPath); |
| 229 | 236 | const c = typeof check === "string" ? undefined : (json(check) as { state?: unknown; runId?: unknown; finishedAt?: unknown } | undefined); |
| @@ -238,7 +245,7 @@ export async function probe(base: string, repo: string, fetcher: Fetcher = fetch | ||
| 238 | 245 | // 4. /changelog, /changelog.atom and production's version agree with the newest release. |
| 239 | 246 | if (!announced) say("version agrees", "UNKNOWN", "/mcp", typeof init === "string" ? init : `initialize named no version or commit (${init.status})`); |
| 240 | 247 | else if (!read) say("version agrees", "UNKNOWN", releasePath, `production says ${announced.text}; ${unread}`); |
| 241 | else if (!read.release) say("version agrees", "FAIL", releasePath, `production says ${announced.text}; the releases tool lists no release of ${repo}`); | |
| 248 | else if (!read.release) say("version agrees", "FAIL", releasePath, `production says ${announced.text}; the releases tool lists no release of ${repo} and names no running commit`); | |
| 242 | 249 | else { |
| 243 | 250 | const r = read.release; |
| 244 | 251 | const agrees = announced.kind === "version" ? r.version === announced.text : r.commit.startsWith(announced.text); |
test/v1-probe.test.ts +17 −3
| @@ -18,6 +18,8 @@ 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 | /** The running build the answer names beside its list (#15473). */ | |
| 22 | running?: { version: string | null; commit: string | null }; | |
| 21 | 23 | /** The keeper's heartbeat, served only to `Bearer t` (#15449). */ |
| 22 | 24 | beat?: { at: string; outcome: string; reason: string; silent: boolean } | null; |
| 23 | 25 | } |
| @@ -57,7 +59,7 @@ const server = Bun.serve({ | ||
| 57 | 59 | case "/mcp": |
| 58 | 60 | if (call?.method === "tools/call") { |
| 59 | 61 | if (world.releases === null) return html("Just a moment...", 403); |
| 60 | const text = JSON.stringify({ version: null, commit: COMMIT, releases: world.releases }); | |
| 62 | const text = JSON.stringify({ ...(world.running ?? { version: null, commit: COMMIT }), live: [], releases: world.releases }); | |
| 61 | 63 | return json({ jsonrpc: "2.0", id: 2, result: { content: [{ type: "text", text }] } }); |
| 62 | 64 | } |
| 63 | 65 | return json({ jsonrpc: "2.0", id: 1, result: { serverInfo: { name: "forge", version: world.version } } }); |
| @@ -166,16 +168,28 @@ describe("v1 probe", () => { | ||
| 166 | 168 | test("the release is read from the token-free releases tool; none listed is FAIL, no answer is UNKNOWN (#15387)", async () => { |
| 167 | 169 | const r = await run({}); |
| 168 | 170 | expect(r["stranger journey green on a release"]!.evidence).toContain("v1.0.0 (ccccccccc) full check ok"); |
| 169 | const none = await run({ releases: [{ repo: "x/y", version: "9.9.9", commit: "d".repeat(40) }] }); | |
| 171 | const none = await run({ releases: [{ repo: "x/y", version: "9.9.9", commit: "d".repeat(40) }], running: { version: null, commit: null } }); | |
| 170 | 172 | expect(none["stranger journey green on a release"]!.verdict).toBe("FAIL"); |
| 173 | expect(none["stranger journey green on a release"]!.evidence).toBe("the releases tool lists no release of o/r and names no running commit"); | |
| 171 | 174 | expect(none["version agrees"]!.verdict).toBe("FAIL"); |
| 172 | expect(none["version agrees"]!.evidence).toBe("production says 1.0.0; the releases tool lists no release of o/r"); | |
| 175 | expect(none["version agrees"]!.evidence).toBe("production says 1.0.0; the releases tool lists no release of o/r and names no running commit"); | |
| 173 | 176 | const silent = await run({ releases: null, version: "687c4ae" }); |
| 174 | 177 | expect(silent["stranger journey green on a release"]!.verdict).toBe("UNKNOWN"); |
| 175 | 178 | expect(silent["version agrees"]!.verdict).toBe("UNKNOWN"); |
| 176 | 179 | expect(silent["version agrees"]!.evidence).toContain("production says 687c4ae; 403"); |
| 177 | 180 | }); |
| 178 | 181 | |
| 182 | test("no release listed but a running version and commit named: that build is the release, read from its check (#15473)", async () => { | |
| 183 | const r = await run({ releases: [], running: { version: "1.0.0", commit: COMMIT } }); | |
| 184 | expect(r["stranger journey green on a release"]!.verdict).toBe("PASS"); | |
| 185 | expect(r["stranger journey green on a release"]!.evidence).toBe("running v1.0.0 (ccccccccc) full check ok, run run1, which runs the stranger tests"); | |
| 186 | expect(r["version agrees"]!.verdict).toBe("PASS"); | |
| 187 | expect(r["version agrees"]!.evidence).toBe("production 1.0.0 = release running v1.0.0, named by /changelog and /changelog.atom"); | |
| 188 | expect((await run({ releases: [], running: { version: "1.0.0", commit: COMMIT }, checkState: "failed" }))["stranger journey green on a release"]!.verdict).toBe("FAIL"); | |
| 189 | const trails = await run({ releases: [], running: { version: "0.9.0", commit: COMMIT } }); | |
| 190 | expect(trails["version agrees"]!.evidence).toBe("production says 1.0.0, the newest release running v0.9.0 is 0.9.0"); | |
| 191 | }); | |
| 192 | ||
| 179 | 193 | test("sends only GETs, one MCP initialize and one releases call, all to the base host", async () => { |
| 180 | 194 | seen.length = 0; |
| 181 | 195 | const urls: string[] = []; |
new above
offline