Use SemVer for protocol compatibility - #2630
Conversation
|
There was a problem hiding this comment.
5 issues found across 35 files
Confidence score: 3/5
packages/sdk-go/models.gen.gochanges the init-handshakeprotocol_versioncontract, but there’s no corresponding integration coverage underpackages/server/test, so client/server negotiation regressions could reach users as failed handshakes — add an end-to-end protocol-version integration test for the breaking path.packages/sdk-go/internal/generator/main.goandpackages/sdk-go/runtime_compatibility.gointroduce new semver formatting and compatibility rules without focused Go tests, which raises the chance of subtle negotiation or validation bugs in future edits — add targeted unit tests for generation output and stable/prerelease compatibility cases.packages/protocol/schemas.tsandpackages/sdk-python/src/stagehand/cdp_client.pyeach carry smaller but concrete maintainability/runtime risks:.tsspecifiers may fail in emitted ESM, and duplicated semver regexes can drift between runtime and generator validation — switch to emitted.jsspecifiers and deduplicate the regex source.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/sdk-go/models.gen.go">
<violation number="1" location="packages/sdk-go/models.gen.go:1816">
P1: Custom agent: **Any breaking changes to Stagehand REST API client / server implementation must be covered by an integration test under packages/server/test**
This PR changes the init-handshake `protocol_version` field from `float64` to a SemVer `string`. That is a breaking wire-format change to the shared request shape and server schema. Rule 5 requires breaking REST API changes to be covered by an integration test under `packages/server/test`. Please confirm that the server-side SemVer compatibility logic and the new string-based handshake are exercised by an integration test, including major/minor compatibility and prerelease exact-match outcomes.</violation>
</file>
<file name="packages/sdk-go/internal/generator/main.go">
<violation number="1" location="packages/sdk-go/internal/generator/main.go:219">
P2: This update changes protocol version behavior (major integer to full semver string) but does not add focused tests for the new validation/output contract, so regressions can slip in unnoticed. A small test suite for generateProtocolVersionSource covering stable, prerelease, and invalid inputs would make the compatibility rules durable.
(Based on your team's feedback about adding unit tests for new behavior.) .</violation>
</file>
<file name="packages/protocol/schemas.ts">
<violation number="1" location="packages/protocol/schemas.ts:2">
P3: Runtime ESM resolution can break when relative specifiers use `.ts` instead of emitted `.js` paths. These new import/export specifiers would be safer aligned to the repo convention by referencing `./protocol-version.js`.</violation>
</file>
<file name="packages/sdk-go/runtime_compatibility.go">
<violation number="1" location="packages/sdk-go/runtime_compatibility.go:48">
P2: Runtime compatibility behavior changed substantially (major/minor negotiation plus prerelease exact-match), but the change set does not add Go unit tests to lock these cases. Adding focused tests for stable-version accept/reject paths and prerelease matching would reduce regression risk.
(Based on your team's feedback about adding unit tests for new behavior.) .</violation>
</file>
<file name="packages/sdk-python/src/stagehand/cdp_client.py">
<violation number="1" location="packages/sdk-python/src/stagehand/cdp_client.py:17">
P3: The SemVer regex pattern in `_PROTOCOL_SEMVER_PATTERN` is duplicated verbatim in `packages/sdk-python/scripts/generate.py` as `SEMVER_PATTERN`. Both files must always use the same pattern for SemVer validation — if one is updated (e.g., to refine pre-release identifier validation) and the other is not, protocol version parsing can silently diverge between codegen validation and runtime compatibility checking. Consider defining the pattern in a shared non-generated location (e.g., a constants module under `src/stagehand/`) so both the build script and the runtime module refer to the same source of truth.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 18 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Summary
Use full SemVer protocol versions for runtime compatibility and document how SDK, extension, and protocol packages should be versioned independently.
4.0.0and the protocol at1.0.01.0.0How it works
Compatibility compares the protocol versions reported by the client and extension, not their package versions.
For stable protocol versions:
Prerelease protocol versions must match exactly.
No Changeset is included because these packages have not been released yet.
Validation
just checkjust testSummary by cubic
Switch protocol compatibility to full SemVer and gate runtime negotiation on the protocol version string, not package versions. Re-baselined
@browserbasehq/stagehand-extensionto1.0.0and removed Changesets fixed groups so SDKs, extension, and protocol can release independently.Refactors
packages/protocol/protocol-version.tswith SemVer validation,checkProtocolCompatibility, and exportedSTAGEHAND_PROTOCOL_VERSION.protocol_versionis a SemVer string with a strict pattern; malformed versions return invalid-params errors on the wire.golang.org/x/modfor SemVer; Python exportsPROTOCOL_SEMVER_PATTERN.@browserbasehq/stagehand-extensionenforces compatibility duringstagehand.init, returningStagehandProtocolCompatibilityErrorwith a structured reason; embedded bundle regenerated and preview manifest updated to1.0.0.@browserbasehq/stagehand-evals; release notes include Go SDK and Protocol changelogs; Go module tags are created separately.Migration
protocol_versionas a SemVer string (e.g., "1.2.3") and enforce:Written for commit bf97a0f. Summary will update on new commits.