feat(node:process): expose process.features capability flags (#2588)#3160
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.featuresruntime/lowering already landed in #1474 —process_features_literal()incrates/perry-hir/src/lower/expr_member.rsreturns a realExpr::Objectof boolean capability flags plus atypescriptstring. The remaining gap called out by the issue was purely on the test side:test-files/test_parity_process.tsstill skipped all chainedprocess.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 assertstypeof process.features, non-null-ness, and the JS type of each documented flag (booleanfor the capability flags,stringfortypescript).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"; theuv/inspector/require_modulebooleans also differ).Validation
Compiled with the
cargo-built runtime/stdlib and compared byte-for-byte againstnode --experimental-strip-types.test-files/test_gap_process_features.ts— byte-identical to Node:test-files/test_parity_process.ts— theprocess.featuressection 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 unmodifiedorigin/mainfixture as a baseline, so this PR introduces no new diffs.cargo fmt --all -- --checkpasses (no Rust files changed).process.featuresis handled by HIR lowering (mirroringprocess.report), soapi-docs-driftis unaffected.Closes #2588.