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

Merged opened this

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

Merged

scout/forge:scout/15473-the-v1-probe-reads-the-running-release-f → main 0 commits fork

  • Merged. scout/15473-the-v1-probe-reads-the-running-release-f was merged into main as 5b60a35.

Review

Sign in to review this change.
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
364364 and an accessibility tree, which nothing dependency-free gives.
365365
366366 `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).
367368 `--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.
368369 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).
369370 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 {
121121 readonly name: string;
122122 readonly version: string | undefined;
123123 readonly commit: string;
124 /** True when no release is listed and this is the running build the answer names (#15473). */
125 readonly running?: true;
124126 }
125127
126128 /**
127129 * 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).
129133 */
130134 export function newestRelease(answer: unknown, repo: string): { release: Release | undefined } | undefined {
131135 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
143147 const version = typeof item.version === "string" && item.version !== "" ? item.version.replace(/^v/, "") : undefined;
144148 return { release: { name: version ? `v${version}` : item.commit.slice(0, 7), version, commit: item.commit } };
145149 }
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 } };
147154 }
148155
149156 /**
@@ -223,7 +230,7 @@ export async function probe(base: string, repo: string, fetcher: Fetcher = fetch
223230 // 3. The stranger journey's last green release, from the check API.
224231 const checkPath = tagCommit ? `${api}/commits/${tagCommit}/check` : releasePath;
225232 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`);
227234 else {
228235 const check = await get(checkPath);
229236 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
238245 // 4. /changelog, /changelog.atom and production's version agree with the newest release.
239246 if (!announced) say("version agrees", "UNKNOWN", "/mcp", typeof init === "string" ? init : `initialize named no version or commit (${init.status})`);
240247 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`);
242249 else {
243250 const r = read.release;
244251 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 {
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 /** The running build the answer names beside its list (#15473). */
22 running?: { version: string | null; commit: string | null };
2123 /** The keeper's heartbeat, served only to `Bearer t` (#15449). */
2224 beat?: { at: string; outcome: string; reason: string; silent: boolean } | null;
2325 }
@@ -57,7 +59,7 @@ const server = Bun.serve({
5759 case "/mcp":
5860 if (call?.method === "tools/call") {
5961 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 });
6163 return json({ jsonrpc: "2.0", id: 2, result: { content: [{ type: "text", text }] } });
6264 }
6365 return json({ jsonrpc: "2.0", id: 1, result: { serverInfo: { name: "forge", version: world.version } } });
@@ -166,16 +168,28 @@ describe("v1 probe", () => {
166168 test("the release is read from the token-free releases tool; none listed is FAIL, no answer is UNKNOWN (#15387)", async () => {
167169 const r = await run({});
168170 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 } });
170172 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");
171174 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");
173176 const silent = await run({ releases: null, version: "687c4ae" });
174177 expect(silent["stranger journey green on a release"]!.verdict).toBe("UNKNOWN");
175178 expect(silent["version agrees"]!.verdict).toBe("UNKNOWN");
176179 expect(silent["version agrees"]!.evidence).toContain("production says 687c4ae; 403");
177180 });
178181
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
179193 test("sends only GETs, one MCP initialize and one releases call, all to the base host", async () => {
180194 seen.length = 0;
181195 const urls: string[] = [];

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs