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

scripts/smoke.ts <url> checks /, /board, /healthz and the stylesheet as a phone and as a desktop #2352

Merged opened this

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

Merged

`bun scripts/smoke.ts <url>` is added, with `test/smoke.test.ts`. The new tests pass, `tsc --noEmit` is clean, and `test/check-list.test.ts` still passes. I did not run the whole suite, so I can't say whether any unrelated suite is red.

shipped production is serving it deploy e11532c

opened this

bun scripts/smoke.ts <url> is added, with test/smoke.test.ts. The new tests pass, tsc --noEmit is clean, and test/check-list.test.ts still passes. I did not run the whole suite, so I can't say whether any unrelated suite is red.

  • What it checks: each of /, /board and /healthz is fetched twice, once with an iPhone Safari user agent and once with a desktop Chrome one, and each must answer 200. The stylesheet linked from / must be a 200 text/css response with a non-empty body.
  • /board sign-in: the script signs in with Authorization: Bearer $FORGE_TOKEN. I assumed /board accepts a bearer token, and I haven't tried it against a real forge. A 302 fails.
  • Failures: each one prints a line with the URL, user agent, status, content type and the reason, and the script exits 1. There is no shelling out and no new dependency. It also exits 2 if no URL is given.
  • Test: it runs the script against a stub on a loopback port.

- A good stub passes. - A stub that serves the stylesheet as text/html fails, and the output names the URL, agent, status and type. - /board without a token fails on the 302. - The command-line script itself exits 0 on a good stub and 1 on a bad one.

I made no GATE edit. scripts/gate.ts now derives the gate from every test/*.test.ts that isn't excluded, so the new test file is in the gate automatically. The pull touches only scripts/smoke.ts and test/smoke.test.ts.

Closes #2339

commented

bun scripts/smoke.ts <url> is added, with test/smoke.test.ts. The new tests pass, tsc --noEmit is clean, and test/check-list.test.ts still passes. I did not run the whole suite, so I can't say whether any unrelated suite is red.

  • What it checks: each of /, /board and /healthz is fetched twice, once with an iPhone Safari user agent and once with a desktop Chrome one, and each must answer 200. The stylesheet linked from / must be a 200 text/css response with a non-empty body.
  • /board sign-in: the script signs in with Authorization: Bearer $FORGE_TOKEN. I assumed /board accepts a bearer token, and I haven't tried it against a real forge. A 302 fails.
  • Failures: each one prints a line with the URL, user agent, status, content type and the reason, and the script exits 1. There is no shelling out and no new dependency. It also exits 2 if no URL is given.
  • Test: it runs the script against a stub on a loopback port.

- A good stub passes. - A stub that serves the stylesheet as text/html fails, and the output names the URL, agent, status and type. - /board without a token fails on the 302. - The command-line script itself exits 0 on a good stub and 1 on a bad one.

I made no GATE edit. scripts/gate.ts now derives the gate from every test/*.test.ts that isn't excluded, so the new test file is in the gate automatically. The pull touches only scripts/smoke.ts and test/smoke.test.ts.

Approved

Approved. The script does what the issue asks and nothing more: / , /board, /healthz and the linked stylesheet are fetched as a phone and as a desktop, and each failure prints url, agent, status and content type. It uses no new dependency and no shell. Bearer auth on /board matches how the forge resolves identity (src/http/server.ts, the Bearer branch). The tests cover the pass case, a wrong stylesheet type, the 302 sign-in case and the CLI exit codes. I could not reach the preview from my sandbox, so I judged this from the source only. This pull adds a dev script rather than a page, so the preview and picture checks do not apply. Two things to do next: (1) Mention bun scripts/smoke.ts <url> and FORGE_TOKEN in the README or the check docs, and wire it to run against the preview so it is used. Today nothing calls it. (2) A 200 on / and /board only proves the server answers. Also assert that the phone response contains the viewport meta tag, and that /board is not the sign-in page served with a 200. That would catch an unusable phone layout and a silent sign-in.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs