#2840

Allow storing util.getCallSites without capturing a stack

Openjlucaso1opened 11d ago

The unchanged Baileyrs example from oxidezap/baileyrs#176 builds with #2149 plus #2839, but --offline-smoke exits at startup with SC2020 in pino/lib/caller.js:7.

const util = require('node:util')
const capture = util.getCallSites ?? util.getCallSite
console.log(typeof capture)

Node prints function. Reading the export does not capture a stack. Pino imports this helper at startup and invokes it only when transport configuration needs caller resolution. An ordinary logger should not fail because a dormant function is imported.

Proposed bounded fix: materialize a stable callable value with Node's name and length, and defer an explicit SC2020 refusal until invocation. This does not implement stack capture, disable logging, or use Node islands. Capture must not silently return invented or empty frames.

Full capture is separate work. The existing direct JavaScript no-argument lowering in lower-inspect.ts emits three placeholder frames. Native source frames store function names and files, but not the current call's line and column. Correct capture needs actual caller locations, default/1–200 frame limits, source-map options, and contracts for optimized/inlined functions, fibers, workers, and unsupported targets. Instrumentation should remain gated to programs that observe stacks; a function import alone should not add per-call stack tracking.

References: Node v24.16 implementation, Pino caller helper, integration evidence.

Issue search for getCallSites returned no matches at triage.

Activity

0

No activity yet.