Skip to content
Myr

Keep a release's moving pointers to their own five minutes: the install script, the manifest and latest forbid serving them stale, and the edge's day-long stale window honours that

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oscabriel · committed by oscabriel · parent 191a15d · Browse files · 4 files+20 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+20 added−6 removed

  • tests:+9 added−4 removed
  • other:+11 added−2 removed

4 files+20 added−6 removed

modified:apps/platform/src/releases.ts+2 added-1 removed
86 unmodified lines
87const LATEST = "latest";8889const FOREVER = "public, max-age=31536000, immutable";9091// The install script, the manifest and `latest` move with each release, so no cache may serve one stale.91const BRIEFLY = "public, max-age=300";92const BRIEFLY = "public, max-age=300, must-revalidate";9394const NO_STORE = "no-store";9596const notFound = HttpServerResponse.empty({
215 unmodified lines
modified:apps/platform/test/releases.test.ts+4 added-4 removed
105 unmodified lines
106 cache: response.headers.get("cache-control"),107 status: response.status,108 type: response.headers.get("content-type"),109 }).toStrictEqual({110 cache: "public, max-age=300",110 cache: "public, max-age=300, must-revalidate",111 status: 200,112 type: "text/x-shellscript; charset=utf-8",113 });114 expect(yield* textOf(response)).toBe(script("0.1.0"));
74 unmodified lines
189 status: reply.status,190 }))191 ).toStrictEqual([192 {193 cache: "public, max-age=300",193 cache: "public, max-age=300, must-revalidate",194 location: `/releases/0.1.0/${linux}`,195 status: 302,196 },197 {198 cache: "public, max-age=300",198 cache: "public, max-age=300, must-revalidate",199 location: "/releases/0.1.0/SHA256SUMS",200 status: 302,201 },202 ]);
14 unmodified lines
217 cache: listed.headers.get("cache-control"),218 status: listed.status,219 type: listed.headers.get("content-type"),220 }).toStrictEqual({221 cache: "public, max-age=300",221 cache: "public, max-age=300, must-revalidate",222 status: 200,223 type: "application/json",224 });225 expect(yield* Effect.promise(() => listed.json())).toStrictEqual(
397 unmodified lines
modified:apps/web/src/server/edge-cache.ts+9 added-1 removed
modified:apps/web/test/edge-cache.test.ts+5 added
203 unmodified lines
204 get("/raw"),205 answer({ "cache-control": "public, max-age=31536000, immutable" }),206 ],207 ["an answer with no age", get("/x"), answer({ "cache-control": "public" })],208 [209 "the install script, which forbids serving it stale",210 get("/install.sh"),211 answer({ "cache-control": "public, max-age=300, must-revalidate" }),212 ],213 ] as const)(214 "gives the edge no longer window for %s",215 (_, request, response) => {216 expect(
304 unmodified lines