Skip to content

Commit 2e7bf56

Browse files
NathanFlurryclaude
andcommitted
feat: Node.js conformance test suite integration
- Vendor upstream Node.js v22.14.0 test/parallel/ suite (3532 tests) - Implement conformance runner with expectations model (pass/fail/skip) - Implement common/ compatibility shim (mustCall, tmpdir, fixtures, etc.) - Fix process exit event firing in V8 runtime (session.rs) - Fix dynamic import TLA resolution (execution.rs) - Add ERR_* error codes to fs/buffer/path/stream/events/http polyfills - Fix events polyfill max-listener warnings (process.emitWarning) - Fix stream polyfill property getters (readableEnded, writableFinished) - Fix VFS mode bits, timestamps, permissions, symlinks - Fix crypto polyfill error codes and validation - Fix timer callback validation - Fix process.hrtime/cpuUsage/memoryUsage stubs - Add conformance report generator and CI workflow - Audit and recategorize all 1750 expectations with specific reasons - Results: 399 genuine passes (11.3%), 36 vacuous, 3029 expected-fail, 68 skip Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c955684 commit 2e7bf56

48 files changed

Lines changed: 17231 additions & 1600 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/conformance.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Node.js Conformance Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
conformance:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
version: 8.15.6
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
cache: pnpm
28+
cache-dependency-path: pnpm-lock.yaml
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Build
34+
run: pnpm build
35+
36+
- name: Import upstream Node.js tests
37+
run: pnpm tsx packages/secure-exec/tests/node-conformance/scripts/import-tests.ts --node-version 22.14.0
38+
39+
- name: Validate expectations
40+
run: pnpm tsx packages/secure-exec/tests/node-conformance/scripts/validate-expectations.ts
41+
42+
- name: Run conformance tests
43+
run: pnpm vitest run packages/secure-exec/tests/node-conformance/runner.test.ts
44+
45+
- name: Generate conformance report
46+
run: pnpm tsx packages/secure-exec/tests/node-conformance/scripts/generate-report.ts
47+
48+
- name: Upload conformance artifacts
49+
if: always()
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: conformance-report
53+
path: |
54+
packages/secure-exec/tests/node-conformance/conformance-report.json
55+
docs/conformance-report.mdx

CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@
100100
- read `docs-internal/arch/overview.md` for the component map (NodeRuntime, RuntimeDriver, NodeDriver, NodeExecutionDriver, ModuleAccessFileSystem, Permissions)
101101
- keep it up to date when adding, removing, or significantly changing components
102102

103+
## Code Transformation Policy
104+
105+
- NEVER use regex-based source code transformation for JavaScript/TypeScript (e.g., converting ESM to CJS, rewriting imports, extracting exports)
106+
- regex transformers break on multi-line syntax, code inside strings/comments/template literals, and edge cases like `import X, { a } from 'Y'` — these bugs are subtle and hard to catch
107+
- instead, use proper tooling: `es-module-lexer` / `cjs-module-lexer` (the same WASM-based lexers Node.js uses), or run the transformation inside the V8 isolate where the JS engine handles parsing correctly
108+
- if a source transformation is needed at the bridge/host level, prefer a battle-tested library over hand-rolled regex
109+
- the V8 runtime already has dual-mode execution (`execute_script` for CJS, `execute_module` for ESM) — lean on V8's native module system rather than pre-transforming source on the host side
110+
- existing regex-based transforms (e.g., `convertEsmToCjs`, `transformDynamicImport`, `isESM`) are known technical debt and should be replaced
111+
103112
## Contracts (CRITICAL)
104113

105114
- `.agent/contracts/` contains behavioral contracts — these are the authoritative source of truth for runtime, bridge, permissions, stdlib, and governance requirements
@@ -180,6 +189,12 @@ Follow the style in `packages/secure-exec/src/index.ts`.
180189
- when adding new work, add it to todo.md
181190
- when completing work, mark items done in todo.md
182191

192+
## Ralph (Autonomous Agent)
193+
194+
- Ralph's working directory is `scripts/ralph/` — this contains `prd.json`, `progress.txt`, `ralph.sh`, `CLAUDE.md`, and the `archive/` folder
195+
- do NOT create a `.ralph/` directory at the repo root; `scripts/ralph/` is the canonical location
196+
- when creating or converting PRDs for Ralph, write to `scripts/ralph/prd.json`
197+
183198
## Skills
184199

185200
- create project skills in `.claude/skills/`

0 commit comments

Comments
 (0)