Skip to content

fix(module): keep extensions out of builtin inventory - #9934

Closed
proggeramlug wants to merge 1 commit into
PerryTS:mainfrom
proggeramlug:fix/9202-module-builtin-inventory
Closed

fix(module): keep extensions out of builtin inventory#9934
proggeramlug wants to merge 1 commit into
PerryTS:mainfrom
proggeramlug:fix/9202-module-builtin-inventory

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Perry added its node:ffi extension to the shared dynamic-resolver allowlist, which also backs module.builtinModules and Module.isBuiltin(). On the pinned Node 26.5.1 oracle that extension does not exist, so Perry exposed 67 entries instead of 66 and failed node-suite/module/exports/builtin-modules.

Split Perry-only scheme modules from Node's public inventory. node:ffi remains available through static imports, createRequire, and process.getBuiltinModule, while builtinModules and isBuiltin() now report the Node-compatible surface.

Tracked by #9202.

Validation:

  • focused resolver unit suite (4/4)
  • exact module/exports/builtin-modules parity fixture (1/1)
  • complete module/exports parity group (5/5)
  • compiled node:ffi resolver probe: inventory false/false; resolver exports function/function/string
  • full perry-runtime suite (3,257 passed, 4 ignored; doc tests 8 ignored)
  • ./scripts/run_lint_gates.sh (all 64 local gates passed; 2 CI-only expressions skipped)

Summary by CodeRabbit

  • Bug Fixes

    • Fixed dynamic resolution for Perry’s node:ffi extension.
    • node:ffi remains available when explicitly prefixed, while bare ffi is not resolved.
    • Preserved Node-compatible builtin module inventory behavior: node:ffi is not included in builtin module listings or Module.isBuiltin() results.
  • Tests

    • Added regression coverage for prefixed and bare builtin resolution behavior.

@coderabbitai

coderabbitai Bot commented Sep 7, 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: Team

Run ID: 3b0ff95b-72a0-461c-83c6-21cbaaa2d81f

📥 Commits

Reviewing files that changed from the base of the PR and between 87dc334 and 85b9fea.

📒 Files selected for processing (3)
  • changelog.d/9934-module-builtin-inventory.md
  • crates/perry-runtime/src/module_require.rs
  • crates/perry-runtime/src/process.rs

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


📝 Walkthrough

Walkthrough

The builtin resolver now keeps Perry’s node:ffi extension outside Node’s public builtin inventory while resolving its prefixed form. Documentation, regression tests, and the changelog describe the separate inventories and bare-name rejection.

Changes

Builtin module resolution

Layer / File(s) Summary
Separate resolver inventories
crates/perry-runtime/src/process.rs, crates/perry-runtime/src/module_require.rs
The resolver adds a separate Perry extension list, resolves prefixed extensions, and removes node:ffi from Node’s builtin inventory. Comments describe the combined resolver behavior.
Validate extension inventory behavior
crates/perry-runtime/src/process.rs, changelog.d/9934-module-builtin-inventory.md
Tests verify that Perry extensions remain absent from the Node inventory, resolve with the node: prefix, and reject bare names. The changelog records this behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 85b9f

This change removes node:ffi from Node’s public builtin inventory while preserving prefixed node:ffi resolution. The intended behavior is covered across resolver and require paths, with no current merge-blocking risk identified.

Suggested reviewers: thehypnoo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: keeping Perry-only extensions out of the builtin module inventory.
Description check ✅ Passed The description explains the problem, the intended behavior, the related issue, and the validation results. It covers the required summary, changes, related issue, and test plan content, although it d…
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 5 functions across 2 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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

Landed on main via merge train #9939. Validated as a tree: 66/66 lint gates, and perry-runtime/codegen/hir/stdlib all green (5,966 tests, 0 failures). Thanks!

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.

1 participant