feat!: carve the wasm pipeline into @datadog/libdatadog-wasm-pipeline - #191
Open
bengl wants to merge 1 commit into
Open
feat!: carve the wasm pipeline into @datadog/libdatadog-wasm-pipeline#191bengl wants to merge 1 commit into
bengl wants to merge 1 commit into
Conversation
The pipeline wasm crate now ships as @datadog/libdatadog-wasm-pipeline so that consumers of the trace pipeline do not also install the per-platform native binaries. Everything else is unchanged: @DataDog/libdatadog keeps the native Node-API bindings alongside the library_config and datadog-js-zstd wasm modules, and the loader at the repository root still resolves both. The packages are versioned in lockstep and neither depends on the other. scripts/wasm-crates.js owns the crate to package mapping and derives the wasm-pack output directory, the CI artifact name and the packaging assertions from it. The artifact name matters: action-prebuildify merges every prebuilds-* artifact into the native package's prebuilds artifact, which is how the crates that stay get published and would silently republish a carved-out one, so carved-out crates upload outside that pattern. Because both of those failure modes are silent, check-packages.js asserts the packed contents of every package on each PR and before both publishes, and check-versions.js enforces the lockstep version. build-wasm.js also deletes the .gitignore wasm-pack writes into its output directory; npm honours nested ignore files, so it would otherwise drop the whole module from a locally packed tarball. The test suites are split structurally: test/wasm/<crate>/ is the wasm suite and everything else is native, driven by scripts/test.sh <native|wasm> [crate] in place of test-wasm.js.
bengl
force-pushed
the
bengl/split-wasm-package
branch
from
July 31, 2026 21:13
e456e40 to
9862429
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.
What
Carves the
pipelinewasm crate out into a new package and leaves everything else where it is.@datadog/libdatadoglibrary_configanddatadog-js-zstdwasm modules@datadog/libdatadog-wasm-pipelinepackages/wasm-pipeline/prebuilds/pipeline/Versioned in lockstep, neither depends on the other, both expose the same loader API, so migrating a consumer is a package-name swap in the
require.Only the one crate we actually need separately moves.
load.jsat the root is untouched — it still resolves native binaries and still falls back to the wasm modules that stay in that package.Packed contents, verified locally with
npm pack --dry-run:How the split is enforced
action-prebuildify's final job merges every artifact matchingprebuilds-*into the singleprebuildsartifact that@datadog/libdatadogpublishes. That merge is load-bearing for the crates that stay — it is howlibrary_configanddatadog-js-zstdreach npm today — and fatal for a carved-out one.So
scripts/wasm-crates.jsowns the crate → package mapping and derives everything from it: the wasm-pack output directory, the CI artifact name (prebuilds-wasm-<crate>for crates that stay,wasm-<crate>for carved-out ones, deliberately outside the merge pattern), and the assertions incheck-packages.js. The composite action queries it rather than repeating any of it.scripts/check-packages.jsthen runsnpm pack --dry-runover both packages and asserts every crate is published by exactly the package that owns it, that only@datadog/libdatadogships.nodebinaries, and that nothing leaks either way. It gates every PR (package-contents) and both publishes, because each failure mode here is silent.Other changes
scripts/build-wasm.jsroutes output through the mapping and deletes the.gitignorethatwasm-packwrites into its output directory. npm honours nested ignore files, so that file silently drops the whole module from a locally packed tarball — this is a pre-existing bug forlibrary_config/datadog-js-zstdtoo, which CI only escapes becauseupload-artifactexcludes hidden files by default. It also now builds every crate when given no argument, so the crate list lives in one place instead of being spelled out inpackage.json.test/wasm/<crate>/is the wasm suite, everything else is native.test/pipeline.js→test/wasm/pipeline/index.jsandtest/http_transport.js→test/wasm/pipeline/http_transport.js(pure renames).scripts/test.sh <native|wasm> [crate]replacestest-wasm.js;yarn testis native-only, which is what the prebuildify matrix runs. Thelibrary_configanddatadog-js-zstdsuites are untouched and still load through the root loader.maybeLoad/skipguard at the top of the pipeline suite is gone — it only existed because the pipeline wasm was absent from the native matrix.scripts/check-versions.jsenforces the lockstep version, in the lint job and as a release gate.publish-wasm-pipelineruns afterpublish, so a failed native build can never leave half of a lockstep pair on npm.Verification
Everything below was run locally against real
wasm-packoutput for all three crates.node scripts/build-wasm.js(no args)prebuilds/{library_config,datadog-js-zstd}+packages/wasm-pipeline/prebuilds/pipeline, no.gitignorein any of thembash scripts/test.sh wasmhttp_transport.js18/18,pipeline/index.js51/51check-packages.js, expected layout.node/[library_config, datadog-js-zstd]; pipeline = 11 files / 0 native /[pipeline]prebuilds/.nodeplaced in the pipeline packagelibrary_configdropped from the native packagetest.sh nativeselectiontest/process-discovery.js+test/crashtracker/index.jsonlytest.sh wasm [crate]/ bad crate / bad modewasm-crates.jsmappingpipeline→packages/wasm-pipeline/prebuilds/pipeline+ artifactwasm-pipeline; others →prebuilds/<crate>+prebuilds-wasm-<crate>eslint .,check-versions.js, workflow YAMLNot run locally: the native Rust build and suite. This checkout's prebuilt
.nodefiles are rejected by macOS code-signing policy, and nothing here touches Rust,Cargo.tomlorcopy-artifacts.js; native runner selection was verified with a stubbednode.Before merging
@datadog/libdatadog-wasm-pipelinemust exist on npm before trusted publishing can be configured for it — npm requires the package to exist before OIDC can be enabled (npm/cli#8544). First publish needs a granular token; after thatpublish-wasm-pipelineworks unattended.@datadog/libdatadog-wasm-pipelineand repoint only thepipelinerequire.library_configanddatadog-js-zstdkeep working unchanged. Both packages are exact-versioned deps, so a single PR is an atomic cutover.