Skip to content

[codex] runtime descriptor metadata for Math and generators - #4149

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-runtime-descriptors
Jun 3, 2026
Merged

[codex] runtime descriptor metadata for Math and generators#4149
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-runtime-descriptors

Conversation

@andrewtdiz

@andrewtdiz andrewtdiz commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Linked Issues

Behavior Cluster

This is a focused runtime descriptor cut for builtin reflective metadata:

  • installs descriptor-visible Math own methods and constants with Node-compatible data-property attributes
  • routes escaped Math.<method> reads through the real Math namespace object so method name/length descriptors remain observable
  • treats Math, JSON, and Reflect as builtin global values so bare namespace reads lower through globalThis
  • honors own Symbol.toStringTag values in Object.prototype.toString, covering generator constructor reflection
  • keeps Generator and AsyncGenerator prototype descriptor coverage pinned with focused parity fixtures

Why Batched

#4139 and #4141 both fail in the same reflective surface: builtin own-property descriptors and intrinsic prototype metadata. The implementation path is shared across global namespace installation, object descriptor lookup, and codegen member reads, and the tests use the same node-suite/globals parity harness.

Tests Added

  • test-parity/node-suite/globals/builtin-namespace-descriptors.ts
  • test-parity/node-suite/globals/generator-prototype-descriptors.ts

Validation

  • cargo build --release -p perry-runtime -p perry
  • PERRY_NO_AUTO_OPTIMIZE=1 PERRY_ALLOW_UNIMPLEMENTED=1 target/release/perry compile --no-cache test-parity/node-suite/globals/builtin-namespace-descriptors.ts -o /tmp/perry_builtin_namespace_descriptors && /tmp/perry_builtin_namespace_descriptors
  • PERRY_NO_AUTO_OPTIMIZE=1 PERRY_ALLOW_UNIMPLEMENTED=1 target/release/perry compile --no-cache test-parity/node-suite/globals/generator-prototype-descriptors.ts -o /tmp/perry_generator_prototype_descriptors && /tmp/perry_generator_prototype_descriptors
  • PATH=/tmp/perry-node25-bin:$PATH PERRY_NO_AUTO_OPTIMIZE=1 PERRY_NO_CACHE=1 ./run_parity_tests.sh --suite node-suite --module globals --filter builtin-namespace-descriptors
  • PATH=/tmp/perry-node25-bin:$PATH PERRY_NO_AUTO_OPTIMIZE=1 PERRY_NO_CACHE=1 ./run_parity_tests.sh --suite node-suite --module globals --filter generator-prototype-descriptors
  • cargo test -p perry-runtime object
  • cargo fmt --all -- --check
  • git diff --check
  • git diff --check HEAD
  • ./scripts/check_file_size.sh

Known Limitations

Non-Goals

  • No TypedArray constructor descriptor work.
  • No primitive wrapper reflective brand-check work.
  • No broad descriptor-table rewrite across all builtins.

@proggeramlug
proggeramlug force-pushed the codex/node-compat-runtime-descriptors branch from 2ed014f to 51b75da Compare June 3, 2026 06:07
@proggeramlug
proggeramlug marked this pull request as ready for review June 3, 2026 06:07
@proggeramlug
proggeramlug merged commit f93018b into PerryTS:main Jun 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runtime: builtin own-property descriptor attributes wrong + getOwnPropertyDescriptor returns undefined

2 participants