Repository navigation
fix: preserve Pako decompression errors when reading objects - #2451
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to No actionable issue remains from this review. The change is mergeable after normal checks. Security Architecture Review
Pre-merge checks |
|
|
There is a conflict with the list of contributors. Can you resolve it? |
|
Addressed both review findings in d899055.
On Node 22 and Node 24, lint, Rollup, declarations, native JavaScript typecheck and all ten focused suites passed (87 tests and 36 snapshots on each runtime). A contained Chromium smoke test round-tripped binary input and rejected three corrupt streams with nonempty diagnostics. This is focused validation, not a full-suite pass. The prior contributor-list conflict resolution is retained, and the PR description now reflects the error behavior and current validation. |
|
Addressed the error-hierarchy and native-error comments in e5b405d:
On this head, Node 22 and 24 each passed lint, Rollup, declarations, JavaScript typechecking and ten focused suites (89 tests, 36 snapshots). The classification regressions fail against the previously published inflation helpers. Chromium smoke checks passed for valid binary data, three corrupt streams and an asynchronous empty native error. The full Node/Chrome suite was not run for this revision. |
|
Renamed the shared helper, module and focused test to I also reproduced your exact On this head, both Node versions passed lint, Rollup, declarations, JavaScript typechecking and ten focused suites (89 tests, 36 snapshots each). Chromium smoke checks passed for valid binary data, three corrupt streams and an asynchronous empty native error. The full Node/Chrome suite was not run for this revision. |
So could you fix the code? |
Restore literal Unicode contributor names without changing parsed metadata. Reproduce the raw [0, 0] platform error beside nativeInflate and verify the diagnostic, classification, and serialized data.
|
I've restored the literal Unicode names in For c0b935f adds a regression using your actual input, checking the raw failure beside the helper's diagnostic, classification and serialized data. Informative native errors retain their name and message. The updated branch passed lint, build and typechecking, plus 11 focused suites (97 tests and 36 snapshots on each of Node 22 and 24). The full Node/browser suites and a Chromium smoke test were not run for this revision. |
|
🎉 This PR is included in version 1.44.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Pako can throw strings when reading a corrupt loose object. The public command then tries to attach its caller name, masking the decompression diagnostic with a TypeError.
Normalize Pako string failures to DecompressionError, a new BaseError subclass exported through Errors. It retains the diagnostic in its message and data, supports the existing error serialization contract, and identifies corrupt compressed input without InternalError's library-bug guidance. Existing Error instances keep their identity.
Await the native decompression path and normalize its empty TypeError failures in nativeInflate to the same error type with a nonempty diagnostic. Informative native errors are preserved. Native-backend activation remains unchanged; #1932 and #1799 cover that separately.
Regression tests cover inflate, readTree and readObject in regular repositories and submodules, decompressed formats, unchanged deflated passthrough, valid streams, asynchronous native failures, caller attachment and error serialization. Local metadata casts keep direct-source JavaScript typechecking compatible with BaseError's existing runtime shape and fromJSON return contract.
Refs #1833.
Current-revision validation in isolated Linux containers on Node 22 and Node 24: changed-file lint, Rollup, declarations, native JavaScript typecheck and eleven focused suites passed (97 tests and 36 snapshots per runtime). The real [0,0] DecompressionStream example is now a regression test: an empty native TypeError is normalized with classification and serialization preserved, while informative native errors retain their name and message. These are focused checks; the full Node/browser suites and a Chromium smoke test were not run for this revision.
Merged main at
909b97b1617b, preserving every upstream contributor and the existing contribution record. Restored literal Unicode names in .all-contributorsrc without changing its parsed data; regenerating the contributor table leaves README unchanged. The focused run also includes the upstream packfile-integrity suite.The shared helper, module and focused test are named nativeInflate, reflecting support in both Node.js and browsers. The maintainer's direct [0,0] DecompressionStream example was reproduced on Node 22 and 24: the native API throws an empty TypeError, while the helper reports DecompressionError with a nonempty diagnostic.