Repository navigation
fix(resolver): publish cached absolute paths once - #94
Merged
Merged
Conversation
steipete
marked this pull request as ready for review
October 3, 2026 13:29
Prevent worker resolution and filesystem-router reloads from observing a canonical path pointer with the shorter alias length, which can resolve a symlinked file to a directory-only node_modules path. Adapts oven-sh#40258 by @robobun. Use OnceLock for safe publication and retain the entry mutex around fallible initialization and cached-fd access. Add resolver tests for concurrent first-fill publication and failed-fill retry.
steipete
force-pushed
the
claude/resolver-churn-w115
branch
from
October 3, 2026 13:33
401a563 to
fce7fbd
Compare
This was referenced Oct 3, 2026
steipete
added a commit
that referenced
this pull request
Oct 5, 2026
Bound the macOS runtime transpiler cache to one write transaction at a time. Parallel file creation and rename contend inside APFS, spending kernel CPU across Bun Pool workers. Parsing, resolution, cache reads, cache bytes and atomic publication remain unchanged; resolver synchronization from #89/#94 is preserved. On the loaded arm64 Mac, 12 samples per arm in ABBA order reduce median system CPU from 5.340 to 1.505 seconds (71.8%) and hardware cycles from 24.838 to 11.343 billion (54.3%). Both bootstrap intervals exclude no change. Wall time is 1.805 to 1.890 seconds, a difference within the wide shared-host noise interval. All 352 SDK imports succeed and all 2,093 cache entries are byte-identical. Quiet Linux timings remain unchanged within run variation. Add a cold/warm module-import benchmark and concurrent symlink/cache-reuse coverage. Align stale hook-cache assertions with format 36 while preserving current-hook, changed-target and removed-target checks. Validation: 28 cache tests; 141 resolver/cache tests with two existing skips; all 12 Rust targets; native Linux and Darwin CI; scoped-clean Codex P2 review. CI: https://github.com/openclaw/bun/actions/runs/37246173137
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.
What does this PR do?
Concurrent worker resolution and filesystem-router reloads can expose a truncated symlink target such as
/fixture/node_modules/, causingEISDIRorERR_MODULE_NOT_FOUND.Entry.abs_pathwas a plain, multiwordInterned, filled independently with either the shorter alias path or the longer canonical path. Linux instrumentation captured an alias-lengthabs_pathsnapshot ending atnode_modules, while the guarded symlink cache held the complete filename and the cached fd was invalid.Adapts oven-sh/bun#40258 by @robobun.
OnceLock<Interned>publishes the complete value once without manualSend/Syncimplementations. Initialization retains the per-entry mutex for cached-fd access and leaves failed fills retryable. Resolver, router, test-scanner, and hot-reloader callers use the same API. The mutable entry cache remains guarded separately.How did you verify your code works?
The unpatched Linux workload reproduced directory-only paths, and the native diagnostic identified the malformed absolute-path snapshot. Miri reports a data race in the original
set_abs_pathassignment versus the original getter. The baseline probe leaves production code unchanged and uses a test-only adapter to map the new initializer calls to the former lazy-fill getter/setter sequence. The committed resolver regression tests check concurrent publication and failed-fill retry; patched Miri passes four tests with three existing native-SIMD exclusions.Final head
fce7fbde02bcee756ed9e76c1bced8dc5f503b9apassed 68,616,192 resolves, imports, and requires each, with 67,008 worker lifetimes, 104,958 build/reload iterations, and zero resolution errors across ten approximately 90-second processes. This exceeds the earlier failing workload's six complete pre-failure runs: 29,163,520 of each operation, 28,480 workers, and 39,878 build/reload iterations. The original failure occurred in its seventh process.Exposure is nondeterministic: the initial main CI artifact failed twice; an instrumented main build failed in its third process and supplied the native capture; a clean matched source baseline also completed 57,933,824 of each operation without error. The Miri failure and native capture establish the publication defect independently of that variability.
Matched no-LTO release builds of main
ba02f43295and this head used the same Linux machine/toolchain, no other test load, CPUs 16–31, and eight samples per arm in ABBA order:The final-head surrounding resolver, filesystem-router, worker, bundler-resolver, and source-lint run passed 598 tests, with two existing skips. All 12 Rust targets passed; resolver all-target clippy, router library clippy, and formatting pass. An extra router all-target lint probe found four unchanged debug-print macros in existing tests; those are outside this change.
The OpenClaw consumer pair passed all 23 tests on the final binary with
OPENCLAW_VITEST_RUNTIME=bunand private HOME/state/tmp directories. Ten paired runs on the same resolver change before the unrelated main rebase also passed all 230 test cases; baseline Bun and Node controls passed 23 each. A Node 24 control resolved and required all 128 symlinked page fixtures correctly. Theimport override to bun:testrow passes after #87; no W100 change is duplicated here.Independent Codex P2 branch review is scoped-clean. Both native lanes, Linux x64 and Darwin arm64, are green on this exact head in run 37126588182. Rust CI 37126588216 is also green, including Miri and clippy. The rebase preserved both append-only changelog entries and left every reviewed resolver/router source blob unchanged.
The advisory Mordant job remains red with the existing
bare_bool_argswarning forresolve_target(..., false, false)in unchangedsrc/resolver/package_json.rs, counted across three targets, as already reported by the upstream-sync parent in run 37121766296. That job is explicitly configured as non-blocking; the native lanes, Miri, clippy, formatting, and source checks pass.