Node API checker: namespace reads of absent builtin exports should return undefined…
- User
Node API checker: namespace reads of absent builtin exports should return undefined
Summary
Perry's strict built-in API gate currently rejects some namespace property reads that Node treats as ordinary JavaScript property misses returning
undefined.This surfaced in the curated DNS constants fixture on current
origin/main@22824ba90abf:node:dns/promisesintentionally does not exportADDRCONFIG,V4MAPPED, orALL, but reading those properties from the namespace object is valid in Node and returnsundefined. Perry rejects the property read at check/lower time before the runtime can produce the matching value.This is separate from named ESM import validation. Node rejects
import { ADDRCONFIG } from "node:dns/promises", and Perry should continue not claiming that named export. The compatibility gap is namespace/property-read semantics.Local evidence
Current main:
text22824ba90abf Expose globalThis.EventTarget (#3628)Node v25.9.0 behavior for the namespace object:
console$ node -e 'import("node:dns/promises").then(m=>{for (const k of ["ADDRCONFIG","V4MAPPED","ALL","NODATA","CANCELLED"]){console.log(k, Object.prototype.hasOwnProperty.call(m,k), k in m, typeof m[k], m[k]);}})' ADDRCONFIG false false undefined undefined V4MAPPED false false undefined undefined ALL false false undefined undefined NODATA true true string ENODATA CANCELLED true true string ECANCELLEDNode rejects the corresponding named import, which is correct and should remain true:
console$ node --input-type=module -e 'import { ADDRCONFIG } from "node:dns/promises"; console.log(ADDRCONFIG)' SyntaxError: The requested module 'node:dns/promises' does not provide an export named 'ADDRCONFIG'Perry currently rejects the namespace property read in the curated fixture:
console - Assistant
Now let me look at how calls are gated and find existing tests for the gate.
- Assistant
Let me look at the api-manifest crate and how named-import validation works.
- Assistant
Now build and run the HIR test suite to see what the change affects.
- Assistant
Now add a targeted regression test for the DNS scenario from the issue:
- Assistant
Full perry-hir suite passes and the build finished. Let me check that unused-import warning isn't something I introduced:
- Assistant
Warning is pre-existing. Now run the acceptance checks:
- Assistant
Toolchain works now. Run the DNS fixture and compare with Node:
- Assistant
All acceptance criteria verified. Now run broader regression suites:
- Assistant
While tests run, let me double-check the fixture check once more with the final binary state and run
git diff --check: - Assistant
I'll wait for the background test suite to notify. Meanwhile, let me review the final diff of the two production files:
- Assistant
perry CLI crate: 426 passed, 0 failed. Waiting on transform/parser:
- Assistant
All suites green. Final verification of the working tree state:
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.