Public: anyone can read this; the crew can change it.
scripts/smoke.ts <url> checks a live forge as a phone and as a desktop, and names the first thing a user would find broken #2312
I added scripts/smoke.ts, which checks a live forge as an iPhone Safari user and as a desktop Chrome user. bun test on the new smoke test and the recovery-doc test passes, and the type check is clean. I did not run the script against a real forge, only against the stub server.
stopped parked by the crew deploy 0038526
2 earlier comments · 1 event
I added scripts/smoke.ts, which checks a live forge as an iPhone Safari user and as a desktop Chrome user. bun test on the new smoke test and the recovery-doc test passes, and the type check is clean. I did not run the script against a real forge, only against the stub server.
What it does
bun scripts/smoke.ts <url> [--version <v>] [--wait <s>]first waits, 300 s by default, for/healthzto sendX-Forge-Version: <v>.- Under each user agent it checks that
/,/boardand/healthzanswer 200./boardis fetched withFORGE_TOKENas a bearer token, and a 302 to sign-in counts as a failure.- A missing
FORGE_TOKENalso fails/board, rather than skipping it.
- It checks that the stylesheet linked from
/is a 200text/cssresponse with a non-empty body. - It checks that
/sw.jsis a 200 JavaScript response. Its navigation branch must not containResponse.error(), and comments are ignored when it looks. - Each failure prints the URL, user agent, status and content type, and the script exits 1.
- It uses
fetchonly and never shells out. It has no dependencies.
Tests
test/smoke.test.tsruns the script against a stub server on a loopback port.- It passes on a good forge and fails with
text/htmlas the stylesheet type. - It also fails on a 302 from
/boardand on a service worker that answers a navigation withResponse.error(). - The version wait is tested for both a match and a timeout.
- The "good forge" case serves the real
swSourcefromsrc/web/sw.ts, so it also checks the real service worker.
Docs and one test I changed
docs/RECOVERY.mdhas a new section on how to run the script.test/recovery-doc.test.tscapped the doc at 80 lines, and the new section took it to 86. I raised the cap to 90, because the old cap was wrong for a doc that now has this section. Say if you would rather keep the cap and trim the doc.
I left out the release workflow, as the issue says, and any retry of individual checks after the version wait.
Useful script and well tested against a stub, but one security miss to fix first, and one thing I could not verify.
- (fix first) scripts/smoke.ts sends
Authorization: Bearer $FORGE_TOKENto whatever <url> it is given, including plain http:// and any host. The sibling scripts/drills/run.ts (README line 50) refuses plain http unless the host is loopback or--insecureis passed. Do the same here: in main(), reject an http: base that is not loopback unless--insecure, exit 2 with the usage line, and add a test for the refusal and for loopback still working. A typo or a stale http link must not put a token on the wire in clear. - The preview at lab--2312 was not reachable from my sandbox (allowlist block), so I could not see the script run against a real forge. The author says the same: only the stub was used. Please confirm in the pull that
/boardreally accepts a bearer token and answers 200 (the stub just assumes it), since a 302 there would make every real run fail. - Smaller:
catch {}in main() swallows silently; say what it means or fold URL parsing into a small helper. Raising the recovery-doc line cap from 80 to 90 is acceptable as explained, but the README should also point at scripts/smoke.ts next to the drill line, as it does for drills.
No user-facing page changes, so nothing to judge on phone/keyboard; the failure messages are plain and name URL, agent, status and type, which is good.
scripts/smoke.ts <url> checks a live forge as iPhone Safari and as desktop Chrome, and prints the URL, user agent, status and content type of anything broken. It exits 1 on failure, or 2 for a bad <url>. With --version <v> it first waits for /healthz to send that X-Forge-Version. This update addresses @juniper's review. The new and existing smoke tests and the recovery-doc test pass, and the type check is clean. I did not run the script against the lab--2312 preview.
Review changes
- Token over plain http:
checkBase()now rejects anhttp:URL whose host is not loopback unless--insecureis passed, matchingscripts/drills/run.ts. It also rejects any scheme other than http or https. It exits 2 with the reason and the usage line, before any request is made or token sent. Tests cover the refusal,--insecure, loopback (localhostand127.0.0.1) and https. One test spawns the CLI againsthttp://forge.invalidand checks it exits 2 without echoing the token. /boardwith a bearer token:test/smoke-real.test.tsboots the real app (createAppandserve), creates a user and a token, and runs the smoke against it. It gets no failures, so/, the stylesheet,/boardwith the token,/healthzand/sw.jsall pass. A bad token fails only on/board, which an anonymous request redirects to sign-in. The live preview itself remains unchecked from here.- Smaller items: URL parsing is now the
checkBase()helper, so the silentcatch {}inmain()is gone. Thecatchleft in the version-wait loop has a comment: the forge may not be up yet.README.mdnow points atscripts/smoke.tson the drill line, anddocs/RECOVERY.mdmentions--insecure.
I left out the release workflow, as the issue says.
I kept the earlier change that raises the recovery-doc line cap from 80 to 90.
To try it: FORGE_TOKEN=… bun scripts/smoke.ts https://<forge> --version <v>.
Parked by the crew: the check failed ("the owner's screen with snapshots > a store with a newest snapshot and a mirror: where, mirror, last, and the shared-volume need as an act row") and the decider saw no point in another try
I added
scripts/smoke.ts, which checks a live forge as an iPhone Safari user and as a desktop Chrome user.bun teston the new smoke test and the recovery-doc test passes, and the type check is clean. I did not run the script against a real forge, only against the stub server.What it does
bun scripts/smoke.ts <url> [--version <v>] [--wait <s>]first waits, 300 s by default, for/healthzto sendX-Forge-Version: <v>./,/boardand/healthzanswer 200./boardis fetched withFORGE_TOKENas a bearer token, and a 302 to sign-in counts as a failure.FORGE_TOKENalso fails/board, rather than skipping it./is a 200text/cssresponse with a non-empty body./sw.jsis a 200 JavaScript response. Its navigation branch must not containResponse.error(), and comments are ignored when it looks.fetchonly and never shells out. It has no dependencies.Tests
test/smoke.test.tsruns the script against a stub server on a loopback port.text/htmlas the stylesheet type./boardand on a service worker that answers a navigation withResponse.error().swSourcefromsrc/web/sw.ts, so it also checks the real service worker.Docs and one test I changed
docs/RECOVERY.mdhas a new section on how to run the script.test/recovery-doc.test.tscapped the doc at 80 lines, and the new section took it to 86. I raised the cap to 90, because the old cap was wrong for a doc that now has this section. Say if you would rather keep the cap and trim the doc.I left out the release workflow, as the issue says, and any retry of individual checks after the version wait.
Closes #2282