Skip to content

fix(util): match parseEnv dotenv semantics#3446

Merged
proggeramlug merged 4 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-util-parse-env
May 31, 2026
Merged

fix(util): match parseEnv dotenv semantics#3446
proggeramlug merged 4 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-util-parse-env

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Fixes #3423

Summary:

  • Tighten util.parseEnv argument validation to throw ERR_INVALID_ARG_TYPE for non-string content.
  • Match Node dotenv parsing semantics for null-prototype results, sorted keys, export prefixes, inline comments, duplicate keys, empty values, invalid names, and multiline quoted values.
  • Add a parity fixture covering the Node semantics that were missing from the existing parseEnv smoke test.

Why this PR is scoped to one issue:

  • The issue is specifically about node:util.parseEnv availability/behavior. process.loadEnvFile and shared dotenv loading behavior are covered separately.

Verification:

  • RUSTC_WRAPPER= ./run_parity_tests.sh --suite node-suite --module util --filter parse-env
  • RUSTC_WRAPPER= cargo build --release -p perry -p perry-runtime -p perry-stdlib
  • RUSTC_WRAPPER= cargo test -p perry-runtime util_parse_env
  • RUSTC_WRAPPER= cargo test -p perry-codegen --test manifest_consistency
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh

Known limitations / non-goals:

  • This does not change process.loadEnvFile path handling or environment mutation behavior.

@andrewtdiz
Copy link
Copy Markdown
Contributor Author

Fixed the cargo-test failure on this branch by applying the ReflectIsExtensible stable-hash tag correction needed while current mainline still has the duplicate RegExpEscape tag.

Local checks passed: CARGO_TARGET_DIR=/root/perry/target cargo test -p perry-hir stable_hash::tests::expr_variant_stable_hash_tags_are_unique and git diff --check.

Ralph Küpper added 2 commits May 31, 2026 10:33
# Conflicts:
#	crates/perry-hir/src/stable_hash/expr.rs
#	crates/perry-runtime/src/util_parse_env.rs
@proggeramlug proggeramlug merged commit 56eaa04 into PerryTS:main May 31, 2026
11 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.

node:util: implement parseEnv dotenv parser

2 participants