Skip to content
Myr

Ask the platform's / again on a 404, as a deploy that adds it settles

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

- Live on demo (914): `infra/deploy.ts --stage demo` uploaded all three Workers, then smoke failed `platform-root` with "GET / answered 404": the W8 version, which has no `/`, still answered as the upload finished. A standalone smoke a minute later passed 8 of 8, with no change. - `platform-root` now reads a 404 as not serving yet, like the web's two probes: it asks again every second for up to the settling time (30 s), then fails with the same reason, so a build without `/` still fails it. - Test (red first by assertion): smoke.test.ts "asks / again while the version before a deploy still answers it with 404, and passes once it settles".

authored by oscabriel · committed by oscabriel · parent ecc2107 · Browse files · 2 files+35 added−4 removed
This commit

State

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

Diff stats

2 files+35 added−4 removed

  • tests:+29 added−0 removed
  • other:+6 added−4 removed

2 files+35 added−4 removed

modified:infra/smoke.ts+6 added-4 removed
169 unmodified lines
170171/**172 * A server error, or a 404 from a hostname that is not serving yet: a173 * Worker's first deploy to workers.dev answers 404 for its first seconds174 * (once, smoke ran 4 s after the web's first deploy and got 404 twice). Only175 * the web's probes read a 404 so; the platform's `missing-repo-404` expects176 * one.174 * (once, smoke ran 4 s after the web's first deploy and got 404 twice), and175 * a deploy that adds a route can still be answered by the version before it176 * (demo's W9 deploy: `/` answered 404 once as the upload finished). The177 * web's probes and `platform-root` read a 404 so; the platform's178 * `missing-repo-404` expects one.179 */180const notServingYet = (status: number) => status >= 500 || status === 404;181182/** `answer`, when its status is `expected`; `transient` says which others to ask again. */
172 unmodified lines
355const platformRoot = (origin: string) => {356 const label = "GET /";357358 return send(label, HttpClientRequest.get(`${origin}/`)).pipe(357 Effect.flatMap(statusIs(label, 200)),359 Effect.flatMap(statusIs(label, 200, notServingYet)),360 Effect.flatMap(({ text }) =>361 text.includes("/mcp") && text.includes("install.sh")362 ? Effect.void363 : Effect.fail(
224 unmodified lines
modified:packages/config/test/smoke.test.ts+29 added
227 unmodified lines
228 });229 }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer))230 );231232 it.live(233 "asks / again while the version before a deploy still answers it with 404, and passes once it settles",234 () =>235 Effect.gen(function* () {236 // demo's W9 deploy (914): smoke ran as the upload finished, and the237 // W8 version, which has no `/`, answered it once more with 404.238 const asked = { root: 0 };239240 const origin = yield* fakePlatform((seen) => {241 if (seen.path === "/") {242 asked.root += 1;243244 if (asked.root <= 2) {245 return { status: 404 };246 }247 }248249 return healthy(seen);250 });251252 const report = yield* smoke(origin, { settling: "10 seconds" });253254 expect({255 asked,256 probes: report.probes.map(({ probe }) => probe),257 }).toStrictEqual({ asked: { root: 3 }, probes: [...platformProbes] });258 }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer))259 );260261 it.live("names each probe that fails, and why", () =>262 Effect.gen(function* () {263 const origin = yield* fakePlatform(broken);264
293 unmodified lines