Skip to content

feat(node:process): expose process.features capability flags (#2588)#3160

Merged
proggeramlug merged 1 commit into
mainfrom
fix/process-features-2588
May 30, 2026
Merged

feat(node:process): expose process.features capability flags (#2588)#3160
proggeramlug merged 1 commit into
mainfrom
fix/process-features-2588

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

@proggeramlug proggeramlug commented May 30, 2026

Summary

Closes the test-side gap in process.features: it is now exercised as a real, non-null object of capability flags whose chained reads (process.features.tls, process.features.typescript, etc.) work and match Node's JS types.

While investigating #2588 I found that the process.features runtime/lowering already landed in #1474process_features_literal() in crates/perry-hir/src/lower/expr_member.rs returns a real Expr::Object of boolean capability flags plus a typescript string. The remaining gap called out by the issue was purely on the test side: test-files/test_parity_process.ts still skipped all chained process.features.* reads with a stale "chained on undefined features crashes" comment, and there was no dedicated gap test.

This PR closes that gap:

  • test-files/test_parity_process.ts — un-skips the chained feature reads. It now asserts typeof process.features, non-null-ness, and the JS type of each documented flag (boolean for the capability flags, string for typescript).
  • test-files/test_gap_process_features.ts (new) — a focused gap test asserting the same deterministic structural invariants (object-ness, non-null, each key's JS type, chained read doesn't crash).

Both assert types and presence, not concrete boolean/string values, because some flags legitimately differ between a Perry build and a Node build (Perry surfaces typescript: "transform" for its AOT pipeline vs Node's "strip"; the uv / inspector / require_module booleans also differ).

Validation

Compiled with the cargo-built runtime/stdlib and compared byte-for-byte against node --experimental-strip-types.

test-files/test_gap_process_features.ts — byte-identical to Node:

typeof: object
non-null: true
inspector is boolean: true
debug is boolean: true
ipv6 is boolean: true
tls is boolean: true
tls_alpn is boolean: true
tls_ocsp is boolean: true
tls_sni is boolean: true
uv is boolean: true
cached_builtins is boolean: true
require_module is boolean: true
typescript is string: true
chained tls ok: true

test-files/test_parity_process.ts — the process.features section is byte-identical to Node (diff <(grep features node) <(grep features perry) => FEATURES_IDENTICAL), and the full fixture diff against Node is empty. Verified against the unmodified origin/main fixture as a baseline, so this PR introduces no new diffs.

  • cargo fmt --all -- --check passes (no Rust files changed).
  • No api-manifest entry added; process.features is handled by HIR lowering (mirroring process.report), so api-docs-drift is unaffected.

Closes #2588.

@proggeramlug proggeramlug merged commit f4bf5e9 into main May 30, 2026
9 of 11 checks passed
@proggeramlug proggeramlug deleted the fix/process-features-2588 branch May 30, 2026 09:06
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.

node:process: expose process.features capability flags

1 participant