Repository navigation
fix(module): retain origin for detached import.meta.resolve - #116
Merged
Merged
Conversation
Bind the lazy resolver to its originating ImportMetaObject and preserve writable, configurable resolver properties. Cover detached calls, explicit parents, independent module origins and resolve hooks.
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.
Detached
import.meta.resolvemust keep the originating module's resolution base. Bind the resolver on first access, preserve its writable data-property behavior, and keep explicit parent arguments working. A foreign receiver cannot change its origin. The resolve-once loader from oven-sh#44473 remains unchanged.Coverage includes detached calls, descriptors, replacement, freeze, seal, preventExtensions and foreign receivers. The generic WebKit integrity path materializes the custom value before applying integrity attributes; native controls confirm that freezing or sealing cannot be undone by first access. The canonical before/after resolver control improves from 49 pass / 5 fail to 54 pass / 0 fail.
Reviewed head
957df2767fbe0836645ab48ad2fa8c0040a048f6includes current main2518a31b3b995e3af82832add3e503a2e69c0e73. This refresh preserves the implementation and regression blobs and appends the owned changelog entry after the exact main prefix. The original implementation and authorship are Peter Steinberger's.The exact macOS arm64 release binary, with the pinned f1e engine, passes its 4 own rows and all 57 surrounding module/resolver/plugin rows. P2 autoreview, formatting, source lints and JavaScript lint pass.
The frozen broader Mac selection completes 46/47 rows. Its sole failing file retains the two reconnect assertions with additional
ECONNRESETevents. A verified binary whose tree equals current main reproduces the same two assertions using identical test and harness sources (135 pass / 12 existing skips / 2 fail). The HTTP row and the newly merged VM guard pass in the refreshed aggregate. This is baseline comparison evidence, not a 47/47 success claim. No assertions, skips or deadlines changed.An earlier preparation (
ab20de1c) also failed the HTTP TCPbody-to-comeassertion atnode-http.test.ts:3866, expectingclosed: trueand receivingfalseafter 10.038 seconds. The matching base-tree binary independently reproduced it after 10.043 seconds; unchanged candidate isolation passed. The original 45/47 aggregate and both controls remain retained as historical evidence.Final exact-head CI qualification:
30667d3634078d349c4c98587b70d0ec59a32941equals the reviewed head tree.4b5cb9136129038795fbaa433d0a4d5439d705ca01b70bc450472d7bbefedfae; ARM64a3120166380d70c46af82da4b5d4339806e40156a28a3cd059fd7219a3aeda7b. Signing and publication are disabled.test/js/node/module/node-module-module.test.js; the resolver's own files and every other selected row pass. Manifest assembly is skipped because that compatibility job reports failure.Named Windows intermittent: run 37386790583, x64 job 112026689208,
node-module-module > compile cache wakes an idle loop for deferred modules. The unchanged test must complete within 30,000 ms; it timed out at 30,001.35 ms, followed by cleanup of one dangling child. The file reports 204 pass, 4 existing skips, 1 todo and 1 fail. The full log also retains the preliminary parallel batch's natural-exit cache timeout at 31,476.47 ms and its delayed cleanup assertion (expectedflushed, received an empty string); the runner's standard serial fallback produced the final idle-test failure above.This post-#130 recurrence is recorded under the known-intermittent landing policy. The policy does not waive any of #116's own rows. No rerun is used as qualification, and no assertion, skip or deadline changed. The earlier exact-source preparation passed both Windows architectures:
ab20de1cto this head changes only #131's VM test, CI notes and changelog, with no production changes and identical selected Windows test/harness hashes. Recurrence diagnosis remains a separate follow-up; a passing rerun would not establish its cause.Historical Darwin watch failure, retained explicitly: run 37356789711, original Darwin job at head
4a9a85a8b0367cc4e747daa796003acc905eccfdpassed the resolver's own rows and all other selected rows, but failedtest/js/node/watch/fs.watch.rewrite.test.ts:94. The assertionexpect(seen.some(p => p.startsWith("a/"))).toBe(false)expectedfalseand receivedtrue; the runner also reportedENOTEMPTYduring temporary-directory cleanup. The same unchanged row independently failed on #131, while #120 had passed it. The known-failure policy permits this single row only when all own and other selected CI rows pass. No assertion, skip, or deadline was changed. The passing unchanged-head retry is retained as an observation and is not the qualification basis.The separate watcher comparison reproduces the same failure class on official upstream Bun 1.4.3 (
13a98b0dbd136bcc5c98a8adfb53c909aa3183cc): 3/80 upstream trials and 4/80 fork trials, versus 0/80 Node 24 trials on the same Mac. Every failure contains a latea/seed.txtand the correctb/inside.txt, with noa/inside.txt. The FSEvents source and maintained test are byte-identical; directory callback code is identical. These are independent reproduced traces, not invented traces of the original CI process. This establishes upstream-equivalent behavior, not a deterministic fix or Node immunity. The watcher implementation and test remain unchanged.Original implementation and historical Windows/OpenClaw consumer evidence
Copying
import.meta.resolveinto a local variable currently throws because the resolver reads its call receiver's path. Give each import-meta object a lazy resolver bound to its originating module, matching Node's detached-call behavior and function metadata. Preserve explicit-parent resolution and writable/configurable resolver properties.The regression covers detached calls,
call/apply/bind, foreign receivers, visible-path mutation, function name/length, property descriptors, independent module origins, explicit parents, and resolve hooks. Node 24 controls pass; unmodified Bun reproduces the binding failures. P2 review is scoped-clean and scoped formatting passes.Native Windows Server 2022 x64 proof used matched source and verified binaries: the resolver runner improved from 37/42 test files passing on fork main
d2d2a26ef973cdd97b37953f5dba58052acad74fto 42/42 passing, with both dependency-install steps also successful. The passing executable was built from local integration03aa23b6adea8e12235339d8650cae41fa1ea80d(tree1c5084c96b361801cd9f595795774ec41e81e250), combining four independent fixes. This branch's production and test files are byte-identical in that integration. Executable SHA-256:cbd65560d2f8651dc82722d1d957803651e2803f0a1a66ae039b946d3b53b156.Node24 portable and freeze/seal/preventExtensions/foreign-receiver controls pass. Upstream searches found no matching detached-binding fix.
Exact-head fork CI passes both required lanes: Linux x64 (15/15 selected and compatibility test files) and macOS arm64 (11/11); both dependency-install steps also pass in each lane. Native Windows proof is recorded above because this PR workflow has no Windows test lane.
Final native Windows proof uses local integration
9a2e4b08f3b3f2e17e05a23c35aeade9c6da06f3, executable SHA-25619453c39dbb599eff57c1544a1c117dbc7bde7947ba2d41c9829cee9f20b10e0. The maintained module selection passes 2/2 files, the resolver selection 42/42, and broad compatibility 29/29; each run also passes both install steps. Source and executable guards pass before and after. Both Node 24 and the fork pass the complete 12-step installed OpenClaw path, including real update, foreground Gateway, plugins, a verified mock-provider turn, sustained readiness and Doctor. Foreground cleanup uses taskkill. No Windows build is published or signed.The full 186-file/32-envelope comparison on identical OpenClaw
deb44a7f20b774769104ab4262c8ada438d4fc8ereports all 3,184 assertions on each runtime: Node 2,896 pass / 13 fail / 275 skip (30 successful envelope exits), fork 2,891 pass / 16 fail / 277 skip (29 successful exits), with no missing reports, unhandled errors or suite failures. The three extra fork failures are shared Windows path limits reproduced with equal-length Node/fork/stock controls; the raw totals are preserved. All three shared timing failures pass isolated on Node and fork under unchanged deadlines (92 pass / 5 skip each). Runtime-specific conditional skips remain explicit. The original d2d2 runtime also passes the six-file/two-envelope OpenClaw consumer control (220 pass / 3 skip); these selected consumers provide non-regression evidence. The installed-update proof separately exercises the native-addon failure.The three affected OpenClaw fixture files are fully revalidated on Node 24 and the fork: frozen before
deb44a7f20b774769104ab4262c8ada438d4fc8egives 40 pass / 13 fail / 3 skip on each; the corrected private fixture commit96222ca4829457295a7fa3b00324b9d96b989291and exact public head343017e1202b579274fe87d51f6491ba8eeeeee4each give 53 pass / 3 existing skips on both runtimes. All 56 cases are accounted for, every one of the 13 before-failures now explicitly passes, and the skip set is unchanged. This is complete three-file before/after and public-head proof, not a rerun of the full 32-envelope matrices. The verified public proof archive SHA-256 is504d7ef2308d3c0a48d4b26135c233cdc720e8dc10c6e6061ddbe4d79e0c9f7a. The fixture correction openclaw/openclaw#165577 was merged from that exact tested public head as8bc338dbed0ddf5c35b2178eb624ffc88ccef7e7. Its inherited-CI exception is recorded on the OpenClaw PR; no CI rerun or tested-head change was used for this proof.