internal/primordials: Node.js parity, generated and engine-backed - #35567
internal/primordials: Node.js parity, generated and engine-backed#35567robobun wants to merge 26 commits into
Code review found 2 important issues
Found 4 candidates, confirmed 5. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 2 |
| 🟡 Nit | 3 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | src/codegen/primordials-module-epilogue.js:132-154 |
Two bun/no-duplicate-conditional-property-access lint errors remain in epilogue after partial fix |
| 🟡 Nit | src/js/internal-for-testing.ts:280-282 |
exposedInternals lazy-getter fix missed sibling 'export const fs = require(...)'; load-timing test's precondition still |
| 🟡 Nit | src/codegen/generate-primordials.ts:265-279 |
FunctionPrototype escapes Value→HolderSelf normalization because typeof Function.prototype === 'function' |
| 🟡 Nit | src/codegen/generate-primordials-probe.js:113-130 |
Float16Array in holders map and test list but omitted from probe's constructor loop |
Annotations
Check failure on line 154 in src/codegen/primordials-module-epilogue.js
claude / Claude Code Review
Two bun/no-duplicate-conditional-property-access lint errors remain in epilogue after partial fix
Two of the three lint violations from CodeRabbit's consolidated finding survived f08a7eaf (only `ObjectCreate` was fixed before the thread was resolved): `makeSafe()` reads `unsafe.prototype` in the `if` test and again in `ReflectOwnKeys(unsafe.prototype)`, and `SafeArrayPrototypePushApply` reads `items.length` in the `if` test and again in the do-while test. Both propagate verbatim into the checked-in `src/js/internal/primordials.js`, which is covered by `oxlint.json`'s `bun/no-duplicate-condit
Check warning on line 282 in src/js/internal-for-testing.ts
claude / Claude Code Review
exposedInternals lazy-getter fix missed sibling 'export const fs = require(...)'; load-timing test's precondition still false
The lazy-getter conversion for `exposedInternals` (with its comment "Values are lazy so merely requiring bun:internal-for-testing does not evaluate the whole internal-module graph") missed the sibling `export const fs = require("node:fs/promises").$data;` at line 340, which still eagerly pulls in `internal/primordials` (via `internal/fs/glob` → `internal/shared`). So the prelude's `require("bun:internal-for-testing")` still evaluates the primordials module before the "tampering planted before th
Check warning on line 279 in src/codegen/generate-primordials.ts
claude / Claude Code Review
FunctionPrototype escapes Value→HolderSelf normalization because typeof Function.prototype === 'function'
`FunctionPrototype` is the one `XPrototype` entry that escapes this normalization pass: per spec `typeof Function.prototype === "function"`, so the probe records it as `kind: "Method"` (not `kind: "Value", valueType: "object"`) and the guard on line 267 skips it. Directly visible in the checked-in `.d.ts`: `declare const $FunctionPrototype: PrimordialMethod<FunctionConstructor, "prototype">` vs every peer (`$ArrayPrototype: Array<any>`, `$MapPrototype: Map<any, any>`, …). Runtime impact is nil t
Check warning on line 130 in src/codegen/generate-primordials-probe.js
claude / Claude Code Review
Float16Array in holders map and test list but omitted from probe's constructor loop
The probe's intrinsic-constructors loop omits `Float16Array` (matching Node's per_context/primordials.js), but `generate-primordials.ts`'s `holders` map still declares `Float16ArrayPrototype`/`Float16ArrayConstructor` and the test's `typedArrays` list still includes `"Float16Array"` — three sibling lists disagree. The generated header ends up listing both holders in `JSC_FOREACH_PRIMORDIAL_LAZY_HOLDER`/`HOLDER_ACCESSOR` with empty `JSC_FOREACH_PRIMORDIAL_Float16Array*(V)` entry macros (the C++ s