fix(node): fill constants tail (constants/zlib Zstd) + util.types predicate tail#3702
Merged
Merged
Conversation
added 3 commits
May 31, 2026 14:03
…dicate tail #3683 node:constants — add POSIX file-flag (S_IF*, O_DIRECTORY/O_NOCTTY/ O_NONBLOCK/O_SYNC/O_DSYNC/O_SYMLINK), libuv (UV_DIRENT_*, UV_FS_SYMLINK_*, UV_FS_COPYFILE_*), and defaultCoreCipherList metadata to both the value-read dispatch (constants + fs.constants) and the enumerable-keys list. O_* use libc on Unix for host-accurate parity; S_IF* are POSIX-standard. #3677 node:zlib — Object.keys(zlib.constants) now enumerates the full 170-key Z_*/BROTLI_*/ZSTD_* set Node exposes (was 0). Added the missing Brotli decoder result/error codes and the ZSTD_error_* codes to the value-read dispatch so every enumerated key reads its backing value. #3678 node:util/types — add the predicate tail Perry can correctly back: isDataView, isFloat16Array, isWeakMap, isWeakSet, isExternal. Dropped isBigIntObject/isSymbolObject (Perry boxes only Number/String/Boolean), isArgumentsObject (no distinct arguments object), isModuleNamespaceObject, isKeyObject, isCryptoKey (no backing value type) — a false-always stub would lie about Node's positive cases. Also adds the missing manifest rows for process.sourceMapsEnabled / setSourceMapsEnabled (drift from #3684) so manifest-consistency stays green.
…83-3677-3678 # Conflicts: # docs/api/perry.d.ts # docs/src/api/reference.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3683
Closes #3677
Closes #3678
Implementation
#3683 — node:constants tail
Added the POSIX file-mode/open flags, libuv flags, and default-cipher metadata Node exposes but Perry resolved to
undefined:UV_DIRENT_*(0–7),UV_FS_SYMLINK_DIR/JUNCTION,UV_FS_COPYFILE_EXCL/FICLONE/FICLONE_FORCES_IFMT/S_IFREG/S_IFDIR/S_IFCHR/S_IFBLK/S_IFIFO/S_IFLNK/S_IFSOCKO_DIRECTORY/O_NOCTTY/O_NONBLOCK/O_SYNC/O_DSYNC/O_SYMLINKdefaultCoreCipherList(string)Wired into both the value-read dispatch (
node:constantsandfs.constants) and theObject.keysenumerable-keys list. O_* / S_IF* uselibc::on Unix for host-accurate values (e.g.O_DIRECTORYdiffers Linux vs macOS); literal fallbacks for non-unix.#3677 — node:zlib Zstd enumeration
Object.keys(zlib.constants)returned 0 keys; it now enumerates the full 170-keyZ_*/BROTLI_*/ZSTD_*set Node exposes (63 of themZSTD*), in Node's insertion order. Added the previously-missing Brotli decoder result/error codes and theZSTD_error_*codes to the value-read dispatch so every enumerated key reads its backing value (no enumerate-but-undefined lie).#3678 — node:util/types predicate tail
Added the predicates Perry can correctly back:
isDataView,isFloat16Array,isWeakMap,isWeakSet,isExternal. Each is wired through the runtime dispatch (util/util.types/util/types), the codegen call-lowering maps, the native table, runtime decls, callable-export value resolution (sotypeof === "function"), and the API manifest.Dropped (would lie about unimplemented features):
isBigIntObject/isSymbolObject(Perry boxes only Number/String/Boolean),isArgumentsObject(no distinct arguments object — Perry uses arrays),isModuleNamespaceObject,isKeyObject,isCryptoKey(no backing KeyObject/CryptoKey value type). Afalse-always stub would return the wrong answer for Node's positive cases.Also added the missing manifest rows for
process.sourceMapsEnabled/setSourceMapsEnabled(native-table drift introduced by #3684) so the manifest-consistency check stays green.Validation
test-files/test_gap_constants_tail_3683plus.tsis byte-identical tonode --experimental-strip-typesunder the DEFAULT auto-optimize compile.cargo test --releasegreen for perry-runtime (930), perry-codegen (incl. manifest_consistency drift check), perry-api-manifest (18), perry-hir.cargo fmt --all -- --checkclean,./scripts/check_file_size.shexit 0../scripts/regen_api_docs.sh).