Repository navigation
docs(hyperfly): document every public export for 1.0 - #93
Merged
Merged
Conversation
readBody and fetchArtifact kept references to stream chunks until EOF, so a stream that reuses one buffer across chunks produced corrupted bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Buffer.prototype.slice returns a view, so a stream yielding Buffers that reuse one allocation still corrupted the body. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onses decodeResponse rejects malformed UTF-8 in JSON bodies as DecodeError "json". readBody refuses a locked or consumed body with 400 and reports invalid options through the returned promise. encodeFor throws EncodeError "json" for values JSON cannot represent. respond sends no body for HEAD and for 204, 205 and 304 with the negotiated headers, and discovery answers only GET and HEAD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A throwing deflate hook, or one that returns something other than a Uint8Array, now fails encoding with EncodeError "packed", carrying the hook's error as cause, as inflate failures already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With validate: true, decode checks the decoded value against the schema and returns it as decoded, so a value-changing check such as overwrite is not applied a second time. The validating codec is frozen like compileIR's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
serializeArtifact checks the IR, layout and profile as compileIR does and throws the same HyperflyError codes instead of emitting invalid text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An ArrayBuffer or other non-Uint8Array chunk is refused with 400 before it is counted or copied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
readBody honours a Content-Length of ASCII digits with surrounding spaces or tabs and otherwise counts the bytes as they arrive, as the Python package does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
readBody and fetchArtifact check and count each chunk with the %TypedArray%.prototype getters, so a subclass with an overridden byteLength cannot pass the byte cap and a Uint8Array from another realm is accepted. Refusing a chunk that is not bytes cancels the stream as the 413 path does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Catch blocks that check the caught value with instanceof now treat a value whose prototype cannot be read, such as a revoked proxy, as not a library error, so it is wrapped or rethrown as itself instead of raising a native TypeError from the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The type check and the byte count use the %TypedArray% getters, so a subclass cannot misreport its length and a Uint8Array from another realm is accepted. A refused chunk cancels the stream like an oversized one, and a locked body is refused instead of throwing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ttp-robustness # Conflicts: # packages/hyperfly/src/http.ts # packages/hyperfly/test/http.test.ts
Rename NegotiateOptions.accept to httpAccept, WellKnownResponse to ArtifactResponse and FetchHandlerOptions to RespondOptions, matching the Python names. encodeFor takes EncodeOptions, whose onFallback receives (error, "encoder-limit"). JSON negotiations carry a FallbackReason and readBody refusals a RequestRefusal, with the same strings as the Python package. Name the result unions (ReadBodyResult, DecodedResponse, HyperflyNegotiation, JsonNegotiation) and make CodecRegistry generic over its payload type, which negotiate, encodeFor, respond, readBody and decodeResponse infer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ttp-api-1.0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rom any realm respond sends the negotiated headers for HEAD and 204, 205 and 304 without encoding the value. The deflate result is checked with the intrinsic typed array tag, shared with readBody, so a Uint8Array from another realm is accepted. serializeArtifact reads the profile inside its coded boundary, and readBody compares Content-Length to maxBytes digit by digit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
respond encodes the value for HEAD exactly as for GET, so the JSON fallback headers match, and drops the body; only 204, 205 and 304 skip encoding. The changeset is shortened to the two-sentence limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
serializeArtifact keeps its validateIR check, which now enforces the 512 nesting bound from main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # packages/hyperfly/src/http.ts
# Conflicts: # packages/hyperfly/README.md # packages/hyperfly/src/http.ts # packages/hyperfly/test/http.test.ts
…d type A value of another type no longer widens T in respond or encodeFor, so respond(request, "wrong", CodecRegistry<"allowed">) fails to compile instead of throwing EncodeError at run time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT 6.1 Sol <noreply@openai.com>
…E and site Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # packages/hyperfly/README.md # packages/hyperfly/src/errors.ts # packages/hyperfly/src/http.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Documentation only. No code, type or test changes.
JSDoc on every public export of
hyperfly,hyperfly/zodandhyperfly/http:artifact;Codecand its members,CompileOptionswith each default,PackHooks,Limits;trainoptions and their validation rules;LoadArtifactOptions,FetchArtifactOptions,ReadBodyOptions,Encoded).Defaults are taken from the code.
Stability links:
artifactamong the TypeScript error codes.Tests
A check that the
src/diff has no non-comment lines prints nothing. Gates on this branch merged with main (1508d69): lint, check-types, andbun testwith 1440 passing and 0 failing. The changeset check is ok.Review
Sol checked every statement against the code. Defaults, train clamps, spec headings and policy anchors all match. Its three corrections (the
maxByteLengthscope and the full meanings ofpackedandjson) are in fcb8442.🤖 Generated with Claude Code