Repository navigation
Fix filesystem and HTTP file range precision loss - #8110
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: f2fd26b The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 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
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
tim-smart
commented
Sep 7, 2026
| @@ -0,0 +1,85 @@ | |||
| import { assert, describe, it } from "@effect/vitest" | |||
Contributor
Author
There was a problem hiding this comment.
Please don't create one-off tests files for this
tim-smart
commented
Sep 7, 2026
This was referenced Sep 10, 2026
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.
Filesystem writes and stats could silently round
9007199254740993to9007199254740992. Writes now reject unsafe positions withPlatformError/BadArgument. Stats request bigint values and preservesizeandblksizeexactly.Number-typed metadata (
dev,ino,rdev,mode,nlink,uid,gid, andblocks) must be safe integers. An unsafe value fails the whole stat operation, including optional fields. The publicFile.Infodocumentation explains that large inode values can therefore prevent stat and HTTP file serving even for small files.HttpPlatformfile responses keep content lengths as bigint and write exact decimal headers, so whole files above the safe integer limit remain supported. EOF clamping and static-server range arithmetic retain exact sizes, including suffix, open-ended, and 416 totals. Invalid numeric inputs and unrepresentable runtime range bounds fail withBadArgumentinstead of defects or rounding.HttpPlatform.makenow supplies bigintcontentLengthto its platform callback. Node and Deno compare empty lengths as bigint; Deno derives bounded stream lengths from checked numeric start/end bounds. The portable platform retains numeric body-length metadata only when safe and always preserves the exact header. Bun also writes the exact length header.Writes retain checked numeric positions because callback-based
fs.writeignores bigint positions. Small-file probes confirmed this on Node 18.0.0, 20.0.0, 22.0.0, 24.0.0, 26.4.0, and 26.7.0, matching Node's documented non-number position behavior. Oversized regression cases use doubles.Validation at
3abe687:nix develop -c pnpm lint-fix,nix develop -c pnpm check, and Deno type checking ofDenoHttpPlatform.tspass.nix develop -c pnpm test-types FileSystem.tst.tspasses on both selected TypeScript targets (16 assertions).nix develop -c pnpm jsdocs --checkreports only two errors in unchangedLogger.ts: an out-of-order@seeand an unresolvedconsolePrettylink.Review cleanup at
f2fd26b: precision coverage is consolidated into the existing test files and reduced from 63 cases to 20. Shared range validation runs in core; Node and Bun retain adapter-specific end-bound and exact-header checks. The changeset uses the suggested single sentence. Implementation is unchanged.Current validation: all 85 tests across the five affected suites pass (71 Node/core, 14 Bun), down from 128 (108 Node/core, 20 Bun). Both runs used shuffled execution with seed 1309.
pnpm lint-fix,pnpm check, andgit diff --checkpass.Separate backlog follow-up: EFF-1310 covers
HttpBody.file/fileFromInfocontent-length precision loss and invalid range inputs causing defects, includingHttpClientRequest.bodyFile. Assigned to The Boys; this PR does not implement that follow-up.Closes EFF-1309