Registry Mirror
Skip to content

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Closes #1330. Stacked on #1331 (the granular node:process suite) — base will auto-retarget to main when #1331 merges.

Implements the five node:process gaps the suite pinned. The process module is now 12/12 in node-suite/process; the five known_failures.json entries are removed (they flip to PASS).

Gaps fixed

  1. Method values read as functions. typeof process.cwd / nextTick / hrtime / exit / on / uptime / memoryUsage / cpuUsage is now "function". Bare process lowers to the GlobalGet(0) sentinel, so process.<method> reads (not calls) are routed through js_native_module_property_by_name("process", …) — the same machinery os/tty/perf_hooks/console use — with the pairs added to is_native_module_callable_export. The closure is a real function value (also fixes const f = process.cwd). The call forms still lower to their dedicated HIR variants and never reach this path.

  2. process.env writes/deletes persist. process.env.X = v now lowers to js_setenv, which writes the real OS environment (the store EnvGet/js_getenv reads) and coerces the value to a string like Node (process.env.N = 42 → "42"). delete process.env.X lowers to js_removeenv. Pre-fix the write hit a field on the cached js_process_env() object that EnvGet never consults, so it silently never round-tripped.

  3. process.hrtime() direct call. New Expr::ProcessHrtime(Box<Expr>) + js_process_hrtime, returning a [seconds, nanoseconds] integer tuple off the existing monotonic baseline. The diff form process.hrtime(prev) is non-negative. process.hrtime.bigint() is still intercepted earlier (nested-namespace dispatch).

  4. argv0 / execPath / title are exposed as string properties via get_native_module_constant("process", …).

Validation

Notes

  • cpuUsage has no call lowering yet — the read still correctly reports "function"; calling the captured value is a separate (pre-existing) limitation.
  • Per the contributor convention, no version bump / CHANGELOG entry — folded in at merge.

First node-suite coverage for node:process (12 cases). The core API works
and passes: process object shape, platform/arch (host enums), pid, env reads
+ absent-key undefined, cwd() absolute string, version 'v'-prefix + versions
object, argv string-array shape, and process.nextTick(cb) ordering.

Five cases pin real gaps, tracked in #1330 + test-parity/known_failures.json:
- shapes/method-types + nexttick/is-function: typeof process.<method> is not
  'function' (the call forms work; member-read-as-value reflection gap)
- env/write: process.env.X = v doesn't persist (assignment lowering)
- hrtime/tuple: process.hrtime() direct call unwired (only .bigint() exists)
- props/string-props: argv0/execPath/title read as number, not string

Tests use the global `process` (the primary API and the better-supported
path in Perry; the default import exposes fewer members — folded into #1330).
7/12 pass.
…, argv0/execPath/title

Closes the five node:process gaps surfaced by the granular node-suite
(now 12/12). All changes are additive and scoped to `process`.

- Method values read as functions (#1330 gap 1): route `process.cwd`/
  `nextTick`/`hrtime`/`exit`/`on`/`once`/`uptime`/`memoryUsage`/
  `cpuUsage`/`kill`/`chdir` reads (bare-global GlobalGet sentinel) through
  `js_native_module_property_by_name("process", …)` and add the pairs to
  `is_native_module_callable_export`, so `typeof process.cwd === "function"`.
  The call forms still lower to their dedicated HIR variants.

- process.env writes/deletes (gap 2): `process.env.X = v` lowers to
  `js_setenv` (writes the real OS environment that EnvGet reads, coercing
  the value to a string like Node); `delete process.env.X` lowers to
  `js_removeenv`. Pre-fix the write hit the cached js_process_env() object
  EnvGet never consults, so it never round-tripped.

- process.hrtime() (gap 3): new `Expr::ProcessHrtime(Box<Expr>)` +
  `js_process_hrtime` returning a [seconds, nanoseconds] integer tuple off
  the existing monotonic baseline; the diff form `process.hrtime(prev)` is
  non-negative. `process.hrtime.bigint()` is still intercepted earlier.

- argv0/execPath/title (gap 4): exposed as string properties via
  get_native_module_constant("process", …).

Removes the five known_failures.json entries (they flip to PASS).
@proggeramlug
proggeramlug merged commit bddb040 into feat/process-node-suite May 22, 2026
1 check passed
@proggeramlug
proggeramlug deleted the fix/process-gaps-1330 branch May 22, 2026 12:53
proggeramlug added a commit that referenced this pull request May 22, 2026
…, resource/memory metrics, features/config, ...)

Audit follow-up to make node:process coverage exhaustive. Now 40 cases.
After #1371's fixes (method typeof, env write, hrtime(), argv0/execPath/title
all PASS — their known_failures entries removed), the suite is 24/40.

New passing: ppid, stdout/stderr fds, stderr.write, versions.v8, nextTick
returns undefined.

12 new gaps, each tracked by its own granular issue in known_failures.json:
EventEmitter API on/emit/listeners (#1372), umask (#1373), abort (#1374),
emitWarning (#1375), resourceUsage/getActiveResourcesInfo (#1376),
availableMemory/constrainedMemory (#1377), features (#1378), config (#1379),
allowedNodeEnvironmentFlags (#1380), versions sub-fields (#1381).
proggeramlug added a commit that referenced this pull request May 23, 2026
* feat(process): implement process.abort() (#1374)

`typeof process.abort` reported `"undefined"` because `process` lowers to
the `GlobalGet(0)` sentinel and the value-read path had no route for the
`"abort"` property. The call form fell through to the generic
NativeMethodCall dispatch (no-op).

Wire it up via the established pattern (mirrors how #1371 handled cwd /
nextTick / exit etc. on the process-node-suite branch):

- New `Expr::ProcessAbort` HIR variant; native_module.rs lowers
  `process.abort()` to it.
- Codegen calls runtime `js_process_abort`, which raises SIGABRT
  (`libc::abort()` on unix, `std::process::abort()` elsewhere).
- For the value-read form (`typeof process.abort`, `const f = process.abort`),
  PropertyGet routes the GlobalGet receiver + `"abort"` property through
  `js_native_module_property_by_name("process", "abort")`, and
  `is_native_module_callable_export` returns true so the helper hands
  back a bound-method closure (typeof "function").
- api-manifest gets a `method("process", "abort", ...)` entry so the
  compile-time typeof short-circuit and SBOM audit see the surface.
- New parity case `node-suite/process/methods/abort` verifying
  `typeof process.abort === "function"`.

* docs(api): regenerate manifest after process.abort entry
proggeramlug added a commit that referenced this pull request May 23, 2026
…e_parity.sh

First exhaustive node:process suite on main: 60 granular cases (39 pass /
22 fail) covering shape, platform, env, cwd, version + versions sub-fields,
argv, nextTick, hrtime + bigint, props, memory + rss + available, cpu +
threadCpuUsage, uptime, stdout/stderr fds + write, global identity, release,
exec-argv, exit + exit-code, events (on/emit/listeners), methods
(umask/abort/emit-warning/kill/chdir/get-builtin-module/load-env-file/
source-maps-enabled/dlopen/ref-unref/exit), resource (usage + active),
features, config, ipc (connected/send-disconnect), report, allowed flags,
title, sub-fields, unix uid/gid, module-load-list, finalization, exception
uncaught-capture, shapes ppid/debug-port/method-types/process-object/
module-load-list, exit-code, hrtime tuple form.

22 failing cases tracked in known_failures.json with granular per-gap issue
references. Method-value reflection (#1343), env-write (#1344), hrtime()
tuple (#1345), and argv0/execPath/title (#1346) were originally fixed in
#1371 but that PR merged into the #1331 branch only — #1331 was rebased
onto current main and those fixes were dropped; the issues are reopened.

Adds run_module_parity.sh: thin wrapper that runs ./run_parity_tests.sh
--suite node-suite --module <m> for a list of modules (default: process +
perf_hooks) and prints a combined per-module + total summary.
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.

1 participant