Allow storing util.getCallSites without capturing a stack

Aperta
#2,840 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@jlucaso1 ci sta già lavorando.

Dal 1/11/2026.

  • #2842 di @jlucaso1 — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, nodejs, typescript
Ambito
compilers

Direzione di ricerca

The payload points to lower-inspect.ts, where the direct JavaScript no-argument lowering of the call-site helper emits placeholder frames, and to the Node util.getCallSites export that Pino reads at startup in lib/caller.js. Start by reproducing the SC2020 failure with the snippet from the issue, which only reads the export and should not capture a stack. Done means the export is a callable value with Node's name and length, and invoking it raises an explicit refusal instead of returning invented frames. Full stack capture is out of scope, so confirm with maintainers before extending it.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
6.4k
Fork
204
Merge medio
7h 37m
PR unite (30g)
878

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel-labs/scriptc

Tutte le issue di vercel-labs/scriptc

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.