Summary
Node PerformanceObserver.prototype.observe() validates its options object: either options.entryTypes or options.type must be specified, entryTypes must be an array when present, and entryTypes cannot be combined with type. Perry currently accepts missing/non-object options and silently ignores invalid shapes.
Node 25.9.0 behavior
const { PerformanceObserver } = require("node:perf_hooks");
const obs = new PerformanceObserver(() => {});
obs.observe();
// TypeError ERR_MISSING_ARGS
obs.observe(null);
// TypeError ERR_INVALID_ARG_TYPE
obs.observe({});
// TypeError ERR_MISSING_ARGS
obs.observe({ entryTypes: "mark" });
// TypeError ERR_INVALID_ARG_TYPE: options.entryTypes must be string[]
obs.observe({ type: "mark", entryTypes: ["measure"] });
// TypeError ERR_INVALID_ARG_VALUE
obs.observe({ entryTypes: [] }); // ok
obs.observe({ entryTypes: ["bogus"] }); // ok, just observes nothing
obs.observe({ type: "bogus" }); // ok, just observes nothing
Perry source evidence
crates/perry-runtime/src/perf_hooks.rs::js_perf_observer_observe() starts with empty types and buffered = false; if opts is not an object, it simply leaves those values and marks the observer active.
- The function reads
entryTypes and only checks arr_v.is_pointer() before treating it as an ArrayHeader; it does not validate that the value is actually an array.
- The function reads
type independently and appends it to types; it does not reject the case where both entryTypes and type are present.
- No missing-argument / missing-options validation is performed before activating the observer.
Expected
PerformanceObserver.observe() should match Node's option validation while preserving the current lenient behavior for unsupported but well-typed entry names (bogus observes nothing).
Duplicate checks
PerformanceObserver observe options validation
perf_hooks observer observe entryTypes type invalid
- PR search for
PerformanceObserver observe
I found merged observer behavior PRs for buffered delivery and callback args, but no issue for observe-option validation.
Summary
Node
PerformanceObserver.prototype.observe()validates its options object: eitheroptions.entryTypesoroptions.typemust be specified,entryTypesmust be an array when present, andentryTypescannot be combined withtype. Perry currently accepts missing/non-object options and silently ignores invalid shapes.Node 25.9.0 behavior
Perry source evidence
crates/perry-runtime/src/perf_hooks.rs::js_perf_observer_observe()starts with emptytypesandbuffered = false; ifoptsis not an object, it simply leaves those values and marks the observer active.entryTypesand only checksarr_v.is_pointer()before treating it as anArrayHeader; it does not validate that the value is actually an array.typeindependently and appends it totypes; it does not reject the case where bothentryTypesandtypeare present.Expected
PerformanceObserver.observe()should match Node's option validation while preserving the current lenient behavior for unsupported but well-typed entry names (bogusobserves nothing).Duplicate checks
PerformanceObserver observe options validationperf_hooks observer observe entryTypes type invalidPerformanceObserver observeI found merged observer behavior PRs for buffered delivery and callback args, but no issue for observe-option validation.