Skip to content

fix: scope column packing to frames with a missing source map#378

Merged
szegedi merged 3 commits into
mainfrom
szegedi/scp-1293-scope-column-packing
Jul 23, 2026
Merged

fix: scope column packing to frames with a missing source map#378
szegedi merged 3 commits into
mainfrom
szegedi/scp-1293-scope-column-packing

Conversation

@szegedi

@szegedi szegedi commented Jul 22, 2026

Copy link
Copy Markdown

What

columnNumbers: 'pack' (added in #377) packed the column into the line for every frame. This narrows it to only pack frames whose source map was declared but missing locally (loc.missingMapFile).

Why

That's exactly the set of frames that sets dd:has-missing-map-files and get sent for server-side unminification. Packing every frame instead leaked the packed line into profiles that skip server-side unminification (Node.js profiles whose maps resolved locally, or that never had missing maps) — which would force the deobfuscation backend to strip the packed value back out of every parse-time structure (stacktraces, sample values, indexed samples). That backend cleanup was ballooning (see DataDog/profiling-backend#8762) and it is simpler to solve it here.

With this scoping:

  • Packed ⟺ bound for server-side unminification → those frames get resolved to source names by the backend (or, if unresolved, behave exactly like the pre-existing Chrome non-success case).
  • Locally-resolved / no-missing-map frames keep their plain line → profiles that skip unminification never carry packed line numbers, so the backend needs no stripping.

This mirrors how the Chrome path already works (Chrome packs column << 32 | line into the internal frame at parse time and is always unminified), and it lets the backend-side stripping work (profiling-backend#8762) be dropped.

Changes

  • ts/src/profile-serializer.tsgetLine packs only when columnNumbers === 'pack' && loc.missingMapFile.
  • ts/test/test-profile-serializer.ts — updated the 'pack' tests: without a missing map, 'pack' no longer packs (time + heap); added tests that a missing-map frame is packed under 'pack' and left plain under the default 'drop'.

Testing

test-profile-serializer / test-profile-encoder / test-sourcemapper55 passing. eslint clean.

Follow-ups

  • dd-trace-js: opt into columnNumbers: 'pack' on the wall profiler.
  • With this change, profiling-backend#8762 (backend stripping) should no longer be needed — will confirm and close it out.

Jira: PROF-15467

columnNumbers: 'pack' previously packed the column into the line for every
frame. That leaked the packed value into profiles that skip server-side
unminification (e.g. Node.js profiles whose maps resolved locally, or that
never had missing maps), which in turn forced the backend to strip it back out
of every parse-time structure.

Pack only frames whose source map was declared but missing (loc.missingMapFile)
— exactly the frames that set dd:has-missing-map-files and are sent for
server-side unminification. Locally-resolved and no-map frames keep their plain
line, so profiles that skip unminification never carry packed line numbers and
the backend needs no stripping. This mirrors how the Chrome path already works.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

Overall package size

Self size: 2.45 MB
Deduped: 3.15 MB
No deduping: 3.15 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | pprof-format | 2.2.3 | 500.55 kB | 500.55 kB | | source-map | 0.8.0 | 185.66 kB | 185.66 kB | | node-gyp-build | 4.8.4 | 13.86 kB | 13.86 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-official

This comment has been minimized.

@szegedi

szegedi commented Jul 22, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@szegedi szegedi added the semver-minor Usually minor non-breaking improvements label Jul 22, 2026
@szegedi
szegedi force-pushed the szegedi/scp-1293-scope-column-packing branch from fb27430 to fae2430 Compare July 22, 2026 13:10
@szegedi
szegedi marked this pull request as ready for review July 22, 2026 13:19
@szegedi
szegedi merged commit 73d1050 into main Jul 23, 2026
181 of 186 checks passed
@szegedi
szegedi deleted the szegedi/scp-1293-scope-column-packing branch July 23, 2026 07:48
@szegedi szegedi mentioned this pull request Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minor Usually minor non-breaking improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants