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

releases.json links each release to its entry on /changelog #16732

Merged opened this

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

Merged

scout/forge:scout/6097-releases-json-links-each-release-to-its → main 0 commits fork

  • Merged. scout/6097-releases-json-links-each-release-to-its was merged into main as 94e4b1b.

Review

Sign in to review this change.
2 files changed +5 −5
src/web/standards.ts +2 −3
@@ -276,8 +276,7 @@ export function changePassword(): Response {
276276 /**
277277 * GET /releases.json — `{ releases: [{ name, url }] }`, newest first, read
278278 * by a child forge (`core/parent_releases.ts`). Public and read-only. The
279 * link of each is this document at that release; there is no page per
280 * release to point at.
279 * link of each is its entry on /changelog (`/changelog#<version>`).
281280 */
282281 export function releasesJson(ctx: Ctx): Response {
283282 const origin = ctx.url.origin;
@@ -287,7 +286,7 @@ export function releasesJson(ctx: Ctx): Response {
287286 const body = JSON.stringify({
288287 releases: list.map((r) => ({
289288 name: r.version,
290 url: `${origin}/releases.json#${encodeURIComponent(r.version)}`,
289 url: `${origin}/changelog#${encodeURIComponent(r.version)}`,
291290 })),
292291 });
293292 const etag = `"${new Bun.CryptoHasher("sha256").update(body).digest("hex").slice(0, 32)}"`;
test/standards.test.ts +3 −2
@@ -188,7 +188,7 @@ describe("what the open web expects", () => {
188188 expect(parseReleases({ releases: page }, true)!.length).toBe(page.length);
189189 }
190190 expect(read![0]!.name).toBe(shippedReleases()[0]!.version);
191 expect(read![0]!.url).toStartWith(`${base}/releases.json#`);
191 expect(read![0]!.url).toBe(`${base}/changelog#${encodeURIComponent(shippedReleases()[0]!.version)}`);
192192 // The verdict is the document's shape, not the machine's speed: a loaded
193193 // check machine gets a generous bound rather than a red lane (#5966).
194194 }, 30_000);
@@ -222,8 +222,9 @@ describe("what the open web expects", () => {
222222 const after = await fetch(`${base}/releases.json`, { headers: { "if-none-match": etag } });
223223 expect(after.status).toBe(200);
224224 expect(after.headers.get("etag")).not.toBe(etag);
225 const doc = (await after.json()) as { releases: { name: string }[] };
225 const doc = (await after.json()) as { releases: { name: string; url: string }[] };
226226 expect(doc.releases[0]!.name).toBe("9.9.9");
227 expect(doc.releases[0]!.url).toBe(`${base}/changelog#9.9.9`);
227228 } finally {
228229 setTagged([]);
229230 }

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs