Skip to content

test(perf_hooks): expand granular Node parity coverage#6493

Merged
proggeramlug merged 3 commits into
mainfrom
test/expand-node-perf-hooks-parity
Jul 20, 2026
Merged

test(perf_hooks): expand granular Node parity coverage#6493
proggeramlug merged 3 commits into
mainfrom
test/expand-node-perf-hooks-parity

Conversation

@TheHypnoo

@TheHypnoo TheHypnoo commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • expand the granular node:perf_hooks suite from 83 to 148 deterministic fixtures
  • add 68 focused contracts, strengthen 7 existing fixtures, and remove 3 redundant or timing-risky cases
  • cover exports and descriptors, branded receivers, user timing, observer lifecycle and EntryList behavior, timerify settlement and histograms, recordable histograms, event-loop delay lifecycle, controlled resource timing, ELU arithmetic, node timing, and GC constants
  • move perf_hooks into the sequential node-suite lane and document the deterministic stopping boundary
  • ratchet the measured Perry floor to 87/148 and update aggregate provenance

Oracle and comparison evidence

  • Node.js 26.5.0: 148/148, repeated twice with byte-identical output and no errors or timeouts
  • Perry release build: 87 pass, 60 stable output differences, 1 stable compile failure, 0 timeouts, repeated twice
  • Deno 2.9.2: 101 pass, 33 differences, 14 runtime errors, 0 timeouts
  • Bun 1.3.14: 97 pass, 24 differences, 27 runtime errors, 0 timeouts

Node 26.5.0 remains authoritative where Deno and Bun expose smaller or intentionally different surfaces.

Validation

  • exact Node fixture execution repeated twice
  • focused sequential Perry classification repeated twice
  • Deno 2.9.2 and Bun 1.3.14 fixture comparison
  • cargo build --release
  • cargo fmt --all -- --check
  • deno fmt --check on all changed suite files
  • Node syntax checks for all 148 TypeScript fixtures
  • scripts/check_file_size.sh
  • JSON, count arithmetic, scope, whitespace, cleanup, handle, and generated-artifact checks

Exclusions

GC/finalization entries, exact event-loop measurements, CPU contention, real network resource timing, workers, trace/inspector integration, bootstrap timestamp snapshots, races, stress, exhaustion, and leak tests remain outside this deterministic lane.

Summary by CodeRabbit

  • New Features

    • Expanded node:perf_hooks compatibility coverage to 148 scenarios, including timing, observers, histograms, resource timing, and timerify.
    • Added validation for API behavior, error handling, object identity, serialization, and lifecycle semantics.
  • Documentation

    • Added comprehensive coverage notes and comparison results for supported runtime behavior.
  • Tests

    • Updated parity baselines and moved perf_hooks checks to sequential execution for more reliable results.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR expands node:perf_hooks parity coverage to 148 fixtures, adds deterministic tests for timing, histograms, observers, resource timing, shapes, and timerify, documents the suite scope and provenance, routes the module through the slow lane, and updates its baseline.

Changes

perf_hooks parity suite

Layer / File(s) Summary
Suite definition and execution routing
scripts/node_suite_run.py, test-parity/node-suite/perf_hooks/README.md, test-parity/node_suite_baseline.json
Documents the Node oracle, fixture boundaries, and measured results; routes perf_hooks tests sequentially and updates the baseline from 83 to 148 total fixtures.
Performance API contracts
test-parity/node-suite/perf_hooks/{aaa-time-origin,clear,constants,entries,eventlooputil,global,imports,mark,measure,node-timing,now,to-json}/*
Adds and revises tests for timing progression, imports, marks, measures, entries, node timing, constants, validation, identity, descriptors, ordering, and cloning.
Histogram and event-loop monitoring
test-parity/node-suite/perf_hooks/histogram/*
Covers histogram creation, validation, recording, reset, aggregation, percentiles, JSON output, empty state, and monitor lifecycle/options.
Performance observer semantics
test-parity/node-suite/perf_hooks/observer/*
Covers buffered delivery, queue draining, entry-list behavior, observer replacement and re-observation, supported types, mode validation, and cleanup.
Resource timing coverage
test-parity/node-suite/perf_hooks/resource-timing/*
Adds deterministic resource timing tests for synthetic fields, cache modes, transfer sizes, observer delivery, constructor behavior, JSON output, and updated timing payloads.
Shapes and timerify behavior
test-parity/node-suite/perf_hooks/{shapes,timerify}/*
Adds shape, descriptor, receiver, wrapper metadata, argument/result, constructor, invalid-input, async, histogram, and thrown-function coverage for perf_hooks and timerify.

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

🚥 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
Title check ✅ Passed The title clearly matches the main change: expanding deterministic Node perf_hooks parity coverage.
Description check ✅ Passed The description is detailed and relevant, but it does not follow the template exactly and omits the Changes and Related issue sections.
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-perf-hooks-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.

…-hooks-parity

# Conflicts:
#	test-parity/node_suite_baseline.json
@proggeramlug proggeramlug added the ready PR triaged: CodeRabbit feedback + conflicts addressed label Jul 18, 2026

@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 (2)
test-parity/node-suite/perf_hooks/constants/all-gc-values.ts (1)

3-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Standardize the string sorting approach.

The first log statement uses the default array .sort() (which orders by UTF-16 code units), while this statement uses .localeCompare(). For strict deterministic testing across platforms that might configure their default locale differently, it is safer and more consistent to use standard string comparison for both.

♻️ Proposed refactor
 console.log(
-  Object.entries(constants).sort(([a], [b]) => a.localeCompare(b)).map((
+  Object.entries(constants).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map((
     [key, value],
   ) => `${key}=${value}`).join(","),
 );
🤖 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/perf_hooks/constants/all-gc-values.ts` around lines 3
- 7, Update the Object.entries(constants) sorting in the log statement to use
standard deterministic string comparison consistent with the other log
statement, replacing locale-sensitive localeCompare behavior while preserving
the existing key ordering and output format.
test-parity/node-suite/perf_hooks/aaa-time-origin/not-lazy.ts (1)

6-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Resolve static analysis warning for self-comparison.

The static analysis tool Biome flagged a self-comparison (noSelfCompare) here. While the intention is clearly to verify the idempotency of the timeOrigin getter, assigning the property to a variable first will satisfy the linter without diminishing the test's validity.

♻️ Proposed refactor
-console.log(
-  "timeOrigin stable:",
-  performance.timeOrigin === performance.timeOrigin,
-);
+const origin = performance.timeOrigin;
+console.log(
+  "timeOrigin stable:",
+  origin === performance.timeOrigin,
+);
🤖 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/perf_hooks/aaa-time-origin/not-lazy.ts` around lines 6
- 9, Update the timeOrigin stability check in not-lazy.ts by first assigning
performance.timeOrigin to a local variable, then comparing that captured value
with a subsequent performance.timeOrigin read. Preserve the existing console.log
output and idempotency assertion while avoiding the direct self-comparison
flagged by Biome.

Source: Linters/SAST tools

🤖 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/perf_hooks/aaa-time-origin/not-lazy.ts`:
- Around line 6-9: Update the timeOrigin stability check in not-lazy.ts by first
assigning performance.timeOrigin to a local variable, then comparing that
captured value with a subsequent performance.timeOrigin read. Preserve the
existing console.log output and idempotency assertion while avoiding the direct
self-comparison flagged by Biome.

In `@test-parity/node-suite/perf_hooks/constants/all-gc-values.ts`:
- Around line 3-7: Update the Object.entries(constants) sorting in the log
statement to use standard deterministic string comparison consistent with the
other log statement, replacing locale-sensitive localeCompare behavior while
preserving the existing key ordering and output format.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ace59b3-1284-492b-b328-be0a41aca640

📥 Commits

Reviewing files that changed from the base of the PR and between f073bbf and 68a8833.

📒 Files selected for processing (81)
  • scripts/node_suite_run.py
  • test-parity/node-suite/perf_hooks/README.md
  • test-parity/node-suite/perf_hooks/aaa-time-origin/not-lazy.ts
  • test-parity/node-suite/perf_hooks/clear/measure-symbol-throws.ts
  • test-parity/node-suite/perf_hooks/clear/repeated-name.ts
  • test-parity/node-suite/perf_hooks/constants/all-gc-values.ts
  • test-parity/node-suite/perf_hooks/entries/argument-validation.ts
  • test-parity/node-suite/perf_hooks/entries/snapshot-identity.ts
  • test-parity/node-suite/perf_hooks/entries/timeline-sorting.ts
  • test-parity/node-suite/perf_hooks/eventlooputil/two-arg-synthetic.ts
  • test-parity/node-suite/perf_hooks/global/illegal-constructors.ts
  • test-parity/node-suite/perf_hooks/histogram/add-isolation.ts
  • test-parity/node-suite/perf_hooks/histogram/add-validation.ts
  • test-parity/node-suite/perf_hooks/histogram/empty-state.ts
  • test-parity/node-suite/perf_hooks/histogram/illegal-constructor.ts
  • test-parity/node-suite/perf_hooks/histogram/monitor-disabled-reset.ts
  • test-parity/node-suite/perf_hooks/histogram/monitor-distinct-handles.ts
  • test-parity/node-suite/perf_hooks/histogram/monitor-lifecycle.ts
  • test-parity/node-suite/perf_hooks/histogram/monitor-options-validation.ts
  • test-parity/node-suite/perf_hooks/histogram/options-validation.ts
  • test-parity/node-suite/perf_hooks/histogram/percentile-validation.ts
  • test-parity/node-suite/perf_hooks/histogram/percentiles-maps.ts
  • test-parity/node-suite/perf_hooks/histogram/percentiles.ts
  • test-parity/node-suite/perf_hooks/histogram/record-delta.ts
  • test-parity/node-suite/perf_hooks/histogram/record-number-bigint.ts
  • test-parity/node-suite/perf_hooks/histogram/record-validation.ts
  • test-parity/node-suite/perf_hooks/histogram/reset.ts
  • test-parity/node-suite/perf_hooks/histogram/to-json.ts
  • test-parity/node-suite/perf_hooks/imports/function-aliases.ts
  • test-parity/node-suite/perf_hooks/imports/namespace-keys.ts
  • test-parity/node-suite/perf_hooks/mark/detail-circular.ts
  • test-parity/node-suite/perf_hooks/mark/direct-constructor.ts
  • test-parity/node-suite/perf_hooks/mark/repeated-name-latest.ts
  • test-parity/node-suite/perf_hooks/mark/reserved-node-milestone.ts
  • test-parity/node-suite/perf_hooks/measure/detail-clone-failures.ts
  • test-parity/node-suite/perf_hooks/node-timing/shape-invariants.ts
  • test-parity/node-suite/perf_hooks/node-timing/to-json.ts
  • test-parity/node-suite/perf_hooks/now/monotonic.ts
  • test-parity/node-suite/perf_hooks/now/sub-ms-precision.ts
  • test-parity/node-suite/perf_hooks/observer/buffered-false-excludes-prior.ts
  • test-parity/node-suite/perf_hooks/observer/buffered.ts
  • test-parity/node-suite/perf_hooks/observer/callback-this.ts
  • test-parity/node-suite/perf_hooks/observer/disconnect-clears-queue.ts
  • test-parity/node-suite/perf_hooks/observer/duplicate-entry-types.ts
  • test-parity/node-suite/perf_hooks/observer/entry-list-snapshot.ts
  • test-parity/node-suite/perf_hooks/observer/entry-list-validation.ts
  • test-parity/node-suite/perf_hooks/observer/mode-switch-validation.ts
  • test-parity/node-suite/perf_hooks/observer/multiple-type-replaces.ts
  • test-parity/node-suite/perf_hooks/observer/reobserve-after-disconnect.ts
  • test-parity/node-suite/perf_hooks/observer/replacement-retains-queued.ts
  • test-parity/node-suite/perf_hooks/observer/single-type-accumulates.ts
  • test-parity/node-suite/perf_hooks/observer/supported-entry-types-exact.ts
  • test-parity/node-suite/perf_hooks/observer/take-records-suppresses-callback.ts
  • test-parity/node-suite/perf_hooks/resource-timing/cache-mode-validation.ts
  • test-parity/node-suite/perf_hooks/resource-timing/cache-transfer-size.ts
  • test-parity/node-suite/perf_hooks/resource-timing/controlled-fields.ts
  • test-parity/node-suite/perf_hooks/resource-timing/illegal-constructor-tag.ts
  • test-parity/node-suite/perf_hooks/resource-timing/mark-resource-entry.ts
  • test-parity/node-suite/perf_hooks/resource-timing/mark-resource-timing.ts
  • test-parity/node-suite/perf_hooks/resource-timing/observer-delivery.ts
  • test-parity/node-suite/perf_hooks/resource-timing/to-json-controlled.ts
  • test-parity/node-suite/perf_hooks/shapes/prototype-tags.ts
  • test-parity/node-suite/perf_hooks/shapes/public-descriptors.ts
  • test-parity/node-suite/perf_hooks/shapes/receiver-branding.ts
  • test-parity/node-suite/perf_hooks/timerify/async-fulfill.ts
  • test-parity/node-suite/perf_hooks/timerify/async-reject.ts
  • test-parity/node-suite/perf_hooks/timerify/constructor.ts
  • test-parity/node-suite/perf_hooks/timerify/entry-arguments.ts
  • test-parity/node-suite/perf_hooks/timerify/function-entry.ts
  • test-parity/node-suite/perf_hooks/timerify/histogram-async.ts
  • test-parity/node-suite/perf_hooks/timerify/histogram-sync.ts
  • test-parity/node-suite/perf_hooks/timerify/invalid-function.ts
  • test-parity/node-suite/perf_hooks/timerify/invalid-histogram.ts
  • test-parity/node-suite/perf_hooks/timerify/multiple-wrapping.ts
  • test-parity/node-suite/perf_hooks/timerify/name-length-descriptors.ts
  • test-parity/node-suite/perf_hooks/timerify/return-object-identity.ts
  • test-parity/node-suite/perf_hooks/timerify/sync-throw-no-entry.ts
  • test-parity/node-suite/perf_hooks/timerify/this-arguments-result.ts
  • test-parity/node-suite/perf_hooks/timerify/timerify.ts
  • test-parity/node-suite/perf_hooks/to-json/fresh-snapshots.ts
  • test-parity/node_suite_baseline.json
💤 Files with no reviewable changes (3)
  • test-parity/node-suite/perf_hooks/timerify/timerify.ts
  • test-parity/node-suite/perf_hooks/now/monotonic.ts
  • test-parity/node-suite/perf_hooks/resource-timing/mark-resource-timing.ts

@proggeramlug
proggeramlug merged commit 96fd7fa into main Jul 20, 2026
27 checks passed
@proggeramlug
proggeramlug deleted the test/expand-node-perf-hooks-parity branch July 20, 2026 22:54
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