test(zlib): expand granular Node parity coverage - #6886
Conversation
📝 WalkthroughWalkthroughChangesThe zlib parity suite adds documented evidence and coverage accounting, raises the baseline from 58/58 to 62/92, and introduces fixtures for API shapes, dictionaries, option validation, asynchronous callbacks, stream codecs, lifecycle states, and error behavior. Node zlib parity suite
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test-parity/node-suite/zlib/constants/immutability.ts`:
- Line 1: Replace the namespace import in the zlib immutability test with the
default node:zlib import, matching the pattern used by
legacy-constant-aliases.ts. Keep the existing assignmentResult check unchanged
so it targets the runtime CommonJS export object's codes property.
In `@test-parity/node-suite/zlib/dictionary/source-types.ts`:
- Around line 25-28: Update the loop over sources to first decompress each
compressed payload without a dictionary and verify/report the expected
Z_NEED_DICT outcome, then retain the dictionary-based inflate using the typed
source. Ensure this validation runs for buffer, uint8array, dataview, and
arraybuffer entries and distinguishes the missing-dictionary result from
successful decompression.
In `@test-parity/node-suite/zlib/gzip/trailing-null-bytes.ts`:
- Around line 9-14: Update the gzip fixture’s sync and async gunzip handling
around zlib.gunzipSync and zlib.gunzip so trailing-byte failures are captured
rather than thrown or dereferenced unsafely. Catch sync errors and log the error
field with a null-safe output; in the async callback, log both the error details
and a null-safe output instead of calling toString when output is unavailable.
In `@test-parity/node-suite/zlib/options/brotli-params-roundtrip.ts`:
- Around line 5-8: The brotli round-trip fixture does not expose whether
BROTLI_PARAM_QUALITY affects compression. Update the output in the quality loop
around brotliCompressSync to include a deterministic representation of
compressed, such as its Base64 encoding, alongside the existing decompression
equality result, while preserving the current quality values and round-trip
check.
In `@test-parity/node-suite/zlib/README.md`:
- Line 63: Update the factory-instances README row to accurately describe only
the non-Zstd create* factories currently covered through createBrotliDecompress,
or add the missing Zstd factory instance assertions to
convenience/factory-instances.ts before retaining the broader wording. Keep the
documentation and fixture coverage consistent.
In `@test-parity/node-suite/zlib/streams/error-close.ts`:
- Around line 13-20: Update the error-close handler around stream.close() to
invoke close() a second time after the first close callback completes, then
retain the existing “close again” state logging and resolve flow so the test
validates repeated-close behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d1d8e4c2-2965-43d2-9e27-b1b00b16a93d
📒 Files selected for processing (36)
test-parity/node-suite/zlib/README.mdtest-parity/node-suite/zlib/async/error-callback-shape.tstest-parity/node-suite/zlib/async/options-overload-and-callback.tstest-parity/node-suite/zlib/constants/immutability.tstest-parity/node-suite/zlib/convenience/constructors.tstest-parity/node-suite/zlib/convenience/factory-instances.tstest-parity/node-suite/zlib/convenience/info-result.tstest-parity/node-suite/zlib/convenience/prototype-chains.tstest-parity/node-suite/zlib/crc32/seed-validation.tstest-parity/node-suite/zlib/dictionary/brotli-roundtrip.tstest-parity/node-suite/zlib/dictionary/deflate-roundtrip.tstest-parity/node-suite/zlib/dictionary/invalid-type.tstest-parity/node-suite/zlib/dictionary/source-types.tstest-parity/node-suite/zlib/dictionary/stream-application.tstest-parity/node-suite/zlib/dictionary/zstd-roundtrip.tstest-parity/node-suite/zlib/gzip/trailing-null-bytes.tstest-parity/node-suite/zlib/imports/legacy-constant-aliases.tstest-parity/node-suite/zlib/inputs/shared-array-buffer.tstest-parity/node-suite/zlib/options/brotli-params-roundtrip.tstest-parity/node-suite/zlib/options/chunk-size-validation.tstest-parity/node-suite/zlib/options/flush-validation.tstest-parity/node-suite/zlib/options/level-strategy-validation.tstest-parity/node-suite/zlib/options/max-output-length.tstest-parity/node-suite/zlib/options/validation-order.tstest-parity/node-suite/zlib/options/window-bits-zero.tstest-parity/node-suite/zlib/streams/bytes-written-trailing.tstest-parity/node-suite/zlib/streams/close-state.tstest-parity/node-suite/zlib/streams/codec-roundtrips.tstest-parity/node-suite/zlib/streams/error-close.tstest-parity/node-suite/zlib/streams/flush-order.tstest-parity/node-suite/zlib/streams/reset-before-write.tstest-parity/node-suite/zlib/unzip/one-byte-members.tstest-parity/node-suite/zlib/validation/params-arguments.tstest-parity/node-suite/zlib/validation/reject-trailing-garbage.tstest-parity/node-suite/zlib/validation/truncated-finish-flush.tstest-parity/node_suite_baseline.json
Summary
node:zlibparity suite from 58 to 92 fixturesChanges
test-parity/node-suite/zlib/**test-parity/node_suite_baseline.jsonRelated issue
n/a — standalone parity coverage expansion
Test plan
cargo build --release -p perry -p perry-runtime -p perry-stdlib -p perry-runtime-static -p perry-stdlib-staticdeno fmt --checkfor the README and all added fixturespython3 -m json.tool test-parity/node_suite_baseline.jsongit diff --checkscripts/check_file_size.shreports two pre-existing main-branch failures:crates/perry-runtime/src/object/mod.rsat 2039 lines andcrates/perry-stdlib/src/readline.rsat 2066 lines. This pull request changes neither file.Scope exclusions
Large inputs, OOM and memory pressure, random data, fuzzing, GC, weak references, races, workers, signals, snapshots, private handles, fs pipelines, generic stream behavior, and backend-specific compressed bytes remain excluded. The README records each boundary and the stopping rule.
Checklist
feat:/fix:/docs:/chore:prefix convention used in the logtest-files/test_parity_*.tsSummary by CodeRabbit