Chunked Encoding / Server Sent Events Pre-Work#24
Merged
thecodedrift merged 1 commit intomainfrom Jul 11, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for a “chunk” lifecycle in the WebAssembly pack flow, centralizes lifecycle handling, updates logging to allow optional data logging, and reorganizes utility files for clarity.
- Introduce a new
chunkexecutor and wiring through therunPackLifecycledispatcher - Refactor
runSandboxinto a unifiedrunfunction handlingpre,chunk, andpostphases - Add an
enableDataLoggingflag tocreateLoggerand relocate errors, IDs, and logger intoutil
Reviewed Changes
Copilot reviewed 15 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/util/logger.ts | Added enableDataLogging flag and simplified log-level function setup |
| src/lib/taskless.ts | Updated imports, hooked enableDataLogging into logger, integrated chunk |
| src/lib/sandbox.ts | Refactored sandbox runner into run using shared lifecycle executors |
| src/lib/msw.ts | Renamed handler logic to msw.ts, updated calls to run and ID imports |
| src/lib/lifecycle/types.ts | Defined LifecycleCallbacks and executor signature |
| src/lib/lifecycle/pre.ts | Implemented pre lifecycle respecting optional methods |
| src/lib/lifecycle/post.ts | Implemented post lifecycle respecting optional methods |
| src/lib/lifecycle/chunk.ts | Added chunk lifecycle for streaming response bodies |
| src/lib/lifecycle/helpers.ts | Extended sandbox payload creator to include chunk and binary support |
| src/lib/lifecycle.ts | Central dispatcher for pre, post, and chunk executors |
| src/index.ts | Adjusted environment merging logic to filter undefined sources |
| scripts/generate.ts | Removed WASM directory cleanup |
| .prettierignore | Added vendor directory to ignore list |
| .eslintignore | Added src/vendor directory to ignore list |
| .changeset/twenty-toes-laugh.md | Documented new chunked event-stream support |
Files not reviewed (4)
- src/generated/manifest.ts: Language not supported
- src/generated/openapi.ts: Language not supported
- src/generated/pack.ts: Language not supported
- src/generated/schema.ts: Language not supported
Comments suppressed due to low confidence (3)
src/lib/taskless.ts:130
- The variable
useLoggingis not defined in this scope, leading to a reference error. Replace it with the correct option (e.g.,options.enableDataLogging) or declare it properly.
const logger = createLogger(options?.logLevel, options?.log, useLogging);
src/lib/sandbox.ts:8
- The
isDefinedhelper now drops all falsy but valid values (0,'',false). Consider usingvalue !== undefinedto only filter outundefined.
return Boolean(value && value !== undefined);
src/index.ts:104
- This check skips falsy but valid environment values (
0,'',false). It should explicitly test forvalue === undefinedinstead to only skip missing entries.
if (!value) {
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.
This resolves #23 by doing the following:
chunkmethod that may exist in WebAssembly Packsmethodsproperty in thepre2manifest that is optional. It allows the Pack author to declare which lifecycle methods are availablepre/postbehaves differently thanchunkhandler.tstomsw.tsfor clarityid,error, andloggerfiles to a more general util folder