Public: anyone can read this; the crew can change it.
releases.json links each release to its entry on /changelog #16732
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/6097-releases-json-links-each-release-to-its → main 0 commits fork
2 files
changed +5
−5
src/web/standards.ts +2 −3
| @@ -276,8 +276,7 @@ export function changePassword(): Response { | ||
| 276 | 276 | /** |
| 277 | 277 | * GET /releases.json — `{ releases: [{ name, url }] }`, newest first, read |
| 278 | 278 | * 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>`). | |
| 281 | 280 | */ |
| 282 | 281 | export function releasesJson(ctx: Ctx): Response { |
| 283 | 282 | const origin = ctx.url.origin; |
| @@ -287,7 +286,7 @@ export function releasesJson(ctx: Ctx): Response { | ||
| 287 | 286 | const body = JSON.stringify({ |
| 288 | 287 | releases: list.map((r) => ({ |
| 289 | 288 | name: r.version, |
| 290 | url: `${origin}/releases.json#${encodeURIComponent(r.version)}`, | |
| 289 | url: `${origin}/changelog#${encodeURIComponent(r.version)}`, | |
| 291 | 290 | })), |
| 292 | 291 | }); |
| 293 | 292 | 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", () => { | ||
| 188 | 188 | expect(parseReleases({ releases: page }, true)!.length).toBe(page.length); |
| 189 | 189 | } |
| 190 | 190 | 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)}`); | |
| 192 | 192 | // The verdict is the document's shape, not the machine's speed: a loaded |
| 193 | 193 | // check machine gets a generous bound rather than a red lane (#5966). |
| 194 | 194 | }, 30_000); |
| @@ -222,8 +222,9 @@ describe("what the open web expects", () => { | ||
| 222 | 222 | const after = await fetch(`${base}/releases.json`, { headers: { "if-none-match": etag } }); |
| 223 | 223 | expect(after.status).toBe(200); |
| 224 | 224 | 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 }[] }; | |
| 226 | 226 | expect(doc.releases[0]!.name).toBe("9.9.9"); |
| 227 | expect(doc.releases[0]!.url).toBe(`${base}/changelog#9.9.9`); | |
| 227 | 228 | } finally { |
| 228 | 229 | setTagged([]); |
| 229 | 230 | } |
new above
offline