You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
node:perf_hooks: validate performance.measure name argument #3088
performance.measure(name, ...) requires name to be a string in Node. Perry currently coerces name with the same String(value) behavior used by performance.mark(), so undefined, null, numbers, booleans, objects, arrays, and symbols can create measure entries instead of throwing.
Observed result: every non-string value throws TypeError [ERR_INVALID_ARG_TYPE] for the "name" argument. This differs from performance.mark(), which intentionally string-coerces non-symbol names.
crates/perry-runtime/src/perf_hooks.rs::js_perf_measure() also starts with let name = coerce_to_string(name_val); and has no string-type validation or symbol-specific error path.
crates/perry-runtime/src/object/native_module_dispatch.rs routes ("perf_hooks", "measure") directly to js_perf_measure(arg(0), arg(1), arg(2)).
Existing perf_hooks fixtures cover valid measure names and option endpoint validation, but not invalid name types.
Expected fix
Validate that performance.measure() receives a string name before creating an entry.
Throw TypeError [ERR_INVALID_ARG_TYPE] for missing, null, primitive non-string, object, array, and symbol names.
Preserve the existing performance.mark() name coercion behavior.
Add parity coverage for invalid measure() name values and one control case showing mark(1).name === "1" still works.
I am taking this in a focused node:perf_hooks timing and validation PR cut with #3012, #3013, #3011, #3010, and #3008. Intended scope: make performance.now() relative to a process-start timeOrigin, support two-argument eventLoopUtilization() diffs, and align the related User Timing / observer validation behavior. Non-goals: timerify() function entries and markResourceTiming() resource entries, which fit a separate observable-entry cut.
Activity
andrewtdiz commentedon May 31, 2026
I am taking this in a focused
node:perf_hookstiming and validation PR cut with #3012, #3013, #3011, #3010, and #3008. Intended scope: makeperformance.now()relative to a process-starttimeOrigin, support two-argumenteventLoopUtilization()diffs, and align the related User Timing / observer validation behavior. Non-goals:timerify()function entries andmarkResourceTiming()resource entries, which fit a separate observable-entry cut.andrewtdiz commentedon May 31, 2026
Opened PR #3508 to close this: #3508
Verification on the rebased branch:
./run_parity_tests.sh --suite node-suite --module perf_hookspassed 78/78.cargo check -p perry-runtime -p perry-codegen -p perry-hir -p perry-api-manifest -p perrypassed.cargo fmt --all -- --check,./scripts/check_file_size.sh,jq empty test-parity/known_failures.json, andgit diff HEAD~1..HEAD --checkpassed.test(parity): retire the 28 stale known_failures entries the ratchet …
test(parity): retire the 28 stale known_failures entries the ratchet …