Skip to content

test: update empty histogram expectations for histogram 0.12.1 - #66879

Open
fcostaoliveira wants to merge 2 commits into
nodejs:mainfrom
fcostaoliveira:test-histogram-empty-values
Open

fcostaoliveira wants to merge 2 commits into
nodejs:mainfrom
fcostaoliveira:test-histogram-empty-values

Conversation

@fcostaoliveira

Copy link
Copy Markdown
Contributor

Refs: #66818

HdrHistogram_c 0.12.1 (#178, #183, release) makes an empty histogram report min 0 (was INT64_MAX) and mean/stddev 0 (was NaN). Java, Go and Rust already did this, so it aligns the C library with them. #66818 fails four tests that pin the old values; this updates them:

  • test-perf-hooks-histogram.js, test-perf-hooks-histogram-snapshot.js, test-perf-hooks-histogram-stats.js, test-performance-eventloopdelay.js

User-visible: an empty createHistogram() or monitorEventLoopDelay() histogram now has min 0, minBigInt 0n, mean and stddev 0, and meanCI().mean 0 (lower/upper stay NaN). max, count and percentiles are unchanged. Code that checks emptiness via min or isNaN(mean) should use count === 0. The docs do not state these values.

The alternative is to special-case count == 0 in src/histogram.cc to keep the old values; I did not, to stay consistent with the other implementations. This must land with, or before, #66818.

Verification / AI disclosure: [edit to what you actually did]

AI assistance was used to prepare the change and this text. I built Node at the head of #66818 and ran the 49 perf_hooks/performance/histogram test files: 4 failed before, all pass after.

nodejs-github-bot and others added 2 commits October 18, 2026 00:54
HdrHistogram_c 0.12.1 (deps: update histogram to 0.12.1) makes an
empty histogram report 0 for hdr_min, hdr_mean and hdr_stddev, where
0.12.0 and earlier reported INT64_MAX and NaN. This brings the C
library in line with the Java, Go and Rust implementations, which
already return 0.

Update the assertions that pinned the old values for createHistogram(),
histogram.snapshot(), meanCI() and monitorEventLoopDelay() after a
reset. The old assertions fail against 0.12.1 and the new ones fail
against 0.12.0, so this has to land with the dependency update.

Signed-off-by: fcostaoliveira <filipe@redis.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added dependencies PRs that add, update, or configure Node.js dependencies. needs-ci PRs that need a full CI run. labels Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.51%. Comparing base (f88a1d2) to head (deaa9d0).
⚠️ Report is 35 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66879      +/-   ##
==========================================
+ Coverage   90.49%   90.51%   +0.01%     
==========================================
  Files         797      797              
  Lines      277780   278268     +488     
  Branches    53360    53468     +108     
==========================================
+ Hits       251388   251871     +483     
+ Misses      16791    16767      -24     
- Partials     9601     9630      +29     

see 60 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies PRs that add, update, or configure Node.js dependencies. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants