Default args and locals params in debugger snapshot hooks#4609
Draft
watson wants to merge 1 commit into
Draft
Conversation
This was referenced May 12, 2026
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
|
✨ Fix all issues with BitsAI or with Cursor
|
7c29372 to
331c32c
Compare
0bcb507 to
1eeda79
Compare
331c32c to
239ef70
Compare
1eeda79 to
13d0744
Compare
Allow the build plugin to omit empty args/locals arguments from
$dd_entry, $dd_return, and $dd_throw calls by defaulting the
parameters to {} in onEntry, onReturn, and onThrow.
13d0744 to
0a9836c
Compare
239ef70 to
9b44f2f
Compare
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.

Motivation
The Live Debugger build plugin (in
DataDog/build-plugins) generates instrumented code that wraps every monitored function with calls to four global hooks:$dd_probes,$dd_entry,$dd_return, and$dd_throw. The entry/return/throw hooks currently require the build plugin to always pass anargshelper, and$dd_returnalso requires alocalshelper, even when:args), orlocalswould always be empty).Today the plugin works around this by emitting
() => ({})helpers in those cases, which adds dead code to the hot path and inflates the instrumented bundle. Making these parameters optional on the runtime side unlocks a follow-up build-plugin change that simply omits the argument at the call site.Changes
packages/debugger/src/domain/api.ts:onEntry(probes, self, args)→onEntry(probes, self, args = {})onReturn(probes, value, self, args, locals)→onReturn(probes, value, self, args = {}, locals = {})onThrow(probes, error, self, args)→onThrow(probes, error, self, args = {})No behavioral change for any existing call site: callers that pass a
Record<string, any>(including the build plugin's current$dd_e()/$dd_l()helpers) behave identically. The defaults only kick in when an argument is omitted — which is what the build plugin will start doing for parameter-less functions and probes without local capture in a follow-up.Notes:
argsis spread into the context used for condition / message evaluation and into the captured snapshot (captureFields(args, …)). Spreading{}is a no-op, so behavior is preserved.localsinonReturnis treated the same way (...locals+captureFields(locals, …)).Test instructions
End-to-end behavior with the build plugin will be exercised once the corresponding
build-pluginschange lands (omitting the trailing args/locals helpers in generated code).Checklist
api.spec.tssuite; the change is a type-level relaxation (defaulting optional parameters to{}). Happy to add an explicit "called with no args/locals" case if reviewers prefer.build-pluginsPR that exercises the new call shape.