Repository navigation
fix(runtime): scope server children's transpiler cache and keep scoping idempotent - #7364
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 8
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
…ng idempotent Server spawns of the bundled runtime (startup-health probe, dashboard startup install, Windows tray) bypassed the launcher and still evicted the test runner's cache. Scope them through durableBunChildEnv when the child is a different Bun version; re-scope an already scoped path in place; accept prerelease/build versions; type the helper.
e8fc42d to
aedd824
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 071987095e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const tail = SCOPED_TAIL.exec(cache); | ||
| const base = tail && validVersion(tail[2].slice(4)) ? (tail[1] || cache.slice(0, cache.length - tail[2].length)) : cache; |
There was a problem hiding this comment.
Track scoped state without parsing arbitrary cache paths
For an explicit cache root ending in a valid-looking version, such as /protected/bun-1.2.3, this heuristic treats the operator's directory as a generated scope and changes it to the sibling /protected/bun-1.4.2, potentially writing executable cache data outside the configured directory. Conversely, . first scopes to the bare path bun-1.4.2, which this separator-dependent match does not recognize on the next launch, producing bun-1.4.2/bun-1.4.2. Both valid inputs violate the documented override-preservation/idempotence contract, so scoped state needs an unambiguous marker or preserved original base rather than inference from the final directory name.
AGENTS.md reference: structure/AGENTS.md:L9-L10
Useful? React with 👍 / 👎.
Summary
Follow-up to #7362 (merged as 93a9016), addressing the non-blocking review findings from gemini-4-argon. Rebased onto
dev; it contains only the follow-up commits.Server children on the bundled runtime still evicted the runner's cache.
src/server/startup-health-cache.ts(startup-health probe behind/api/settings),src/server/startup-action-control.ts(dashboard startup install) andsrc/server/windows-tray-control.tsstartdurableBunPath()directly, withoutbin/ocx.mjs. Under the 1.4.3 test runner that path is the bundled 1.4.2 binary, which inherited the unscoped shard cache and rewrote the runner's entries. Settings tests such astests/server/logs-timezone.test.tstrigger it. A newdurableBunChildEnv()insrc/lib/bun-runtime.tsscopes the cache to the child's version only when the durable runtime is the bundled binary and differs from the running Bun; otherwise the env is returned unchanged. All three spawn sites use it.Measured: a warm runner cache (378 entries, format 34), then
bun test tests/server/logs-timezone.test.ts:bun-1.4.2/Nested launches no longer nest the scope. A launcher started from an already launched process inherited
<cache>/bun-1.4.2and produced<cache>/bun-1.4.2/bun-1.4.2. The helper now re-scopes a trailingbun-<version>segment in place.Root-level scopes keep their root.
/bun-1.4.2/,C:\bun-1.4.2\and UNC paths re-scope to/bun-<v>,C:\bun-<v>and\\srv\share\bun-<v>. A bareC:would be drive-relative, so a drive root keeps its separator. Relative (bun-1.4.2,.) and drive-relative (C:bun-1.4.2) scopes also re-scope in place, and a drive-relative parent stays drive-relative. A name that merely ends inbun-<v>(xbun-1.4.2) stays an ordinary parent. (Found in review rounds 1–2.)Version pattern matches
findPathBun. Prerelease identifiers with hyphens and+buildmetadata are accepted (bounded to 64 characters). The alphabet still has no separator, drive colon or NUL.Adds
src/lib/bun-transpiler-cache-scope.d.mts, matching the other launcher.mjshelpers, so TypeScript callers are typed.Verification
tests/cli/bun-transpiler-cache-scope.test.ts: 7 pass, including root-level, relative and boundary cases. Windows forms checked with nativepath.win32.bun-*parent), prerelease/build/oversized versions, anddurableBunChildEnvchoosing scope only across a version change.tests/lab/core-lab-boundary.test.ts: 123 pass, 0 fail.bun x tsc --noEmit,bun run structure:checkandscripts/file-size-ratchet.tspass.Checklist
structure/ops/cross-platform-ci.md.)