Skip to content

fix(runtime): restore Node-API host build after Buffer refactor - #9282

Merged
proggeramlug merged 2 commits into
PerryTS:mainfrom
proggeramlug:fix/9266-node-api-host
Aug 31, 2026
Merged

fix(runtime): restore Node-API host build after Buffer refactor#9282
proggeramlug merged 2 commits into
PerryTS:mainfrom
proggeramlug:fix/9266-node-api-host

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Restore the feature-gated Node-API host build after the Buffer branding refactor so allowlisted native addons link the complete host ABI and load their authenticated sidecars.

Changes

  • Qualify the shared is_node_buffer helper from crate::buffer in napi_get_buffer_info.
  • Preserve the checked-in 145-symbol Node-API inventory unchanged.

Related issue

Fixes #9266

Test plan

  • cargo build --release -p perry-runtime-static -p perry-stdlib-static --no-default-features --features perry-runtime/full,perry-stdlib/async-runtime,perry-runtime/node-api-host,perry-runtime/global-math,perry-runtime/global-webcrypto,perry-runtime/alloc-mimalloc,perry-runtime/keepalive-anchors
  • RUST_TEST_THREADS=1 cargo test -p perry-runtime --features node-api-host node_api_host:: (17 passed)
  • RUST_TEST_THREADS=1 cargo test -p perry --test node_api_host_e2e real_node_api_addon_resolves_from_host_and_authenticates_sidecar -- --exact --nocapture
  • RUST_TEST_THREADS=1 cargo test -p perry --test node_api_host_e2e published_napi_rs_addon_runs_sync_and_async_work -- --exact --nocapture
  • Independent ELF inspection: all 145 inventory symbols are present in the host dynamic symbol table.
  • cargo fmt --all -- --check

Checklist

  • I have NOT bumped the workspace version or edited CLAUDE.md / CHANGELOG.md (maintainer handles these at merge)
  • My commits follow the loose feat: / fix: / docs: / chore: prefix convention used in the log
  • I've read CONTRIBUTING.md and agree to the Code of Conduct

Summary by CodeRabbit

  • Bug Fixes
    • Fixed feature-gated Node-API host builds so allowlisted native add-ons load with the complete host interface and authenticated sidecars.
    • Corrected Buffer ownership validation when retrieving Node-API buffer information.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 28357a6f-d71d-4a49-8e3c-9bfb84c41a3e

📥 Commits

Reviewing files that changed from the base of the PR and between 6c880be and f713bb2.

📒 Files selected for processing (2)
  • changelog.d/9282-node-api-host-buffer-brand.md
  • crates/perry-runtime/src/node_api_host/buffers.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The change qualifies the Buffer ownership predicate in napi_get_buffer_info and documents the feature-gated Node-API host build correction for addon ABI exports and authenticated sidecars.

Changes

Buffer validation

Layer / File(s) Summary
Qualify buffer ownership predicate
crates/perry-runtime/src/node_api_host/buffers.rs, changelog.d/9282-node-api-host-buffer-brand.md
napi_get_buffer_info uses crate::buffer::is_node_buffer. The changelog records the 145-symbol host ABI and authenticated sidecar fix.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to f713b

This restores the feature-gated Node-API host build without changing the checked-in ABI inventory; native addons can link and authenticate as intended. No actionable merge-blocking risk remains beyond normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description includes the required Summary, Changes, Related issue, Test plan, and Checklist sections. It provides concrete commands and verification results.
Linked Issues check ✅ Passed The PR addresses issue #9266 by restoring the qualified Buffer helper, preserving the 145-symbol inventory, and verifying host exports, addon authentication, sidecar loading, and both affected end-to-…
Out of Scope Changes check ✅ Passed The changes are limited to the Node-API host fix and its changelog entry. No unrelated code changes are identified.
Title check ✅ Passed The title clearly and concisely describes the primary change: restoring the Node-API host build after the Buffer refactor.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 …
Full details: Linked Issues check

Explanation

The PR addresses issue #9266 by restoring the qualified Buffer helper, preserving the 145-symbol inventory, and verifying host exports, addon authentication, sidecar loading, and both affected end-to-end tests.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Merged, and thank you — this is fallout from PRs I merged (#9205 and #9213, the Buffer branding split), so the break is on me.

Reproduced both directions rather than taking the description:

# origin/main
cargo check -p perry-runtime --no-default-features \
  --features perry-runtime/full,perry-runtime/node-api-host
error[E0425]: cannot find function `is_node_buffer` in this scope
  --> crates/perry-runtime/src/node_api_host/buffers.rs:148:22

# with this PR
0 errors

The one-line qualification is right and matches what line 136 in the same file already does, so the file is now internally consistent rather than half-migrated.

Why I missed it, since that is the useful part. is_node_buffer moved during the Buffer split, and napi_get_buffer_info sits behind the node-api-host feature — which is not in the default set. Every check I ran on those PRs (cargo build -p perry-runtime-static, cargo test --release -p perry-runtime, cargo check --workspace --all-targets, 60 lint gates) compiles the default feature set only, so that function was never compiled at all. --all-targets widens targets, not features, and I had been reading it as broader than it is.

That is the third distinct hole I have found in my own validation today, and they are all the same shape — a green that covers one job, one profile, or one feature set, read as if it covered CI:

A --features node-api-host check belongs in whatever local pre-merge routine exists, because a symbol move is exactly the change that breaks a feature-gated caller silently, and the 145-symbol inventory means the failure mode is "addons quietly fall back to a runtime without Node-API support" rather than a loud error.

@proggeramlug
proggeramlug merged commit 6642990 into PerryTS:main Aug 31, 2026
20 checks passed
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.

release blocker: Node-API host omits declared exports; napi-rs addon manifest rejected (shard 8)

1 participant