Fix/response clone#142
Merged
Merged
Conversation
Bump the StarlingMonkey submodule from 0.3.0 (9dda8ba) to the tip of godronus/gcore/integration (84f5d52), which carries two pending upstream patches on top of 0.3.0: - feat(fetch): implement Response.clone() (PR #312) - fix(fetch): body.blob() sets Blob.type from Content-Type header (issue #311) Add context/PATCHES.md documenting the applied patches, their upstream PR/issue links, and the rebase procedure for future StarlingMonkey bumps. Update CONTEXT_INDEX.md and CLAUDE.md to make the file discoverable.
…on tests Implement Response.clone() in the StarlingMonkey runtime and add blob.type propagation from Content-Type headers. Both fixes are applied via the godronus/gcore/integration fork branch (SHA 84f5d52) pending upstream review of PR #312 and issue #311. Expose Response.clone() in types/globals.d.ts (instance method, previously commented out). Update KNOWN_LIMITATIONS.md to reflect the implementation. Restructure integration-tests/test-application from a single flat JS file into a typed, extensible architecture: - Convert to TypeScript with Hono routing - Split into handlers/ (WASM context) and checks/ (Node.js, auto-discovered) - routes.ts as single source of truth for route paths and test names - Build artefacts consolidated under dist/ (one .gitignore entry) - Add temporary Response.clone() prod-invocation guard — remove when PR #312 merges upstream and submodule is rebased Add pnpm test:app:build and test:app:check scripts for local development. Add context/PATCHES.md documenting the integration branch, rebase procedure, and test guard removal checklist.
…k runner Add tsconfig.json for the test application so fastedge-build resolves SDK types directly from ../../types rather than the missing installed package. Pass --tsconfig in build-test-app.js and create-test-app.js. Fix run-test-app-checks.js: remove --bundle=false (incompatible with --external), switch to --bundle so relative imports (routes.ts) are inlined into each check file, and fix ESLint errors (regex u flag, await-in-loop, no-plusplus, catch param naming, dynamic import comment).
…ation tests Add four test scenarios covering the full clone surface: - Constructed response text() on both branches (basic correctness) - Constructed response getReader() + mutation guard: drain original, fill(0) all chunks, verify clone reads independently - Incoming fetch() text() on both branches (HttpIncomingBody materialisation) - Incoming fetch() getReader() + mutation guard: the precise original bug scenario — host-backed body, both branches via getReader() Tests 2 and 4 currently fail: the tee implementation enqueues the same Uint8Array reference to both branches rather than cloning each chunk, so fill(0) on the original's chunks corrupts the clone's queued data. This is a separate bug from the materialisation fix in PR #312 and blocks release. Update KNOWN_LIMITATIONS.md and CONTEXT_INDEX.md to document the tee chunk independence bug and mark Response.clone() as partially implemented.
…core/integration)
…-then-clone guards
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the SDK’s declared Fetch API surface to include Response.clone() and expands the “production invocation” test application + workflow to validate Response.clone() behavior end-to-end against a deployed FastEdge WASM app. It also adds internal context docs describing StarlingMonkey patching and updates testing/documentation indices accordingly.
Changes:
- Expose
Response.clone()intypes/globals.d.tsand remove now-stale limitation notes. - Refactor/expand the prod-invocation test application into a TS + Hono structure with auto-discovered Node check modules, including a comprehensive
Response.clone()guard. - Update CI workflow/scripts and internal context docs to support the new test app layout and patch-tracking process.
Reviewed changes
Copilot reviewed 31 out of 35 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
types/globals.d.ts |
Adds Response.clone() to the public type surface. |
scripts/run-test-app-checks.js |
Local runner: bundles check modules and runs them against a deployed app URL. |
scripts/build-test-app.js |
Local builder: compiles the prod-invocation test app to WASM via fastedge-build. |
runtime/fastedge/build.sh |
Builds StarlingMonkey runtime with parallelism based on CPU count. |
pnpm-lock.yaml |
Lockfile updates for added dependencies/metadata. |
package.json |
Adds local prod-invocation test scripts and hono dev dependency. |
integration-tests/test-application/types.ts |
Shared types for handler/check modules. |
integration-tests/test-application/tsconfig.json |
TS config for the prod-invocation test app/checks source. |
integration-tests/test-application/test-app.ts |
New TS entrypoint using Hono to route to handlers. |
integration-tests/test-application/test-app.js |
Removes the prior single-file JS test app implementation. |
integration-tests/test-application/routes.ts |
Central route/name constants for handlers and checks. |
integration-tests/test-application/README.md |
Documents the prod-invocation test app structure and workflows. |
integration-tests/test-application/handlers/env.ts |
Handler: env var smoke check endpoint. |
integration-tests/test-application/handlers/outbound-fetch.ts |
Handler: outbound fetch behavior endpoint. |
integration-tests/test-application/handlers/secret.ts |
Handler: secret injection endpoint. |
integration-tests/test-application/handlers/echo.ts |
Handler: request echo endpoint. |
integration-tests/test-application/handlers/response-clone.ts |
Handler: server-side Response.clone() multi-scenario guard producing JSON results. |
integration-tests/test-application/handlers/multi-chunk-source.ts |
Helper handler: serves multi-chunk streaming body for clone isolation tests. |
integration-tests/test-application/checks/env.ts |
Node check: validates build SHA from deployed app. |
integration-tests/test-application/checks/outbound-fetch.ts |
Node check: validates outbound fetch behavior. |
integration-tests/test-application/checks/secret.ts |
Node check: validates secret value injection. |
integration-tests/test-application/checks/echo.ts |
Node check: validates request method/headers/body echo. |
integration-tests/test-application/checks/response-clone.ts |
Node check: validates all Response.clone() guard assertions. |
integration-tests/test-application/.gitkeep |
Placeholder file retained in test-application directory. |
context/PATCHES.md |
Internal patch tracking + rebase procedure for StarlingMonkey fork/patches. |
context/KNOWN_LIMITATIONS.md |
Removes the resolved Response.clone() limitation entry. |
context/development/TESTING_GUIDE.md |
Clarifies testing layers and adds prod-invocation test commands. |
context/CONTEXT_INDEX.md |
Index updates: adds PATCHES.md and removes stale clone limitation note. |
context/CHANGELOG.md |
Adds entries describing the clone work and prod-guard expansion. |
CLAUDE.md |
Adds a pointer to PATCHES.md for StarlingMonkey submodule bump procedure. |
.gitignore |
Ignores integration-tests/test-application/dist/ artifacts. |
.github/workflows/prod-invocation.yaml |
Updates workflow to deploy dist/test-app.wasm and clean dist/. |
.github/scripts/prod-invocation/create-test-app.js |
Builds TS test app to WASM and bundles check modules to dist/checks. |
.github/scripts/prod-invocation/invoke-test-app.js |
Runs all auto-discovered check modules with retry logic. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
qrdl
approved these changes
Jun 10, 2026
|
🎉 This PR is included in version 2.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
PR's upstream: If they will not merge, we will turn these into override's on our side:
bytecodealliance/StarlingMonkey#312
bytecodealliance/StarlingMonkey#313
For now we just keep them in our fork and wait and see...