Skip to content

test(module): expand granular Node parity coverage#6489

Open
TheHypnoo wants to merge 2 commits into
mainfrom
test/expand-node-module-parity
Open

test(module): expand granular Node parity coverage#6489
TheHypnoo wants to merge 2 commits into
mainfrom
test/expand-node-module-parity

Conversation

@TheHypnoo

@TheHypnoo TheHypnoo commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • expand the granular node:module lane from 28 to 69 runner-visible entries with 41 deterministic contracts
  • cover public exports/descriptors, Module, CommonJS loading and cache graphs, createRequire, package boundaries, CJS/ESM/JSON interop, source maps, loader-hook ordering, compile-cache state, TypeScript stripping, and builtin ESM synchronization
  • add controlled local CJS/ESM/JSON/package/source-map fixtures with failure-safe cleanup and portable path normalization
  • document pinned Node 26.5.0, Deno 2.9.2, and Bun 1.2.18 sources plus a per-entry evidence matrix
  • ratchet the measured focused baseline from 28/28 to 29/69 without changing runtime or compiler behavior

Coverage

  • CommonJS: 3 added, 5 total
  • exports: 5 added, 5 total
  • helpers: 3 added, 6 total
  • imports/interoperability: 5 added, 6 total
  • loaders: 1 added, 19 total (including 10 pre-existing executable fixture modules)
  • methods: 4 added, 6 total
  • require/resolution/packages: 13 added, 15 total
  • source maps: 7 added, 7 total

Verification

  • all 69 entries execute successfully under Node 26.5.0
  • repeated complete Node output is byte-identical: 85ffb7464d6c8e860fb2741cc635c2d59711636d1dfafb5a742a8355c95ab1a2
  • repeated focused Perry runs are identical: 29/69, with 37 output differences and 3 compile failures
  • compile failures are stable in package-condition selection, require error classification, and package export boundaries; no compile timeout, runtime timeout, or signal bucket
  • two detailed per-file Perry classifications are byte-identical: 3eddc8e08d9e49fffe8633061efd8bb7e566e3f41e664a2e3e291d5bcda30ef6
  • Deno additions: 17 exact matches, 18 successful differences, 6 non-zero exits
  • Bun additions: 9 exact matches, 18 successful differences, 14 non-zero exits
  • formatting, Rust formatting, file-size gate, JSON/count/baseline invariants, staged diff checks, generated-artifact scans, and release compiler build pass
  • independent standards and specification reviews found no publishing blockers after provenance, cleanup, portability, and evidence fixes

Boundaries

The exact Node 26.5.0 build rejects TypeScript transform mode, so the suite records supported stripping and validation behavior rather than borrowing output from another build. Permission-dependent compile-cache failures, custom generated loader source, runtime virtual modules, symlink/realpath matrices, workers, policies, native addons, SEA/snapshots, coverage/inspector, watch mode, races, stress, and platform-specific global paths remain separate lanes. Node remains authoritative where Deno and Bun intentionally diverge.

Summary by CodeRabbit

  • New Features

    • Expanded module compatibility coverage across CommonJS, ESM, JSON imports, package resolution, caching, loader hooks, source maps, and TypeScript syntax handling.
    • Added validation for module exports, constructors, descriptors, built-in detection, compile-cache behavior, and error handling.
  • Documentation

    • Added reproducible evidence guidance, runtime comparison matrices, execution rules, and defined coverage boundaries.
  • Tests

    • Updated regression-suite baselines and aggregate parity metrics to reflect the expanded coverage.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Expands the node:module parity lane from 28 to 69 runner-visible entries, covering exports, CommonJS and ESM loading, require/cache behavior, loader hooks, compile-cache and TypeScript helpers, SourceMap APIs, fixtures, evidence documentation, and updated baseline totals.

Changes

Node module parity lane

Layer / File(s) Summary
Evidence and baseline updates
test-parity/node-suite/module/README.md, test-parity/node-suite/module/EVIDENCE.md, test-parity/node_suite_baseline.json
Documents Node 26.5.0 oracle behavior, reproduction hashes, expanded coverage boundaries, classifications, and updated aggregate/module totals.
Module API surface probes
test-parity/node-suite/module/commonjs/*, test-parity/node-suite/module/exports/*, test-parity/node-suite/module/helpers/*, test-parity/node-suite/module/methods/*
Adds diagnostics for constructors, exports, descriptors, compile cache, TypeScript stripping, built-in detection, package lookup, function shapes, and builtin export synchronization.
Import and loader behavior
test-parity/node-suite/module/imports/*, test-parity/node-suite/module/loader/*
Adds CommonJS/ESM identity checks, JSON import behavior, package conditions, and loader hook ordering coverage.
CommonJS require and cache behavior
test-parity/node-suite/module/require/*
Adds coverage for createRequire, resolution, errors, extensions, cycles, module metadata, cache identity, parent-child relationships, package boundaries, and supporting fixtures.
SourceMap behavior
test-parity/node-suite/module/source-map/*
Adds SourceMap construction, cloning and getter semantics, descriptor and receiver validation, lookup boundaries, malformed/indexed mappings, and inline source-map coverage.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed, but it misses required template sections like Changes, Related issue, Test plan, Screenshots/output, and Checklist. Add the missing template sections with concrete change bullets, a related issue or n/a, a test plan with commands, and the checklist/screenshots fields as applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: expanding granular Node module parity coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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-module-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.

🧹 Nitpick comments (1)
test-parity/node-suite/module/methods/find-package-json.ts (1)

3-4: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add path separator normalization for cross-platform deterministic output.

The returned paths from findPackageJSON and process.cwd() might contain backslashes (\) on Windows. To ensure the parity script's output is consistently portable across environments, replace backslashes with forward slashes, similar to the slash helper used in resolve-paths.ts.

♻️ Proposed refactor
-const normalize = (value: unknown) =>
-  String(value).replace(process.cwd(), "<cwd>");
+const normalize = (value: unknown) =>
+  String(value).replace(process.cwd(), "<cwd>").replaceAll("\\", "/");
🤖 Prompt for 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.

In `@test-parity/node-suite/module/methods/find-package-json.ts` around lines 3 -
4, Update the normalize helper to convert backslashes to forward slashes for
both the input value and process.cwd() before replacing the working-directory
prefix, matching the cross-platform normalization used by the slash helper in
resolve-paths.ts.
🤖 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.

Nitpick comments:
In `@test-parity/node-suite/module/methods/find-package-json.ts`:
- Around line 3-4: Update the normalize helper to convert backslashes to forward
slashes for both the input value and process.cwd() before replacing the
working-directory prefix, matching the cross-platform normalization used by the
slash helper in resolve-paths.ts.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e1f399e-b787-40a5-828d-fe6e9a927ed7

📥 Commits

Reviewing files that changed from the base of the PR and between 77def53 and f2e94e2.

⛔ Files ignored due to path filters (8)
  • test-parity/node-suite/module/node_modules/parity-conditions/import.mjs is excluded by !**/node_modules/**
  • test-parity/node-suite/module/node_modules/parity-conditions/package.json is excluded by !**/node_modules/**
  • test-parity/node-suite/module/node_modules/parity-conditions/require.cjs is excluded by !**/node_modules/**
  • test-parity/node-suite/module/require/node_modules/parity-exports/feature.cjs is excluded by !**/node_modules/**
  • test-parity/node-suite/module/require/node_modules/parity-exports/internal.cjs is excluded by !**/node_modules/**
  • test-parity/node-suite/module/require/node_modules/parity-exports/legacy.cjs is excluded by !**/node_modules/**
  • test-parity/node-suite/module/require/node_modules/parity-exports/package.json is excluded by !**/node_modules/**
  • test-parity/node-suite/module/require/node_modules/parity-exports/root.cjs is excluded by !**/node_modules/**
📒 Files selected for processing (60)
  • test-parity/node-suite/module/EVIDENCE.md
  • test-parity/node-suite/module/README.md
  • test-parity/node-suite/module/commonjs/constructor-prototype.ts
  • test-parity/node-suite/module/commonjs/prototype-descriptors.ts
  • test-parity/node-suite/module/commonjs/wrap-wrapper.ts
  • test-parity/node-suite/module/exports/builtin-modules.ts
  • test-parity/node-suite/module/exports/constants.ts
  • test-parity/node-suite/module/exports/default-static-identity.ts
  • test-parity/node-suite/module/exports/descriptors.ts
  • test-parity/node-suite/module/exports/public-surface.ts
  • test-parity/node-suite/module/helpers/compile-cache-disabled.ts
  • test-parity/node-suite/module/helpers/compile-cache.ts
  • test-parity/node-suite/module/helpers/strip-options-validation.ts
  • test-parity/node-suite/module/helpers/strip-syntax.ts
  • test-parity/node-suite/module/imports/cjs-dynamic-identity.ts
  • test-parity/node-suite/module/imports/cjs-namespace.ts
  • test-parity/node-suite/module/imports/fixtures/cjs-object.cjs
  • test-parity/node-suite/module/imports/json-attribute.ts
  • test-parity/node-suite/module/imports/json-require-identity.ts
  • test-parity/node-suite/module/imports/package-conditions.ts
  • test-parity/node-suite/module/loader/register-hooks-order.ts
  • test-parity/node-suite/module/methods/find-package-json.ts
  • test-parity/node-suite/module/methods/function-shapes.ts
  • test-parity/node-suite/module/methods/is-builtin-validation.ts
  • test-parity/node-suite/module/methods/sync-builtin-exports.ts
  • test-parity/node-suite/module/require/cache-identity-deletion.ts
  • test-parity/node-suite/module/require/create-require-overloads.ts
  • test-parity/node-suite/module/require/cycles.ts
  • test-parity/node-suite/module/require/error-fields.ts
  • test-parity/node-suite/module/require/exports-alias.ts
  • test-parity/node-suite/module/require/extensions.ts
  • test-parity/node-suite/module/require/fixtures/child.cjs
  • test-parity/node-suite/module/require/fixtures/custom.ext
  • test-parity/node-suite/module/require/fixtures/cycle-a.cjs
  • test-parity/node-suite/module/require/fixtures/cycle-b.cjs
  • test-parity/node-suite/module/require/fixtures/data.json
  • test-parity/node-suite/module/require/fixtures/exports-alias.cjs
  • test-parity/node-suite/module/require/fixtures/find-package/nested/probe.cjs
  • test-parity/node-suite/module/require/fixtures/find-package/package.json
  • test-parity/node-suite/module/require/fixtures/metadata.cjs
  • test-parity/node-suite/module/require/fixtures/parent.cjs
  • test-parity/node-suite/module/require/fixtures/pkg-main/lib/entry.cjs
  • test-parity/node-suite/module/require/fixtures/pkg-main/package.json
  • test-parity/node-suite/module/require/fixtures/value.cjs
  • test-parity/node-suite/module/require/function-descriptors.ts
  • test-parity/node-suite/module/require/json-cache.ts
  • test-parity/node-suite/module/require/module-load.ts
  • test-parity/node-suite/module/require/module-metadata.ts
  • test-parity/node-suite/module/require/package-boundaries.ts
  • test-parity/node-suite/module/require/parent-children.ts
  • test-parity/node-suite/module/require/resolve-paths.ts
  • test-parity/node-suite/module/source-map/constructor-payload.ts
  • test-parity/node-suite/module/source-map/descriptors-validation.ts
  • test-parity/node-suite/module/source-map/find-inline.ts
  • test-parity/node-suite/module/source-map/fixtures/inline-map.cjs
  • test-parity/node-suite/module/source-map/getter-semantics.ts
  • test-parity/node-suite/module/source-map/lookup-boundaries.ts
  • test-parity/node-suite/module/source-map/malformed-indexed.ts
  • test-parity/node-suite/module/source-map/receiver-validation.ts
  • test-parity/node_suite_baseline.json

…le-parity

# Conflicts:
#	test-parity/node_suite_baseline.json
@proggeramlug proggeramlug added the ready PR triaged: CodeRabbit feedback + conflicts addressed label Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready PR triaged: CodeRabbit feedback + conflicts addressed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants