Skip to content

Fix v3 prebuild naming for Rust builds#100

Merged
szegedi merged 2 commits intomainfrom
fix/rust-prebuild-naming
Mar 23, 2026
Merged

Fix v3 prebuild naming for Rust builds#100
szegedi merged 2 commits intomainfrom
fix/rust-prebuild-naming

Conversation

@szegedi
Copy link
Copy Markdown
Contributor

@szegedi szegedi commented Mar 23, 2026

Summary

Changes

  • prebuildFilename() now uses baseName in the v3 path (${baseName}-napi.node / ${baseName}-${abi}.node)
  • Non-Rust call site passes 'node' as baseName for v3 (preserving backward compat) and TARGET_NAME for v4

Test plan

  • Verify existing non-Rust builds still produce node-{abi}.node filenames (v3 default)
  • Verify Rust builds produce {name}-{abi}.node filenames (v3), matching pre-PR#90 behavior
  • Verify v4 naming is unaffected for both Rust and non-Rust builds
  • After merge, update libdatadog-nodejs to unpin from d4e8924 and verify CI passes

🤖 Generated with Claude Code

Jira: PROF-14113

PR #90 refactored prebuild output naming into a shared
prebuildFilename() function, but the v3 code path hardcoded the
"node-{abi}.node" prefix, ignoring the baseName parameter. This broke
Rust builds which previously preserved the original binary name from
build/Release/ (e.g. "process-discovery-napi.node" became
"node-napi.node"), causing consumers like libdatadog-nodejs to fail
with "Could not find a {name} binary for {platform}".

The fix makes prebuildFilename() use baseName in the v3 path, and
passes 'node' from the non-Rust call site to preserve backward
compatibility there.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@szegedi szegedi requested a review from a team as a code owner March 23, 2026 09:35
Move prebuildDir and prebuildFilename into prebuild/naming.js as pure
functions (all dependencies passed as parameters) so they can be tested
in isolation. Add test/naming.js covering v3 and v4 naming for both
Rust (dynamic baseName) and non-Rust (fixed 'node' prefix) builds.

This would have caught the regression in PR #90 where v3 Rust builds
lost the original binary name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@szegedi szegedi requested a review from rochdev March 23, 2026 09:59
@szegedi szegedi merged commit dfb3666 into main Mar 23, 2026
185 checks passed
@szegedi szegedi deleted the fix/rust-prebuild-naming branch March 23, 2026 13:55
tlhunter added a commit that referenced this pull request Mar 23, 2026
Update all 20 internal composite action references from
679d80c (pre-PR#100) to 287165b (current main HEAD).

The previous pin predated PR #100 ("Fix v3 prebuild naming for Rust
builds"), so the prebuild step was still using the buggy
prebuildFilename() that hardcodes `node-napi.node` for v3 builds,
ignoring the actual crate name. This caused all Rust binaries to
overwrite each other, leaving only one file in the artifact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tlhunter added a commit that referenced this pull request Mar 23, 2026
PR #101 unconditionally installs autoconf/automake/libtool in all
Alpine Docker builds. The libtool package causes SIGSEGV in Neon
Alpine tests. Pin to dfb3666 (PR #100) which includes the v3
naming fix without the autotools change.

Consumers that need autotools (e.g. libdatadog-nodejs) already
handle this via the `prebuild` input hook.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@szegedi szegedi mentioned this pull request Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants