Skip to content

test runtime: Node-only build script tests run on Node (orca #48, slice 8) - #58

Merged
nachumi-a2zoperations merged 1 commit into
blowzer/fork-onlyfrom
nachumi-a2zoperations/issue-48-bun-node-scripts
Nov 15, 2026
Merged

nachumi-a2zoperations merged 1 commit into
blowzer/fork-onlyfrom
nachumi-a2zoperations/issue-48-bun-node-scripts

Conversation

@nachumi-a2zoperations

Copy link
Copy Markdown

Refs #48 (slice 8: two Node-only build scripts whose tests ran on Bun; 2 red files). #48 stays open for the rest.

Root cause

Production runs both scripts on Node, but their tests ran on Bun, which behaves differently. Each difference was proven by a probe outside Orca (MacBook, bun 1.4.4 vs Node):

Test What Bun does differently Effect Production runtime
config/scripts/worktree-storage/reclaim-worktree-generated-files.test.mjs fs.rm on a read-only directory with files in it throws ENOTEMPTY; Node throws EACCES the script makes the tree writable and retries only on EACCES/EPERM, so under Bun the retry never ran ("Some generated directories could not be removed") pnpm reclaim-space = node reclaim-worktree-space.mjs, which spawns it with process.execPath
config/scripts/macos/terminal-host-bundle/macos-terminal-host-bundle.test.mjs after a first require.resolve(…, { paths: [dir] }) from a directory, Bun keeps that directory's state and misses a node_modules created later, falling back to its global install cache (~/.bun/install/cache/yaml@…) the test's in-bundle check failed the .cjs helper is loaded by electron-builder.config.cjs on Node

Fix

Route both tests to the Node runtime in vitest-node-runtime-files.mjs, with the proven reason beside them. Product code is unchanged.

Tests

  • The routing test gets a slice 8 case. Red first (both on Bun), green now.
  • The routing test + both files through the normal runner: 26/26 (2 were red).
  • Preflight check-changed: 13/13.

…ce 8)

Two config scripts that production runs on Node had their tests on Bun,
where Bun behaves differently (each proven by a probe outside Orca, on
the MacBook with bun 1.4.4):

- reclaim-worktree-generated-files: on a read-only directory with files
  in it, Node's fs.rm throws EACCES and Bun's throws ENOTEMPTY. The
  script makes the tree writable and retries only on EACCES/EPERM, so
  under Bun the retry never ran ("Some generated directories could not
  be removed"). Production: `pnpm reclaim-space` = node
  reclaim-worktree-space.mjs, which spawns this script with
  process.execPath.
- macos-terminal-host-bundle: after a first require.resolve(..., {paths:
  [dir]}) from a directory, Bun keeps that directory's state and misses
  a node_modules created later, falling back to its global install
  cache (~/.bun/install/cache/yaml@...); Node sees the new folder and
  resolves inside the bundle. The test's second check depends on that.
  Production: the .cjs helper is loaded by electron-builder.config.cjs
  on Node.

Fix: route both tests to the Node runtime in
vitest-node-runtime-files.mjs, with the reason beside them. No product
code changes.

Test: the routing test gets a slice 8 case; red first (both on Bun),
green now. The routing test + both files through the normal runner:
26/26 (2 were red).

Refs #48
@nachumi-a2zoperations
nachumi-a2zoperations merged commit da70f61 into blowzer/fork-only Nov 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant