Repository navigation
fix(plugin): refresh newly created files during delegated resolution - #88
Merged
Merged
Conversation
steipete
force-pushed
the
fix/plugin-delegated-dircache
branch
3 times, most recently
from
October 3, 2026 11:10
2672f99 to
04f6fde
Compare
Enable the existing runtime mutable-directory policy when runtime plugin hooks are registered, matching registerHooks missing-file recovery. Cover delegated require/import and onLoad-only registration with late-created package-import targets.
Retry unresolved plugin lookups once with the existing mutable-directory policy and restore it afterward. Refresh newly created directory indexes under the entries lock. Cover cached directory indexes, static dependencies in missing directories, and genuine unresolved targets.
Keep entry and directory descriptor lookups together across refreshes. Cover TypeScript targets selected by package imports and package main, plus wildcard extension inference.
steipete
force-pushed
the
fix/plugin-delegated-dircache
branch
from
October 3, 2026 11:30
04f6fde to
93f9f76
Compare
steipete
marked this pull request as ready for review
October 3, 2026 11:48
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.
A runtime
Bun.plugincallback can create a package file and returnundefined, yet delegated resolution still reportsMODULE_NOT_FOUNDbecause the directory was cached before that file existed. This fixes first-use package-import captures, including computed require/import, static dependencies, newly created directories, directory indexes, and extension candidates.Plugin registration records a per-resolver capability. The existing
NotFoundarm retries nonfatal misses once using the filesystem refresh policy already used bymodule.registerHooks(). A scoped guard restores that policy, and recovered results go through normal finalization. Directory entry and descriptor lookups use the same locked snapshot and release the lock before refreshing. The compatibility note and append-only changelog describe the behavior.Validation uses matched release/LTO builds of base
45ad44f68aand this change on one AWS c7a.24xlarge host (Ubuntu 26.04.1), with Node 24.21.0 as the filesystem oracle. All consumer runs isolate HOME, state, and temporary directories.rust:check-all: 2 configured targets pass, 10 skip for missing installed target libraries. Required independent Codex branch review is scoped-clean through P2.OpenClaw consumer proof uses the capture-adapter candidate on
a45979ee0f763, including all original 44 conditions plus retained-target and first-use wildcard cases:Node's two failures are confined to the added consumer first-use fixtures; the original 44 and retention controls pass, and its standalone filesystem oracle passes 10/10.
Thirty interleaved rounds per runtime/mode, cold processes, isolated state, warm OS cache; each sample loads all 88 entries with 88 native hits and zero forced/fallback transforms. Extra-hook Bun samples each execute 126,175 delegating callbacks. Baseline and patched exports match.
loadMsis the primary metric; intervals use 10,000 paired bootstrap samples (seed 73).The separately measured no-hooks control makes zero calls to Bun.plugin or registerHooks. Thirty paired processes each resolve 10,000 existing paths and 1,000 missing paths:
The accepted cold median ceiling is +0.5%; the no-hooks criterion remains no measurable slowdown within the paired interval. Both pass, and both cold modes also pass the earlier conservative all-metric checker. Noise is
min(5%,2*MAD(main)/median(main)). Node cold medians are 5092.905132ms (normal) and 5077.791885ms (extra-hook control).Performance and consumer measurements use the matched
45ad44f68abase and04f6fde48ccandidate. The final rebase onto stack-formatting fix #92 leaves both resolver source files and this regression test file byte-identical; final-head review and CI validate the rebased integration.Final head
93f9f76261de8f6a74772a2cca07e804e13864c8has a scoped-clean P2 branch review. Native CI run 37119871754 passed both Linux x64 and Darwin arm64 on this exact head.Upstream oven-sh/bun#40279 remains open and tracks negative filesystem facts across runtime/build/watch resolution, including directory and package-metadata changes. This patch reuses the fork's existing mutable-directory policy only after a runtime plugin resolution miss. No duplicate upstream PR is needed.