Skip to content

Commit e556dc0

Browse files
authored
Merge pull request #47 from rivet-dev/ralph/nodejs-conformance-tests
feat: Node.js conformance test suite integration
2 parents ebec353 + f9d7d6f commit e556dc0

48 files changed

Lines changed: 17730 additions & 1839 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
@@ -93,6 +93,15 @@
9393
- read `docs-internal/arch/overview.md` for the component map (NodeRuntime, RuntimeDriver, NodeDriver, NodeExecutionDriver, ModuleAccessFileSystem, Permissions)
9494
- keep it up to date when adding, removing, or significantly changing components
9595

96+
## Code Transformation Policy
97+
98+
- NEVER use regex-based source code transformation for JavaScript/TypeScript (e.g., converting ESM to CJS, rewriting imports, extracting exports)
99+
- 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
100+
- 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
101+
- if a source transformation is needed at the bridge/host level, prefer a battle-tested library over hand-rolled regex
102+
- 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
103+
- existing regex-based transforms (e.g., `convertEsmToCjs`, `transformDynamicImport`, `isESM`) are known technical debt and should be replaced
104+
96105
## Contracts (CRITICAL)
97106

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

185+
## Ralph (Autonomous Agent)
186+
187+
- Ralph's working directory is `scripts/ralph/` — this contains `prd.json`, `progress.txt`, `ralph.sh`, `CLAUDE.md`, and the `archive/` folder
188+
- do NOT create a `.ralph/` directory at the repo root; `scripts/ralph/` is the canonical location
189+
- when creating or converting PRDs for Ralph, write to `scripts/ralph/prd.json`
190+
176191
## Skills
177192

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

0 commit comments

Comments
 (0)