Skip to content

feat(native): stabilize native value profile boundaries - #8720

Closed
proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/6827-native-value-profile
Closed

feat(native): stabilize native value profile boundaries#8720
proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/6827-native-value-profile

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Summary

Completes the stable native value profile from RFC #6827: exact-width scalar ABI handling, source-linked POD contracts, nested POD values, and copy-safe managed/native boundaries. Ordinary TypeScript number behavior remains unchanged, while explicit native crossings now reject invalid or imprecise values.

Changes

  • Add the full public scalar vocabulary (i8, i16, i32, i64, isize, u8/byte, u16, u32, u64, usize, f32, f64, bool, handle_id) across manifest parsing, codegen, runtime checks, and documentation.
  • Reject fractional, out-of-range, and unsafe integer materialization instead of truncating or silently losing i64/u64 precision.
  • Resolve source: "./module.ts#Export" POD declarations, derive layouts, and report exact manifest/source drift during compile and perry native validate.
  • Support nested closed POD records, recursive initialization/materialization, and true value-copy semantics for local assignment and ordinary function calls while preserving PodView aliasing.
  • Update the manifest schema and native-value docs, and add focused HIR, transform, runtime, codegen, validation, and end-to-end regressions.

Related issue

Closes #6827

Test plan

  • cargo build --release -p perry --bin perry
  • cargo check -p perry --tests
  • cargo test -p perry-api-manifest exact_width_scalar_spellings_are_canonical_and_pod_safe
  • cargo test -p perry-hir native_profile::tests
  • cargo test -p perry-runtime scalar_guards_reject_incompatible_js_values
  • Focused codegen tests for exact-width guards, nested POD copies, safe i64/u64 materialization, and native ABI returns
  • cargo test -p perry-transform pod_value_parameters_preserve_the_call_copy_boundary
  • ./scripts/pre-tag-check.sh --quick
  • perry run test-files/test_parity_native_value_profile.ts
  • User-facing regression added under test-files/
  • CLI/runtime API documentation updated under docs/src/
  • Full workspace test suite (not run locally)

Screenshots / output

The end-to-end parity test reports exact-width conversion results, all expected rejection flags, nested materialization, and independent POD copies across both local assignment and an ordinary function boundary.

Checklist

  • I have NOT bumped the workspace version or edited CLAUDE.md / CHANGELOG.md
  • My commits follow the repository prefix convention
  • I have read CONTRIBUTING.md and agree to the Code of Conduct

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 12 minutes.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d4743044-25b7-45c6-b3c6-951054751945

📥 Commits

Reviewing files that changed from the base of the PR and between 850e6f1 and c308150.

📒 Files selected for processing (24)
  • changelog.d/8720-native-value-profile.md
  • crates/perry-api-manifest/src/native_abi.rs
  • crates/perry-codegen/src/expr/literals_vars.rs
  • crates/perry-codegen/src/expr/mod.rs
  • crates/perry-codegen/src/expr/pod_record.rs
  • crates/perry-codegen/src/lower_call/extern_func.rs
  • crates/perry-codegen/src/lower_call/omitted_native_params.rs
  • crates/perry-codegen/src/native_value/materialize.rs
  • crates/perry-codegen/src/native_value/pod.rs
  • crates/perry-codegen/src/native_value/verify/abi.rs
  • crates/perry-codegen/src/runtime_decls/mod.rs
  • crates/perry-codegen/src/stmt/let_stmt.rs
  • crates/perry-codegen/tests/native_proof_regressions/native_library.rs
  • crates/perry-codegen/tests/native_proof_regressions/pod_manifest.rs
  • crates/perry-hir/src/lib.rs
  • crates/perry-hir/src/native_profile.rs
  • crates/perry-runtime/src/native_abi.rs
  • crates/perry-transform/src/inline/analysis.rs
  • crates/perry-transform/src/inline/mod.rs
  • crates/perry/src/commands/compile/resolve/native_library.rs
  • docs/api/manifest.schema.json
  • docs/src/language/native-values.md
  • docs/src/native-libraries/manifest-v1.md
  • test-files/test_parity_native_value_profile.ts
✨ 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 added a commit that referenced this pull request Aug 24, 2026
…Intl worklist (#8723)

Lands #8672, #8718, #8720 and #8659.

#8672's blocker is resolved the way the evidence pointed. Its own
`is_bound_native_method_closure_value` is gone; only main's
`is_bound_native_constructor_closure_value` remains, and the branch that
called it in `parent_static.rs` is deleted. That branch was unreachable
under either predicate -- the `if let Some(..) = bound_native_callable_
module_and_method(..)` block directly above returns unconditionally, and
both predicates require that same query to be `Some` -- so removing it is
behaviour-preserving rather than a choice between two semantics.

#8718 (closes #6620) routes `server.listen(path)`, `net.connect(path)` and
the `{ path }` overloads through real Windows named pipes and Unix-domain
sockets instead of falling back to TCP.

#8720 stabilizes native value profile boundaries; #8659 completes the
Intl 402 test262 worklist.

One fix on top: a changelog fragment for #8718, which had neither one nor
a skip-changelog label.

#8719 is NOT in this batch -- it conflicts with #8672 on
`lower_call/method_override.rs`, which both touch.

No version bump.

Co-authored-by: Ralph Küpper <ralph@skelpo.com>
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main via #8723 (squash 8beca2f29), with #8672 and #8718.

Validated on the merged result: all 30 lint checkers, runtime 2667/0, codegen 1214/0 plus all codegen integration suites clean, transform 93/0, ext-net 30/0. 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.

RFC: Stabilize a Perry native value profile for fixed-width scalars, POD records, and native boundaries

1 participant