test: cross-version compatibility check against the last published extension (#2914)
# Why - Runtime negotiation is only unit-tested against a faked `__stagehand_runtime` marker. Nothing checks that the current SDK actually negotiates with the extension we last published, or that an incompatible runtime fails fast instead of hanging until the 60 s init timeout. # What changed - New `packages/sdk-ts/tests/browser-runtime/crossVersionCompat.test.ts`: - `npm pack`s the last published `@browserbasehq/stagehand` (override with `STAGEHAND_COMPAT_BASELINE_VERSION`), extracts its bundled extension, and caches it under `node_modules/.cache`. - Launches local Chrome with that extension through the real `localBrowser.launch` path and asserts the outcome `checkProtocolCompatibility` predicts, so the expectation moves when the protocol version bumps. - Forks the extension with its marker rewritten to the next protocol major and asserts `StagehandRuntimeIncompatibleError` (`protocol-major-mismatch`) within 5 s. - No CI changes: the existing TypeScript browser job already runs this directory. # Test plan - `pnpm --filter ./packages/sdk-ts test:browser` locally: both cases pass (~5 s cold, includes `npm pack`). - Negative control: with the pre-#2912 polling behaviour the synthetic case fails at the 60 s init timeout, so the assertion catches the regression.
M
Miguel committed
e825c777c035fbeb73bd4e5de184438a274eaec8
Parent: 67a4668
Committed by GitHub <noreply@github.com>
on 9/9/2026, 7:53:16 AM