test(smoke): cover loadBrowser's failure branches; fix a stale helper comment

Two findings from Copilot's suppressed block.

1. The launch-failure message is #2086's acceptance criterion — a missing
   browser must name THAT engine and its own install command — and it had
   no test. The smokes cannot supply one: install-smoke-browser fetches
   the binary first, so a passing smoke says nothing about what a failing
   one prints, and that message is the deliverable. loadBrowser now takes
   an injectable loadPlaywright purely to open that seam.

   The test asserts per engine that the message leads with that engine,
   names --with-deps <that engine> and no other, and preserves the
   underlying cause. Verified by mutation: hard-coding 'chromium' in the
   message fails it. It also pins the two branches apart — an unresolvable
   package must say
> @modelcontextprotocol/inspector@2.3.0 postinstall
> node scripts/install-clients.mjs

[install-clients] Installing dependencies for clients/web...

up to date, audited 583 packages in 614ms

198 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[install-clients] Installing dependencies for clients/cli...

up to date, audited 237 packages in 496ms

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[install-clients] Installing dependencies for clients/tui...

up to date, audited 314 packages in 518ms

102 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[install-clients] Installing dependencies for clients/launcher...

up to date, audited 160 packages in 449ms

50 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

up to date, audited 281 packages in 3s

108 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities and must NOT say ,
   which fetches binaries and cannot fix a missing package.

   The unsupported-engine test now also asserts loadPlaywright was never
   called, pinning the ORDER rather than only the message: validating
   first is what makes the error name the real mistake.

2. prod-web-server.mjs's header still described the  prefix this PR removed. Corrected, keeping why
   deriving paths from import.meta.url is still right, and adding the
   elicitation smoke to the list of callers it had also outgrown.

Addresses the suppressed comments on Copilot's review of #2133.

Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-25 22:42:06 -04:00
commit 4ab0139de9

View file

@ -2,15 +2,21 @@
* Shared boot/readiness helper for the prod web smokes.
*
* `scripts/smoke-web.mjs` (serves-the-HTML check), `scripts/smoke-web-browser.mjs`
* (runs-the-bundle check, #1615), and `scripts/smoke-web-app.mjs` (MCP Apps
* end-to-end, #1859) all boot the *same* prod `mcp-inspector --web` server, so the
* spawn + readiness-poll boilerplate lives here once instead of being copy-pasted
* (and drifting) in each script. Catalog isolation (#1977) lives here for the same
* reason — it is a property every web smoke needs, not one script's concern.
* (runs-the-bundle check, #1615), `scripts/smoke-web-app.mjs` (MCP Apps
* end-to-end, #1859) and `scripts/smoke-web-elicitation.mjs` (app-rendered
* elicitations, #1854) all boot the *same* prod `mcp-inspector --web` server, so
* the spawn + readiness-poll boilerplate lives here once instead of being
* copy-pasted (and drifting) in each script. Catalog isolation (#1977) lives here
* for the same reason — it is a property every web smoke needs, not one script's
* concern.
*
* Repo-root paths are derived from import.meta.url, so a caller's cwd (e.g.
* `smoke:web:browser` does `cd clients/web` first so its `npx playwright
* install` finds the local bin) doesn't affect which launcher/build tree runs.
* Repo-root paths are derived from import.meta.url rather than the cwd, so it
* does not matter where a caller is run from. (Until #2086 the browser-driven
* smokes were invoked through a `cd clients/web && npx playwright install …`
* prefix, which is what originally made that independence load-bearing; they now
* run from the repo root via `scripts/install-smoke-browser.mjs`. Deriving from
* import.meta.url is still the right call — it is what lets a smoke be run by
* hand from any directory.)
*/
import { spawn } from "node:child_process";