Skip to content

Conversation

@darvld
Copy link
Member

@darvld darvld commented Sep 24, 2025

Ready for review Powered by Pull Request Badge

Summary

This PR adds a couple of fixes related to host environment variable access from guest code:

Node's process.env now returns the environment map installed by the Environment plugin, which correctly enforces host access configuration and supports loading .env files, etc. This fixes #1664, which was not a failure of the env map itself, but instead an issue with formatting when writing to console or using JSON.stringify

Additionally, Node process tests now verify that env matches the map installed by the env plugin instead of checking against host env directly. Tests have been added to verify that the Environment plugin correctly handles host access settings.

@darvld darvld self-assigned this Sep 24, 2025
@darvld darvld requested a review from sgammon as a code owner September 24, 2025 21:39
@darvld darvld added bug Something isn't working module:graalvm Modules, changes, and issues relating to GraalVM P0 api:node Node API and stdlib labels Sep 24, 2025
Signed-off-by: Dario Valdespino <dvaldespino00@gmail.com>
Signed-off-by: Dario Valdespino <dvaldespino00@gmail.com>
@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.55%. Comparing base (22be5d0) to head (eea68ec).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...main/kotlin/elide/runtime/plugins/env/EnvPlugin.kt 50.00% 2 Missing ⚠️
...kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt 0.00% 0 Missing and 1 partial ⚠️
...n/kotlin/elide/runtime/node/process/NodeProcess.kt 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1666      +/-   ##
==========================================
- Coverage   40.58%   40.55%   -0.04%     
==========================================
  Files         798      798              
  Lines       37803    37790      -13     
  Branches     5387     5387              
==========================================
- Hits        15344    15325      -19     
- Misses      20633    20641       +8     
+ Partials     1826     1824       -2     
Flag Coverage Δ
jvm 40.55% <42.85%> (-0.04%) ⬇️
lib 40.55% <42.85%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...lin/elide/runtime/intrinsics/js/node/ProcessAPI.kt 65.00% <ø> (ø)
...kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt 30.51% <0.00%> (-0.06%) ⬇️
...n/kotlin/elide/runtime/node/process/NodeProcess.kt 52.03% <50.00%> (-4.40%) ⬇️
...main/kotlin/elide/runtime/plugins/env/EnvPlugin.kt 64.00% <50.00%> (+14.00%) ⬆️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22be5d0...eea68ec. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@darvld darvld merged commit a9c5e82 into main Sep 24, 2025
18 checks passed
@sgammon sgammon mentioned this pull request Oct 30, 2025
32 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:node Node API and stdlib bug Something isn't working module:graalvm Modules, changes, and issues relating to GraalVM P0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(js): process.env is always empty

3 participants