Add wasm-symbols upload command#2398
Conversation
Uploads WebAssembly (.wasm) debug info to Datadog's srcmap intake for Error Tracking symbolication, mirroring elf-symbols' structure. Storage reuses the elf_symbol_files table server-side with symbol_source="wasm" (see dd-go PR #240850), so no new intake work was needed on this side. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 6390a8e | Docs | Datadog PR Page | Give us feedback! |
Matches the generated format lint-packages expects for single-command cli.ts files (same as dsyms, elf-symbols, etc). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
The PR adds a new wasm-symbols upload command for uploading WASM debug info. Code review identified one P1 behavioral defect: when a WASM file has an empty CODE section (payload.length = 0), the buildId is incorrectly computed from the empty buffer while hasCode is correctly set to false. This creates an inconsistency where buildId reflects no actual code yet fileHash is not computed, sending mismatched metadata to the server. The fix is minimal: add && codeSection.payload.length > 0 to the condition on line 165 of wasm.ts to match the hasCode check on line 163.
📊 Validated against 1 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit c5d7baa · What is Autotest? · Any feedback? Reach out in #autotest
| const codeSection = sections.find((section) => section.id === WasmSectionId.CODE) | ||
| metadata.hasCode = codeSection !== undefined && codeSection.payload.length > 0 | ||
|
|
||
| if (!metadata.buildId && codeSection) { |
There was a problem hiding this comment.
Empty CODE section produces mismatched buildId and fileHash
Metadata sent to server has non-empty buildId derived from empty code but empty fileHash, creating inconsistent state that could confuse symbol lookup or cause deduplication issues
Assertion details
- Input: WASM file with CODE section containing zero-byte payload and debug_info custom section
- Expected:
buildId should not be computed from empty code section; both buildId and fileHash should be empty - Actual:
buildId is computed from empty buffer (sha256('')) but fileHash remains empty due to hasCode=false check
Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · Any feedback? Reach out in #autotest
| if (!metadata.buildId && codeSection) { | |
| if (!metadata.buildId && codeSection && codeSection.payload.length > 0) { |
wasm-symbols upload requires a positional symbolsLocations argument, same as elf-symbols upload, so the shared --fips test suite needs an entry to actually invoke the command. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
cswatt
left a comment
There was a problem hiding this comment.
A really small suggestion, but looks good otherwise! approving for docs
| @@ -0,0 +1,55 @@ | |||
| ## Overview | |||
|
|
|||
| Upload WebAssembly (`.wasm`) debug info files to Datadog to symbolicate WASM stack traces reported by the Datadog Browser SDK. | |||
There was a problem hiding this comment.
| Upload WebAssembly (`.wasm`) debug info files to Datadog to symbolicate WASM stack traces reported by the Datadog Browser SDK. | |
| Upload WebAssembly debug info files (`.wasm`) to Datadog to symbolicate WASM stack traces reported by the Datadog Browser SDK. |
Summary
datadog-ci wasm-symbols uploadbeta command that uploads WebAssembly (.wasm) debug info files for Error Tracking symbolication, structured the same way as the existingelf-symbolscommand (implemented directly inpackages/base, no plugin package).build_id(from abuild_idcustom section, falling back to a SHA-256 hash of the code section per the WASM symbolication gap-analysis doc) and detect embedded (.debug_*) or external (external_debug_info) debug info./api/v2/srcmapwith file fieldwasm_symbol_file, matching the server-side design in dd-go#240850, which reuses theelf_symbol_filestable withsymbol_source="wasm"— no new intake/table work needed here.objcopydependency) since v1 accepts the artifact as-is; adds--arch(wasm32/wasm64) and--source-urlflags not present onelf-symbols.bin/lint-packages.ts'snoPluginExceptions, updates CODEOWNERS (@DataDog/rum-browser @DataDog/rum-backend, matchingsourcemaps), and documents it in the README.Test plan
yarn buildcompiles cleanlyyarn lintpasses with no errorsyarn test packages/base/src/commands/wasm-symbols— 38 tests pass (LEB128 round-tripping, section parsing, build-ID/debug-info detection, multipart payload shape, dry-run, dedup, parameter validation), using synthetically constructed WASM buffers (no binary fixtures needed)🤖 Generated with Claude Code