fix(web): reject connect without a cdpEndpoint resolver at config load
Merged
TH
10d ago+78+78+01234567890123456789-17-17-01234567890123456789
A web({ connect }) with reconnectEndpoint but no cdpEndpoint passed config load and failed every attempt with ENGINE_FAILURE: connection failed: resolve is not a function: the persistent attach called the undefined resolver (packages/web/src/surface.ts:449 hands it to packages/web/src/cdp-recovery.ts:52). A cdpEndpoint given as a string did the same at init, as browser connect failed: source.resolve is not a function.
web()validatesconnectin one place now,validateConnectinpackages/web/src/engine.ts: not a plain object, nocdpEndpoint, or acdpEndpointorreconnectEndpointthat is not a function isINVALID_CONFIGat config load. The missing-key message saysreconnectEndpointonly reconnects to the browsercdpEndpointprovisioned.- Messages name the value's kind (
got a string) and never echo it: a CDP URL can carry a session token. docs/reference/web.mdx: theconnectparagraph sayscdpEndpointis required and both keys are resolvers, and drops the resolver call timing that read as if one browser served the worker. The recovery section opens with the fresh-browser-per-attempt rule and points to the setup-test session for reusing a sign-in across files (ENG-945); the engine mechanics it described are gone, nine lines shorter than main.skills/e2e/references/setup.mdcarries the same contract.
Closes ENG-986, ENG-945.
Verified
Ran it locally: yes
- testbed, a scratch config selecting each
connectshape withENG986_CASE=missing|string|reused,e2e run --config e2e.scratch-eng986.config.ts, built packages on both sides:
| shape | main | this branch |
|---|---|---|
{ reconnectEndpoint } only | every test ENGINE_FAILURE: connection failed: resolve is not a function | INVALID_CONFIG at load, no test runs |
{ cdpEndpoint: 'ws://…' } (a string) | every test ENGINE_FAILURE: browser connect failed: source.resolve is not a function | INVALID_CONFIG at load, no test runs |
| both resolvers returning one headless Chromium | second test CDP recovery failed: cdpEndpoint reused a browser from a previous attempt | same, by design, now stated up front in the docs |
ERROR configuration error INVALID_CONFIG (config)
web({ connect }) requires cdpEndpoint, the resolver that provisions the browser: (signal) => url; reconnectEndpoint only reconnects to the browser cdpEndpoint provisioned
ERROR configuration error INVALID_CONFIG (config)
web({ connect: { cdpEndpoint } }) must be a resolver function (signal) => url, got a string