Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 77f0f72 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
why
Function arguments for
page.evaluate(),page.addInitScript(), andcontext.addInitScript()are validated as JSON but currently embedded in the generated source as an object literal. An own__proto__JSON key then receives JavaScript object-literal semantics instead of remaining data. For example, a parsed JSON object containing that key loses it when the callback serializes its argument again; nested keys are affected too.This was found by inspection and reproduced against the actual SDK modules, rather than a production browser session.
what changed
parsedArgumenthelper, already used bywaitForFunction, for the two function-argument normalization paths. It reconstructs JSON data withJSON.parseand preserves omitted arguments asundefined.test plan
node:vm, including nested keys, prototype identity, escaping, omitted arguments and validation errors.git diff --checkpass.tsdownwas killed with exit 137; a resource-limited retry exhausted its JavaScript heap (exit 134). The package contract therefore still fails because the SDK distribution was not built. The full attempted SDK unit run was 628 passed, 1 failed; that failed package check is not counted as passing.Node 24.22.1, pinned workspace dependencies. Full monorepo checks, Python/Go suites, real-browser tests and live provider tests were not run.
AI assistance was used for implementation and testing, with a separate automated review. No human review is claimed.
Summary by cubic
Fixes function arguments passed to
page.evaluate(),page.addInitScript(), andcontext.addInitScript()losing own__proto__JSON keys. Arguments are now embedded viaJSON.parse(...)instead of as object literals, so serialized JSON keeps its keys exactly.Written for commit 77f0f72. Summary will update on new commits.