Skip to content

console.trace / Error.stack frame format diverges from Node (categorical gap) #1278

Description

@proggeramlug

Summary

Stack trace output from `console.trace`, uncaught errors, and `new Error().stack` uses a different frame format than Node and is missing or differently-formatted source-position info.

Repro

```ts
function inner() { console.trace("here"); }
function outer() { inner(); }
outer();
```

Observed (v0.5.1019)

Perry-style frame lines (typically `` without `file://` URLs, line:col missing or off, sometimes mangled symbol names from the lowered IR).

Expected (`node --experimental-strip-types`)

```
Trace: here
at inner (file:///…/test.ts:1:21)
at outer (file:///…/test.ts:2:21)
at file:///…/test.ts:3:1
…node internals…
```

Why this is categorical

Per CLAUDE.md "Known categorical gaps" list, Perry's stack format is a known limitation. Producing parity requires retaining source-position info through the lowering pipeline (parse → HIR → transform → codegen) and reconstructing a JS-shaped frame from native frame info:

  1. A source-map / position table preserved per HIR node and rewritten through transform passes that synthesize nodes (closure conversion, async lowering).
  2. A frame walker that maps native return addresses back to TS source locations.
  3. A formatter that emits `at (file://::)` shaped lines for non-native frames.

Disposition

This is the one part of the old #1276 bundle that is genuinely categorical rather than a localized bug. Suggested label: a new `gap-categorical` label to mirror the `known_failures.json` category, alongside the existing parity gap probes for lookbehind regex and lone-surrogate handling.

Surfaced by

CI parity gate on tag `v0.5.1019` (run 26236443275), via `test_gap_console_methods.ts`. Split from old #1276 which bundled this with two unrelated console bugs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regressionparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions