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

Defect on the v1.0.0 path: production's /api/v1/changelog says "check": null on the running release, so the stranger-journey probe line is still UNKNOWN after #15517 went live #15522

Merged opened this

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

Merged

torque/forge:torque/15519-defect-on-the-v1-0-0-path-production-s-a → main 0 commits fork

  • Merged. torque/15519-defect-on-the-v1-0-0-path-production-s-a was merged into main as 9fc271b.

Review

Sign in to review this change.
4 files changed +37 −1
docs/OPERATING.md +1
@@ -369,6 +369,7 @@ That page (`src/http/edition.ts`) prints when the newest morning paper ran and n
369369
370370 The production forge's `/api/v1/health` `schedules` counts are proven by this repository's own schedule (#15499): its `forge.json` declares `heartbeat`, `5 7 * * *` UTC, production only, a signed `POST /jobs/heartbeat` (`src/http/heartbeat.ts`) that writes nothing and calls no model. The production forge runs this repository as an app, so once the commit is on `main` it syncs that schedule (`total` 1), wakes the app if it sleeps, and after 07:05 UTC the first 200 makes `ran` 1. A 401 from it names why (unsigned, forged, expired, or no `FORGE_APP_IDENTITY_KEY`: a forge not run by another) and is final.
371371 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).
372 The stranger-journey line reads the `check` the public answer states beside the running commit (#15514). Only the forge that holds the repository can state it: an app's test copy of the forge (`lab--…` and its previews) runs on its own database, which holds no `trevato/forge`, so its changelog says `"check": null` by design. There the check API and `GET /api/v1/repos/<repo>` both answer 404, and the line says `<base> holds no public <repo>` and to run the probe against the forge that holds it (#15519).
372373 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.
373374
374375 ## Secrets in the terminal
scripts/v1-probe.ts +9 −1
@@ -18,6 +18,8 @@
1818 * The stranger-journey line reads the full check's verdict that the same `releases` answer states
1919 * beside its running commit (`check`, #15514); only when it names no verdict on the newest
2020 * release's commit is the check API asked, which answers 404 to an anonymous read.
21 * When that answers 404 and so does the repository itself, the base holds no such repository (an
22 * app's test copy of the forge, #15519) and the line names the forge to ask.
2123 *
2224 * It prints one line per item, `PASS`, `FAIL` or `UNKNOWN`, with the URL and
2325 * the evidence, and exits 0 only when every line is PASS. UNKNOWN is what an
@@ -273,7 +275,13 @@ export async function probe(base: string, repo: string, fetcher: Fetcher = fetch
273275 const c = own ?? (check === undefined || typeof check === "string" ? undefined : (json(check) as { state?: unknown; runId?: unknown; finishedAt?: unknown } | undefined));
274276 if (!c || typeof c.state !== "string") {
275277 const why = check === undefined ? "no check named" : typeof check === "string" ? check : `${check.status}, not the check's JSON`;
276 say("stranger journey green on a release", "UNKNOWN", checkPath, `${why}; a person must open ${tagName}'s check and see the stranger tests green`);
278 // A 404 can mean the base holds no such repository, as on an app's test copy of the forge
279 // (#15519): its own empty database states no verdict, however public the read, so the line
280 // names the forge to ask in place of a person.
281 const repoRead = typeof check === "object" && check.status === 404 ? await get(api) : undefined;
282 if (typeof repoRead === "object" && repoRead.status === 404) {
283 say("stranger journey green on a release", "UNKNOWN", api, `${origin} holds no public ${repo}, so it states no check of it; run the probe against the forge that holds ${repo}`);
284 } else say("stranger journey green on a release", "UNKNOWN", checkPath, `${why}; a person must open ${tagName}'s check and see the stranger tests green`);
277285 } else if (c.state === "ok") say("stranger journey green on a release", "PASS", checkPath, `${tagName} (${tagCommit.slice(0, 9)}) full check ok, run ${String(c.runId)}, which runs the stranger tests`);
278286 else if (c.state === "failed") say("stranger journey green on a release", "FAIL", checkPath, `${tagName} check failed, run ${String(c.runId)}`);
279287 else say("stranger journey green on a release", "UNKNOWN", checkPath, `${tagName} check is ${c.state}`);
test/maintain-disk-free.test.ts +7
@@ -9,7 +9,14 @@ import { rulesWorld } from "./helpers/rules-app.ts";
99 import { dataSizes, largestDirs, LOOSE, makeDuty, OUTSIDE, TITLE } from "../src/maintain/duties/disk_free.ts";
1010 import { duties } from "../src/maintain/registry.ts";
1111
12 // Restored after the file: a later file in the same `bun test` process reads its own repository
13 // from this (test/gate-bypass.test.ts failed beside it, #15519).
14 const priorSentinel = process.env.FORGE_SENTINEL_REPO;
1215 process.env.FORGE_SENTINEL_REPO = "alice/rules";
16 afterAll(() => {
17 if (priorSentinel === undefined) delete process.env.FORGE_SENTINEL_REPO;
18 else process.env.FORGE_SENTINEL_REPO = priorSentinel;
19 });
1320 const w = rulesWorld();
1421 const GB = 1024 ** 3;
1522 let free = 50 * GB;
test/v1-probe.test.ts +20
@@ -24,6 +24,8 @@ interface World {
2424 stated?: { commit: string; state: string; runId: string | null };
2525 /** The keeper's heartbeat, served only to `Bearer t` (#15449). */
2626 beat?: { at: string; outcome: string; reason: string; silent: boolean } | null;
27 /** The base holds no such repository, as an app's test copy of the forge (#15519). */
28 noRepo?: boolean;
2729 }
2830 const green = (): World => ({
2931 version: "1.0.0",
@@ -65,7 +67,10 @@ const server = Bun.serve({
6567 return json({ jsonrpc: "2.0", id: 2, result: { content: [{ type: "text", text }] } });
6668 }
6769 return json({ jsonrpc: "2.0", id: 1, result: { serverInfo: { name: "forge", version: world.version } } });
70 case "/api/v1/repos/o/r":
71 return world.noRepo ? json({ error: "not_found" }, 404) : json({ ownerName: "o", name: "r", visibility: "public" });
6872 case `/api/v1/repos/o/r/commits/${COMMIT}/check`:
73 if (world.noRepo) return json({ error: "not_found" }, 404);
6974 return world.checkState === null ? html("Just a moment...", 403) : json({ state: world.checkState, runId: "run1" });
7075 case "/api/v1/keeper":
7176 if (req.headers.get("authorization") !== "Bearer t") return json({ error: "forbidden" }, 403);
@@ -215,6 +220,21 @@ describe("v1 probe", () => {
215220 }
216221 });
217222
223 test("a base that holds no such repository says so and names the forge to ask, not a bare 404 (#15519)", async () => {
224 seen.length = 0;
225 const r = (await run({ noRepo: true, checkState: null }))["stranger journey green on a release"]!;
226 expect(r.verdict).toBe("UNKNOWN");
227 expect(r.url).toBe(`${base}/api/v1/repos/o/r`);
228 expect(r.evidence).toBe(`${base} holds no public o/r, so it states no check of it; run the probe against the forge that holds o/r`);
229 expect(seen.filter((s) => s.path === "/api/v1/repos/o/r")).toEqual([{ method: "GET", path: "/api/v1/repos/o/r" }]);
230 // A check API that is closed (403) on a forge that holds the repository is still a person's to
231 // open, and the repository is not read for it.
232 seen.length = 0;
233 const closed = (await run({ checkState: null }))["stranger journey green on a release"]!;
234 expect(closed.evidence).toContain("a person must open v1.0.0's check");
235 expect(seen.some((s) => s.path === "/api/v1/repos/o/r")).toBe(false);
236 });
237
218238 test("no release listed but a running version and commit named: that build is the release, read from its check (#15473)", async () => {
219239 const r = await run({ releases: [], running: { version: "1.0.0", commit: COMMIT } });
220240 expect(r["stranger journey green on a release"]!.verdict).toBe("PASS");

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs