Skip to content

feat: add column field to Line message#80

Merged
szegedi merged 1 commit into
mainfrom
szegedi/scp-1293-line-column
Jul 22, 2026
Merged

feat: add column field to Line message#80
szegedi merged 1 commit into
mainfrom
szegedi/scp-1293-line-column

Conversation

@szegedi

@szegedi szegedi commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What

Adds the optional column field (field 3) to the pprof Line message: LineInput type, constructor, length, encode (varint, tag 0x18), and decode — mirroring the existing line (field 2) handling.

The pprof spec Line message carries column as field 3, and current google/pprof tooling reads and prints it (go tool pprof renders file:line:column). This library did not encode or decode it, so any column set on a Line was silently dropped on the wire.

The reason we don't have it here is that it's a fairly recent addition in google/pprof#818 and was only merged into the spec in January 2024.

Changes

  • src/index.tscolumn on the Line message (type, ctor, length, encode, decode).
  • testing/proto/profile.proto — add int64 column = 3; to the reference Line so the protobuf.js interop test round-trips the field; regenerated profile.js / profile.d.ts were hand-edited to add only the column field in the existing codegen style (avoiding the unrelated churn a full npm run proto produces with the current protobuf.js version).
  • src/index.test.ts — extend the Line encode/decode/construct case with a column value.

Testing

npm test76/76 pass, including the protobuf.js interop round-trip with the new field.

The pprof spec's Line message carries an optional column (field 3) that
current google/pprof tooling reads and prints (file:line:column), but this
library neither encoded nor decoded it. Add `column` to the Line message —
LineInput type, constructor, length, encode (field 3, varint), and decode —
mirroring the existing `line` field handling.

Motivation: Node.js profiles of bundled/minified server code (e.g. Next.js
server chunks) place every function on generated line 1, so the column is the
only discriminator between functions. Without a column on Line, downstream
backend deobfuscation collapses every frame to column 0 and cannot resolve
them.

Also add `int64 column = 3` to the reference testing proto so the protobuf.js
interop test round-trips the new field, and extend the Line encode/decode test
case with a column value.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@szegedi
szegedi merged commit 03208b8 into main Jul 22, 2026
13 checks passed
@szegedi
szegedi deleted the szegedi/scp-1293-line-column branch July 22, 2026 08:07
This was referenced Jul 24, 2026
szegedi added a commit that referenced this pull request Jul 24, 2026
The pprof spec's Line message carries an optional column (field 3) that
current google/pprof tooling reads and prints (file:line:column), but this
library neither encoded nor decoded it. Add `column` to the Line message —
LineInput type, constructor, length, encode (field 3, varint), and decode —
mirroring the existing `line` field handling.

Motivation: Node.js profiles of bundled/minified server code (e.g. Next.js
server chunks) place every function on generated line 1, so the column is the
only discriminator between functions. Without a column on Line, downstream
backend deobfuscation collapses every frame to column 0 and cannot resolve
them.

Also add `int64 column = 3` to the reference testing proto so the protobuf.js
interop test round-trips the new field, and extend the Line encode/decode test
case with a column value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants