Skip to content

Commit 9afb6e9

Browse files
committed
chore: update progress for US-186
1 parent 32e9982 commit 9afb6e9

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

progress.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Started: 2026-03-17
33
PRD: ralph/kernel-hardening (46 stories)
44

55
## Codebase Patterns
6+
- Stream polyfill prototype chain is patched in _patchPolyfill (require-setup.ts) — esbuild's circular-dep bundling breaks Readable→Stream inheritance; without patch, `instanceof Stream` fails (breaks node-fetch, undici, etc.)
67
- Timing mitigation Date.now/performance.now use getter/setter (not writable:false) — setter is no-op for Node.js compat; configurable:false blocks re-definition
78
- Claude binary at ~/.claude/local/claude — not on PATH by default; skip helpers must check this fallback location
89
- Claude Code --output-format stream-json requires --verbose flag; uses ANTHROPIC_BASE_URL natively (no fetch interceptor)
@@ -2340,3 +2341,17 @@ PRD: ralph/kernel-hardening (46 stories)
23402341
- diagnostics_channel.tracingChannel() must return traceSync/tracePromise/traceCallback no-op wrappers that execute the passed function — libraries like pino call these directly
23412342
- Use `timestamp: false, base: undefined` with pino for deterministic output (removes time, pid, hostname)
23422343
---
2344+
2345+
## 2026-03-18 - US-186
2346+
- Implemented node-fetch project-matrix fixture (v2.7.0, CJS)
2347+
- Fixed stream polyfill prototype chain: esbuild's circular-dep resolution between stream-browserify and readable-stream broke `instanceof Stream` — Readable extended EventEmitter directly instead of Stream; patched in `_patchPolyfill` to insert Stream.prototype back into the chain
2348+
- Files changed:
2349+
- packages/secure-exec/tests/projects/node-fetch-pass/ (new fixture)
2350+
- packages/secure-exec-core/isolate-runtime/src/inject/require-setup.ts (stream patch)
2351+
- packages/secure-exec-core/src/generated/isolate-runtime.ts (generated)
2352+
- docs/nodejs-compatibility.mdx (Tested Packages table)
2353+
- **Learnings for future iterations:**
2354+
- node-fetch v3 is ESM-only and uses socket.prependListener (not in bridge); use v2 for CJS compat
2355+
- `body instanceof Stream` check in node-fetch v2 was failing because esbuild's bundling of stream-browserify↔readable-stream circular dependency breaks the prototype chain (Readable → EventEmitter instead of Readable → Stream → EventEmitter)
2356+
- Stream polyfill patches go in `_patchPolyfill` in require-setup.ts; the generated file auto-updates on build
2357+
---

scripts/ralph/prd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3205,7 +3205,7 @@
32053205
"Tests pass (project-matrix)"
32063206
],
32073207
"priority": 186,
3208-
"passes": false,
3208+
"passes": true,
32093209
"notes": "Tests fetch polyfill compatibility with native fetch bridge."
32103210
},
32113211
{

0 commit comments

Comments
 (0)