Skip to content

#503 guard refuses dynamic dispatch on require()-imported stdlib namespaces (compile-fail) #1723

Closed

Description

@proggeramlug

Summary

The #503 dynamic-dispatch lockdown guard refuses require()-imported stdlib namespaces, producing a hard compile error: dynamic dispatch on stdlib namespace 'path'/'process' is refused.

Discovered by the #800 node-core radar (test-path-glob.js, test-assert-checktag.js — both compile-fail).

Repro shape

A CommonJS test does const path = require('path') (rewritten to a namespace import by #1711) and then uses path in a dynamically-dispatched position (e.g. path[name], or passing path where the guard can't prove the member statically). Perry refuses to compile:

Error: dynamic dispatch on stdlib namespace `path` is refused ...

Expected / Actual

  • Expected: same handling as the ESM import * as path from 'node:path' form.
  • Actual: compile-fail only for the require()-introduced namespace binding.

Likely cause

The #503 guard keys on the import/binding shape; the synthetic namespace binding created by the require()→import rewrite (#1711) isn't recognized as the same well-known stdlib namespace, so dynamic access trips the guard. Related: #1701/#1703 (a prior #503 false-positive).

Context: follow-up to #668 / #1711 (require()/.js native compile), surfaced via #800.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regressionparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions