Skip to content

test(zlib): expand granular Node parity coverage - #6886

Merged
proggeramlug merged 2 commits into
mainfrom
test/expand-node-zlib-parity
Jul 29, 2026
Merged

test(zlib): expand granular Node parity coverage#6886
proggeramlug merged 2 commits into
mainfrom
test/expand-node-zlib-parity

Conversation

@TheHypnoo

@TheHypnoo TheHypnoo commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

  • expand the granular node:zlib parity suite from 58 to 92 fixtures
  • cover exports, constructors, dictionaries, callback shapes, options, truncation, trailing input, and zlib-specific stream lifecycle
  • pin evidence to Node 26.5.0 and compare Bun 1.2.18 and Deno 2.9.3
  • update the clean Perry baseline from 58/58 to 62/92

Changes

File Change
test-parity/node-suite/zlib/** Add 34 deterministic fixtures and a complete evidence map
test-parity/node_suite_baseline.json Set the measured zlib floor to 62/92

Related issue

n/a — standalone parity coverage expansion

Test plan

  • Node 26.5.0: 92/92 clean exits with the same stdout hash across three runs
  • Perry: 62 matches and 30 stable diffs across three focused runs; no compile failures, crashes, or timeouts
  • Bun 1.2.18: 86 matches and 6 stable diffs; no errors, crashes, or timeouts
  • Deno 2.9.3: 83 matches and 9 stable diffs; no errors, crashes, or timeouts
  • cargo build --release -p perry -p perry-runtime -p perry-stdlib -p perry-runtime-static -p perry-stdlib-static
  • deno fmt --check for the README and all added fixtures
  • python3 -m json.tool test-parity/node_suite_baseline.json
  • git diff --check

scripts/check_file_size.sh reports two pre-existing main-branch failures: crates/perry-runtime/src/object/mod.rs at 2039 lines and crates/perry-stdlib/src/readline.rs at 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

  • I have NOT bumped the workspace version or edited CLAUDE.md / CHANGELOG.md (maintainer handles these at merge)
  • My commits follow the loose feat: / fix: / docs: / chore: prefix convention used in the log
  • I've read CONTRIBUTING.md and agree to the Code of Conduct
  • No changes under test-files/test_parity_*.ts

Summary by CodeRabbit

  • New Features
    • Expanded the zlib compatibility suite from 58 to 92 contracts with added coverage for callbacks, option validation/order, immutable exports/constants, constructor/prototype behavior, dictionaries (including Brotli/Zstandard and type variants), CRC32 edge cases, and gzip/unzip stream edge scenarios.
    • Added additional stream lifecycle and roundtrip checks (including flush/close/reset behaviors, output limits, and codec conversions).
  • Documentation
    • Reworked the zlib parity documentation with expanded contract detail, fixture inventory, evidence references, measurements, and audit criteria.
  • Tests
    • Updated worker baseline thresholds to match the expanded suite.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The 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

Layer / File(s) Summary
Suite documentation and coverage accounting
test-parity/node-suite/zlib/README.md, test-parity/node_suite_baseline.json
Documents locked sources, measurements, fixture coverage, audit rules, and updates baseline values from 58/58 to 62/92.
API surface and callback contracts
test-parity/node-suite/zlib/async/*, convenience/*, constants/*, crc32/*, imports/*, inputs/*
Adds fixtures for callbacks, constructors, factories, metadata, prototypes, constants, CRC32 seeds, aliases, and SharedArrayBuffer inputs.
Dictionary compression and source handling
test-parity/node-suite/zlib/dictionary/*
Covers dictionary roundtrips, missing dictionaries, invalid types, typed sources, streaming, Brotli, and Zstandard.
Compression options and validation behavior
test-parity/node-suite/zlib/options/*, validation/*
Covers option validation, Brotli limits and parameters, validation order, trailing garbage, dynamic parameters, and truncated streams.
Streaming codecs and lifecycle behavior
test-parity/node-suite/zlib/streams/*, test-parity/node-suite/zlib/gzip/*, test-parity/node-suite/zlib/unzip/*
Adds stream roundtrips and fixtures for flush ordering, reset, byte accounting, close/error state, one-byte members, and trailing bytes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested labels: parity

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: expanding granular Node zlib parity coverage.
Description check ✅ Passed The description follows the required template and includes complete summary, changes, issue, test plan, and checklist sections.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/expand-node-zlib-parity

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 674df74 and 9d72865.

📒 Files selected for processing (36)
  • test-parity/node-suite/zlib/README.md
  • test-parity/node-suite/zlib/async/error-callback-shape.ts
  • test-parity/node-suite/zlib/async/options-overload-and-callback.ts
  • test-parity/node-suite/zlib/constants/immutability.ts
  • test-parity/node-suite/zlib/convenience/constructors.ts
  • test-parity/node-suite/zlib/convenience/factory-instances.ts
  • test-parity/node-suite/zlib/convenience/info-result.ts
  • test-parity/node-suite/zlib/convenience/prototype-chains.ts
  • test-parity/node-suite/zlib/crc32/seed-validation.ts
  • test-parity/node-suite/zlib/dictionary/brotli-roundtrip.ts
  • test-parity/node-suite/zlib/dictionary/deflate-roundtrip.ts
  • test-parity/node-suite/zlib/dictionary/invalid-type.ts
  • test-parity/node-suite/zlib/dictionary/source-types.ts
  • test-parity/node-suite/zlib/dictionary/stream-application.ts
  • test-parity/node-suite/zlib/dictionary/zstd-roundtrip.ts
  • test-parity/node-suite/zlib/gzip/trailing-null-bytes.ts
  • test-parity/node-suite/zlib/imports/legacy-constant-aliases.ts
  • test-parity/node-suite/zlib/inputs/shared-array-buffer.ts
  • test-parity/node-suite/zlib/options/brotli-params-roundtrip.ts
  • test-parity/node-suite/zlib/options/chunk-size-validation.ts
  • test-parity/node-suite/zlib/options/flush-validation.ts
  • test-parity/node-suite/zlib/options/level-strategy-validation.ts
  • test-parity/node-suite/zlib/options/max-output-length.ts
  • test-parity/node-suite/zlib/options/validation-order.ts
  • test-parity/node-suite/zlib/options/window-bits-zero.ts
  • test-parity/node-suite/zlib/streams/bytes-written-trailing.ts
  • test-parity/node-suite/zlib/streams/close-state.ts
  • test-parity/node-suite/zlib/streams/codec-roundtrips.ts
  • test-parity/node-suite/zlib/streams/error-close.ts
  • test-parity/node-suite/zlib/streams/flush-order.ts
  • test-parity/node-suite/zlib/streams/reset-before-write.ts
  • test-parity/node-suite/zlib/unzip/one-byte-members.ts
  • test-parity/node-suite/zlib/validation/params-arguments.ts
  • test-parity/node-suite/zlib/validation/reject-trailing-garbage.ts
  • test-parity/node-suite/zlib/validation/truncated-finish-flush.ts
  • test-parity/node_suite_baseline.json

Comment thread test-parity/node-suite/zlib/constants/immutability.ts Outdated
Comment thread test-parity/node-suite/zlib/dictionary/source-types.ts
Comment thread test-parity/node-suite/zlib/gzip/trailing-null-bytes.ts
Comment thread test-parity/node-suite/zlib/options/brotli-params-roundtrip.ts
Comment thread test-parity/node-suite/zlib/README.md Outdated
Comment thread test-parity/node-suite/zlib/streams/error-close.ts
@proggeramlug
proggeramlug merged commit 9a92a7c into main Jul 29, 2026
30 of 31 checks passed
@proggeramlug
proggeramlug deleted the test/expand-node-zlib-parity branch July 29, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants