Skip to content

Add wasm-symbols upload command#2398

Open
ImaneLargou wants to merge 3 commits into
masterfrom
wasm-symbols-upload-command
Open

Add wasm-symbols upload command#2398
ImaneLargou wants to merge 3 commits into
masterfrom
wasm-symbols-upload-command

Conversation

@ImaneLargou

Copy link
Copy Markdown
Contributor

Summary

  • Adds a new datadog-ci wasm-symbols upload beta command that uploads WebAssembly (.wasm) debug info files for Error Tracking symbolication, structured the same way as the existing elf-symbols command (implemented directly in packages/base, no plugin package).
  • Parses the WASM binary format directly (magic bytes, LEB128 section table, custom sections) to extract a build_id (from a build_id custom 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.
  • Uploads via multipart POST to /api/v2/srcmap with file field wasm_symbol_file, matching the server-side design in dd-go#240850, which reuses the elf_symbol_files table with symbol_source="wasm" — no new intake/table work needed here.
  • No strip/split pipeline (no objcopy dependency) since v1 accepts the artifact as-is; adds --arch (wasm32/wasm64) and --source-url flags not present on elf-symbols.
  • Registers the command via bin/lint-packages.ts's noPluginExceptions, updates CODEOWNERS (@DataDog/rum-browser @DataDog/rum-backend, matching sourcemaps), and documents it in the README.

Test plan

  • yarn build compiles cleanly
  • yarn lint passes with no errors
  • yarn 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)
  • Manual end-to-end verification against a real Datadog org / dd-go endpoint (server-side already merged in dd-go#240850)

🤖 Generated with Claude Code

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>
@ImaneLargou ImaneLargou requested review from a team as code owners July 6, 2026 08:54
@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Jul 6, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6390a8e | Docs | Datadog PR Page | Give us feedback!

@ImaneLargou ImaneLargou changed the title feat(wasm-symbols): add wasm-symbols upload command Add wasm-symbols upload command Jul 6, 2026
@ImaneLargou ImaneLargou added the rum Related to [dsyms, flutter-symbols, react-native, sourcemaps, unity-symbols] label Jul 6, 2026
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>

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: FAIL

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.

View proposed fix
📊 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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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

Suggested change
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 cswatt self-assigned this Jul 6, 2026

@cswatt cswatt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@cswatt cswatt removed their assignment Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rum Related to [dsyms, flutter-symbols, react-native, sourcemaps, unity-symbols]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants