Repository navigation
Conversation
Function IDs no longer contain line numbers. The name part is the function's qualified name: its own name, prefixed by the nearest named function or class around it (`Cart.total`, `Cart.size:get`, `doubleAll/<anonymous>`, `make/Box.open`). Functions whose qualified name is already used in the module get the next free `#<n>` suffix, in traversal order and before any skip check, so `namedOnly`, `functionTypes` and skip comments don't shift other IDs. The path part is now relative to the git repository root (or the build root outside one), without query strings or Yarn PnP virtual folders. Symlinks are only resolved for files outside the root. The path helpers move from the symbol table to `src/paths.ts`, and the symbol table now takes each function's source file straight from its ID. Environment: Datadog workspace Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 8454844 | Docs | View more details | Give us feedback! |
Master's corpus test now passes the transform's repositoryRoot option.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DEBUG-6332, stacked on #582: function IDs no longer contain line numbers, every function of a module gets a different ID, and the path is relative to the repository root.
addinapp/src/math.js, build rootappsrc/math.js;addapp/src/math.js;adddoubleinsideaddsrc/math.js;doubleapp/src/math.js;add/doubleclass Cart { total() {} }…;total…;Cart.totalget size()andset size(v)inCart…;size, twice…;Cart.size:get,…;Cart.size:setdoubleAll…;<anonymous>@12:20:0,…;<anonymous>@13:20:0…;doubleAll/<anonymous>,…;doubleAll/<anonymous>#1openinfunction make() { class Box { open() {} } }…;open…;make/Box.open../.yarn/__virtual__/peer-virtual-…/1/packages/peer/index.js;peerHellopackages/peer/index.js;peerHellosrc/Cart.vue?vue&type=script;totalapp/src/Cart.vue;totalThe path helpers move from
src/symbol-table/paths.tstosrc/paths.ts. The symbol table now trusts the ID:sourceFileis the ID's path, and paths that are absolute or start with../are still left out.parseFunctionIdreturns the last/segment without its#<n>suffix as the display name, such asCart.size:get,doubleor<anonymous>.Left out on purpose:
#<n>shifts when a function with the same qualified name is added before it in the same named scope. That's treated like a move, and a test documents it.Known limitations:
/, such as{ '/users': () => {} }, gets only the part after its last/as display name. The ID stays unique.The
transform/index.tsdiff is mostly re-indentation, because theFunctionvisitor became{ enter, exit }. Hide whitespace to review it.Evidence
Before: a getter and a setter shared an ID, and IDs changed whenever a line was added above.
After:
functionId.test.tscovers qualified names, accessors, class fields and expressions, transparent anonymous containers, duplicates including a key literally named'f#1', a module of awkward shapes where every function gets a different ID, a before/after table of edits that keep IDs, and the documented suffix shift.transform/index.test.ts: skip comments,functionTypesandnamedOnlydon't change the IDs of other functions.symbolTable.integration.test.ts, on esbuild, Rollup, Rspack, Vite and webpack: IDs are relative to the repository root, without__virtual__or?, the table'ssourceFileis the ID's path, and eachfunction_idhas a single location.Size, on the
@datadog/browser-core,browser-rum-coreandbrowser-rum6.26.0 ESM files (279 files, 1,643 instrumented functions), transformed by both versions with the same path part:Gzipped output gets smaller because repeated qualified prefixes compress better than unique line and column numbers. When the build root is a subdirectory of the repository, each ID also grows by that subdirectory, such as
app/, while workspace packages outside the build root lose their../.Live Debugger suite: 516/516. Live Debugger typecheck,
yarn lintandyarn cli integritypass.Merge Danger
Door: two-way until released
Once released, probes are created against these IDs, so changing the format again would orphan them.
Blast Radius: every Live Debugger build
where.functionIdinstead of deriving anything from the ID.TransformOptions.buildRootis renamed torepositoryRoot.transform/corpus.test.tson master still passesbuildRoot, so it needs the rename when master is merged into this stack..gitlookup per build, and onerealpathper module outside the repository root.🤖 Generated with Claude Code