Summary
Perry exposes node:buffer length constants, but current origin/main hardcodes buffer.kMaxLength and buffer.constants.MAX_LENGTH to 4294967296. Current 64-bit Node reports 9007199254740991 for both values.
The existing granular parity case only checks that the top-level and nested aliases are equal to each other, so a wrong shared value can pass.
No local Perry binary was available in this issue-creator workspace, so this report is based on current origin/main source inspection plus the Node oracle below.
Node oracle
Node v25.9.0 on this 64-bit macOS host:
const { constants, kMaxLength, kStringMaxLength } = require('node:buffer');
console.log(process.version);
console.log(constants.MAX_LENGTH, kMaxLength, constants.MAX_LENGTH === kMaxLength);
console.log(constants.MAX_STRING_LENGTH, kStringMaxLength, constants.MAX_STRING_LENGTH === kStringMaxLength);
console.log(Object.keys(constants).sort().join(','));
Output:
v25.9.0
9007199254740991 9007199254740991 true
536870888 536870888 true
MAX_LENGTH,MAX_STRING_LENGTH
Perry evidence
Current origin/main source:
crates/perry-runtime/src/object/native_module.rs returns 4294967296.0 for ("buffer", "kMaxLength").
- The same file returns
4294967296.0 for ("buffer.constants", "MAX_LENGTH").
kStringMaxLength / MAX_STRING_LENGTH are already set to 536870888.0, matching the Node probe above.
crates/perry-runtime/src/buffer/validate.rs documents Node's buffer.constants.MAX_LENGTH as 2^53 - 1 on 64-bit platforms and uses 9_007_199_254_740_991.0 for validation, so the exported constant is inconsistent with Perry's own validation limit.
test-parity/node-suite/buffer/properties/constants.ts currently checks only type and alias equality, not the actual Node value.
Suggested parity coverage
Strengthen the existing constants test to include the current Node value for the target runtime:
import { constants, kMaxLength, kStringMaxLength } from 'node:buffer';
console.log('max length:', constants.MAX_LENGTH);
console.log('top max length:', kMaxLength);
console.log('same max:', constants.MAX_LENGTH === kMaxLength);
console.log('string max:', constants.MAX_STRING_LENGTH);
console.log('top string max:', kStringMaxLength);
console.log('same string max:', constants.MAX_STRING_LENGTH === kStringMaxLength);
console.log('keys:', Object.keys(constants).sort().join(','));
If Perry intentionally clamps allocation to a lower implementation limit, that should be enforced by allocation errors separately; the public Node constant should still match Node's current value for feature detection and userland validation logic.
Scope / non-goals
This is not about exposing buffer.constants itself; that was handled by merged PR #906. It is also not asking Perry to allocate multi-terabyte buffers. The issue is the observable public constant value and its consistency with kMaxLength / constants.MAX_LENGTH.
Duplicate searches performed before filing:
kMaxLength MAX_LENGTH 4294967296
buffer.constants.MAX_LENGTH kMaxLength
Buffer constants MAX_LENGTH
- PR search for
kMaxLength MAX_LENGTH 4294967296 buffer.constants
Summary
Perry exposes
node:bufferlength constants, but currentorigin/mainhardcodesbuffer.kMaxLengthandbuffer.constants.MAX_LENGTHto4294967296. Current 64-bit Node reports9007199254740991for both values.The existing granular parity case only checks that the top-level and nested aliases are equal to each other, so a wrong shared value can pass.
No local Perry binary was available in this issue-creator workspace, so this report is based on current
origin/mainsource inspection plus the Node oracle below.Node oracle
Node v25.9.0 on this 64-bit macOS host:
Output:
Perry evidence
Current
origin/mainsource:crates/perry-runtime/src/object/native_module.rsreturns4294967296.0for("buffer", "kMaxLength").4294967296.0for("buffer.constants", "MAX_LENGTH").kStringMaxLength/MAX_STRING_LENGTHare already set to536870888.0, matching the Node probe above.crates/perry-runtime/src/buffer/validate.rsdocuments Node'sbuffer.constants.MAX_LENGTHas2^53 - 1on 64-bit platforms and uses9_007_199_254_740_991.0for validation, so the exported constant is inconsistent with Perry's own validation limit.test-parity/node-suite/buffer/properties/constants.tscurrently checks only type and alias equality, not the actual Node value.Suggested parity coverage
Strengthen the existing constants test to include the current Node value for the target runtime:
If Perry intentionally clamps allocation to a lower implementation limit, that should be enforced by allocation errors separately; the public Node constant should still match Node's current value for feature detection and userland validation logic.
Scope / non-goals
This is not about exposing
buffer.constantsitself; that was handled by merged PR #906. It is also not asking Perry to allocate multi-terabyte buffers. The issue is the observable public constant value and its consistency withkMaxLength/constants.MAX_LENGTH.Duplicate searches performed before filing:
kMaxLength MAX_LENGTH 4294967296buffer.constants.MAX_LENGTH kMaxLengthBuffer constants MAX_LENGTHkMaxLength MAX_LENGTH 4294967296 buffer.constants