Skip to content

test(windows): give the Windows lane's teardowns the repo's rm retry policy - #17227

Closed
brennanb2025 wants to merge 3 commits into
mainfrom
brennanb2025/flake-windows-teardown-eperm
Closed

brennanb2025 wants to merge 3 commits into
mainfrom
brennanb2025/flake-windows-teardown-eperm

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​284 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​255
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41 $\color{#cf222e}{\Huge{\mathbf{−}}}$​22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19

ELI5

When a test finishes it deletes the temporary folder it was working in. On Windows the folder is often still "in use" for a fraction of a second after the test is done — an antivirus scan, the search indexer, a child process that just exited, or a native .dll the OS has not finished unloading. Delete it right then and Windows says operation not permitted.

Node has a built-in answer: ask it to retry the delete a few times. Orca's product code already does this and already picked the number — 8. Its tests did not, so a test whose checks had all passed was reported as a failure because tidying up lost a race.

This teaches the Windows CI lane to tidy up the way the rest of the codebase already does.

What the user sees

Nothing at runtime — the product paths already retried. What changes is that package (windows) stops reporting passing tests as failures.

Before After
A Windows spec that loads a native module and then deletes its temp dir EPERM: operation not permitted from the finally, after every assertion passed the delete retries up to 8 times, 150 ms apart
A new spec added to the Windows lane free to hand-roll rmSync(dir, { recursive: true, force: true }) and reintroduce the flake fails a boundary test on the PR that adds it, on every platform

The failure

package (windows), config/scripts/rebuild-native-deps.test.mjs, test rebuilds a loadable ConPTY native that lacks Orca job ownership (win32-only).

The last assertion is line 238 and it passed. The throw comes from line 240:

      } finally {
        rmSync(projectDir, { recursive: true, force: true })   // maxRetries defaults to 0
      }

That test exists to rebuild node-pty and load the ConPTY native — the same job log carries node-pty's conpty native is missing listJobProcessIds … Resolved from: ../prebuilds/win32-x64/, so a real dlopen is live in the run. A DLL Windows has just mapped keeps a handle on the directory it came from, and maxRetries: 0 gives that handle no time to go away.

The convention it was ignoring

src/main/host-tree-removal.ts:11      const WINDOWS_RM_MAX_RETRIES = 8
src/main/codex-accounts/service.ts:71 const WINDOWS_RM_MAX_RETRIES = 8

Two copies, both in product code, neither reachable from a test.

The fix

  • src/shared/windows-transient-lock-removal.ts — one home for the policy, exposing removeTree / removeTreeSync and the options behind them. Retries are win32-only; POSIX gets the plain options it had.
  • All 21 raw recursive removals in the Windows CI lane move onto it, across 9 files.
  • src/shared/windows-lane-tree-removal-boundary.test.ts reads the lane's spec list out of the Test Windows-specific boundaries step in .github/workflows/pr.yml — so the gate follows the lane rather than a hand-kept copy of it — and fails on any recursive removal that carries no maxRetries.

Census

The task asked how many other teardowns ignore the convention. Across src, tests and config:

1,633 recursive directory removals in 1,028 files pass no maxRetries — 1,368 in tests and fixtures, 265 in product code.

This PR changes only the 21 in the Windows lane. The 265 product-code sites are the ones that matter beyond CI hygiene: a test leaking a temp directory is untidy, a product path that cannot delete a user's directory is a bug. That is a separate change, and worth deciding as a shape question (shared helper plus a lint rule that makes the raw call the exception) rather than as a sweep.

Proof

Ablations, one at a time, mutation verified applied, tree restored between runs, run serially. Suite: windows-transient-lock-removal.test.ts + windows-lane-tree-removal-boundary.test.ts, 6 tests.

Ablation Failing tests
revert the convicted teardown at rebuild-native-deps.test.mjs line 240 to the raw rmSync 1
drop the win32 branch from transientLockRemovalOptions() 1
blind the boundary scanner so it reports nothing 1

The third ablation first came back 0 red — the boundary test passed because the scanner found nothing, which is indistinguishable from finding nothing wrong. actually detects a raw recursive removal was added to pin the detector against a synthetic source, and the scanner-blinding ablation then reds.

Honest limit: the EPERM itself is a win32-only teardown failure and I could not reproduce it on macOS — it.skipIf(process.platform !== 'win32') skips the convicted test here. What is proved failing-first is the gate: the boundary test reds on the exact line that threw in CI, and it runs on every platform. The EPERM itself is settled by CI on package (windows).

Local gates: pnpm tc exit 0, 0 error TS (foreground). oxlint on all 12 changed files exit 0, including the native-plugin and type-aware code-quality configs. The 11 touched/affected test files: 9 passed, 2 skipped, 47 tests passed, 0 failed.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR centralizes transient-lock deletion options and updates Windows-lane teardown paths to use retrying removal helpers.

  • Adds shared synchronous and asynchronous tree-removal helpers.
  • Migrates Windows-specific test teardowns and existing production retry constants.
  • Adds tests enforcing the shared policy and scanning the Windows lane for raw recursive removals.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
src/shared/windows-transient-lock-removal.ts Defines the shared Windows retry policy and synchronous/asynchronous removal helpers.
src/shared/windows-transient-lock-removal.test.ts Verifies platform-specific options and prevents duplicate retry-policy declarations.
src/shared/windows-lane-tree-removal-boundary.test.ts Scans workflow-selected Windows specs for raw recursive removals.
src/main/host-tree-removal.ts Reuses the centralized removal options while preserving the existing outer retry behavior.
src/main/codex-accounts/service.ts Imports the centralized retry constants while retaining unconditional retries for host-driven managed-home deletion.

Reviews (5): Last reviewed commit: "test(windows): put the policy ratchet on..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds shared synchronous and asynchronous tree-removal helpers with Windows retry options. Production code uses the shared retry configuration. Test suites use the helpers for temporary-directory cleanup. Existing direct file removal remains unchanged where needed. New tests verify platform-specific options, enforce a single retry-policy declaration, and scan the Windows CI lane to reject raw recursive tree removal.

Merge Risk: 🟡 Moderate · up to 45474

The PR centralizes Windows cleanup retries and adds a guard against regressions, but the guard is not run by the Windows-specific test command and does not recognize all recursive removal call forms. Future Windows cleanup flakes could therefore pass CI unnoticed, so merge should wait for these gaps to be corrected.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description gives a detailed explanation of the failure, implementation, scope, and validation. However, it does not include the required Linked Issue entry, and it omits several template sections… Add the missing required template sections. Include a real issue reference after "Fixes #"; write "N/A" with a reason under Visual Proof; document AI usage or leave the section according to repository policy; complete Review, Agent skill up…
Docstring Coverage ⚠️ Warning Docstring coverage is 61.54% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Windows test teardown change and the repository retry policy. It is concise and specific.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description gives a detailed explanation of the failure, implementation, scope, and validation. However, it does not include the required Linked Issue entry, and it omits several template sections such as Visual Proof, AI Disclosure, Review, Notes, and the Checklist.

Resolution

Add the missing required template sections. Include a real issue reference after "Fixes #"; write "N/A" with a reason under Visual Proof; document AI usage or leave the section according to repository policy; complete Review, Agent skill upstream boundary, Notes, and Checklist items. Keep the existing technical explanation and testing evidence.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 96b9898a-08d7-4ad4-b4be-c822a1265188

📥 Commits

Reviewing files that changed from the base of the PR and between a1f198b and bf9ac32.

📒 Files selected for processing (12)
  • config/scripts/rebuild-native-deps.test.mjs
  • src/main/agent-hooks/windows-hook-payload-delivery.test.ts
  • src/main/cli/wsl-cli-powershell-boundary.test.ts
  • src/main/cursor/hook-service.test.ts
  • src/main/orca-profiles/profile-index-store.test.ts
  • src/main/runtime/repo-worktree-admin-fingerprint.test.ts
  • src/main/windows/windows-host-job.win32.test.ts
  • src/shared/child-process/windows-command-line.win32.test.ts
  • src/shared/secure-file-fsync-flags.test.ts
  • src/shared/windows-lane-tree-removal-boundary.test.ts
  • src/shared/windows-transient-lock-removal.test.ts
  • src/shared/windows-transient-lock-removal.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

/** Every recursive removal that does not go through the retrying helper. */
function findRawRecursiveRemovals(source: string): number[] {
const offenders: number[] = []
const call = /(?<![\w$.])(?:fs\.)?rm(?:Sync)?\(/g

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- applicable repository knowledge files ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- knowledge headers ---'
for f in /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/*/*.md; do
  [ -f "$f" ] && { printf '\n### %s\n' "$f"; head -80 "$f"; }
done
printf '%s\n' '--- target outline ---'
ast-grep outline src/shared/windows-lane-tree-removal-boundary.test.ts
printf '%s\n' '--- target source ---'
cat -n src/shared/windows-lane-tree-removal-boundary.test.ts
printf '%s\n' '--- direct references ---'
rg -n -C 3 'findRawRecursiveRemovals|windows-lane|fs\.promises\.rm|rmSync|recursive:\s*true' src package.json .github 2>/dev/null || true

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -e
log=/tmp/coderabbit-shell-logs/shell-output-ojcnNd
printf '%s\n' '--- target/scanner excerpts from prior output ---'
rg -n -C 8 'windows-lane-tree-removal-boundary|findRawRecursiveRemovals|Detect|fs\.promises\.rm' "$log" | head -240 || true
printf '%s\n' '--- target file ---'
cat -n src/shared/windows-lane-tree-removal-boundary.test.ts
printf '%s\n' '--- scoped knowledge filenames ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print | sort
printf '%s\n' '--- knowledge entries mentioning removal or Windows ---'
rg -l -i 'remov|windows|lane' /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/*/*.md 2>/dev/null | while read -r f; do
  printf '\n### %s\n' "$f"
  head -120 "$f"
done

Repository: stablyai/orca

Length of output: 47233


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- src conventions ---'
cat /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions/src.md
printf '%s\n' '--- repo-wide conventions ---'
cat /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions/repo-wide.md
printf '%s\n' '--- removal API forms ---'
rg -n -C 2 'fs\.promises\.rm|fs\.rm(?:Sync)?|from .node:fs/promises.|import .*fs.* from .node:fs.|import \* as fs' src tests config .github 2>/dev/null | head -300

Repository: stablyai/orca

Length of output: 23886


🌐 Web query:

Node.js fs.promises.rm recursive force maxRetries API documentation

💡 Result:

The fsPromises.rm(path[, options]) API, introduced in Node.js v14.14.0, is designed to remove files and directories, modeling the standard POSIX rm utility [1][2][3]. The following options are relevant to your query: force: When set to true, exceptions are ignored if the path does not exist. The default value is false [1][4]. recursive: When set to true, the operation performs a recursive directory removal. In this mode, operations are retried on failure. The default value is false [1][4]. maxRetries: This option specifies the number of retries the operation will attempt if it encounters an EBUSY, EMFILE, ENFILE, ENOTEMPTY, or EPERM error [1][4]. The default is 0 [1][4]. If an error occurs, Node.js retries the operation with a linear backoff, waiting for an amount of time determined by the retryDelay option [1][4]. This option is ignored if recursive is not set to true [1][4]. retryDelay: This option sets the amount of time in milliseconds to wait between retries. The default is 100 milliseconds [1][4]. Like maxRetries, this option is ignored if the recursive option is not true [1][4]. To achieve behavior similar to the Unix rm -rf command, it is recommended to use fsPromises.rm(path, { recursive: true, force: true }) [1][4]. The method returns a promise that fulfills with undefined upon success [1][4].

Citations:


Detect fs.promises.rm calls.

fs.promises.rm(path, { recursive: true }) is a valid recursive removal API, but the matcher skips it because rm is preceded by a dot. Extend the matcher or use an AST-based scan, and add this exact form to the scanner self-test.

…policy

`config/scripts/rebuild-native-deps.test.mjs` fails on `package (windows)` with
EPERM from the `finally` of "rebuilds a loadable ConPTY native that lacks Orca
job ownership". Every assertion in that test had already passed; the throw is
the cleanup. The test's whole job is to build and load a ConPTY native, and on
Windows a freshly dlopen'd DLL keeps a handle on the directory it came from for
a moment after the child exits — so `rmSync(projectDir, { recursive: true,
force: true })`, which is `maxRetries: 0`, loses the race.

The repo already knows this: `WINDOWS_RM_MAX_RETRIES = 8` in
`src/main/host-tree-removal.ts` and again in `codex-accounts/service.ts`. Only
product code was using it.

Adds `src/shared/windows-transient-lock-removal.ts` as one home for the policy
and moves all 21 raw recursive removals in the Windows CI lane onto it, plus a
boundary test that reads the lane's spec list out of `.github/workflows/pr.yml`
so a new spec cannot hand-roll the removal and reintroduce this.

Census, since the pattern is not confined to that lane: 1,633 recursive
removals across 1,028 files pass no `maxRetries` — 1,368 in tests and fixtures,
265 in product code. Only the Windows lane's 21 are changed here.
…d past `fs.`

Two review findings on this PR.

The policy was about to be stated three times. `host-tree-removal.ts` and
`codex-accounts/service.ts` already each declared `WINDOWS_RM_MAX_RETRIES = 8`,
and this PR's `transientLockRemovalOptions` made a third — in a change whose
whole point is "one retry policy". Both existing sites now import it, and a
ratchet in the module's own spec fails on a fourth declaration.

`removeManagedHomeTreeSync` keeps its unconditional shape deliberately: it
removes WSL-hosted managed homes from this process, so its retries are not
gated on the host being Windows the way `transientLockRemovalOptions()` is.

The lane guard's matcher only understood a bare `rm(` or a literal `fs.`
prefix, so `fsp.rm`, `fsPromises.rm` and `nodeFs.rmSync` — all spellings this
repo already uses — walked past it, and the guard would have gone on reporting
zero offenders. It now accepts any namespace prefix and reads renamed bindings
out of the import clause, with a planted spelling of each form as the proof.
`src/shared/source-scan` exists because four guards had each grown their own
`collectSourceFiles` and drifted — one of them scanned the cross-version e2e
checkouts and reported 21 offenders that were copies of shipped releases. This
ratchet had just become the fifth. It now uses `scanSourceTree`, which also
gets it dot-directory skipping and `/`-normalised paths on Windows for free,
and `stripComments` so a commented-out declaration is not an offender.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/flake-windows-teardown-eperm branch from 1258809 to 4547469 Compare August 30, 2026 03:13
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9875b691-fec6-4a0b-b43b-bdffc70573a6

📥 Commits

Reviewing files that changed from the base of the PR and between ca6401a and 4547469.

📒 Files selected for processing (14)
  • config/scripts/rebuild-native-deps.test.mjs
  • src/main/agent-hooks/windows-hook-payload-delivery.test.ts
  • src/main/cli/wsl-cli-powershell-boundary.test.ts
  • src/main/codex-accounts/service.ts
  • src/main/cursor/hook-service.test.ts
  • src/main/host-tree-removal.ts
  • src/main/orca-profiles/profile-index-store.test.ts
  • src/main/runtime/repo-worktree-admin-fingerprint.test.ts
  • src/main/windows/windows-host-job.win32.test.ts
  • src/shared/child-process/windows-command-line.win32.test.ts
  • src/shared/secure-file-fsync-flags.test.ts
  • src/shared/windows-lane-tree-removal-boundary.test.ts
  • src/shared/windows-transient-lock-removal.test.ts
  • src/shared/windows-transient-lock-removal.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/main/orca-profiles/profile-index-store.test.ts
  • src/main/runtime/repo-worktree-admin-fingerprint.test.ts
  • src/shared/windows-transient-lock-removal.ts
  • src/shared/child-process/windows-command-line.win32.test.ts
  • src/main/agent-hooks/windows-hook-payload-delivery.test.ts
  • src/main/host-tree-removal.ts
  • src/shared/windows-transient-lock-removal.test.ts
  • config/scripts/rebuild-native-deps.test.mjs
  • src/shared/secure-file-fsync-flags.test.ts
  • src/main/codex-accounts/service.ts
  • src/main/cursor/hook-service.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

'g'
)
let match: RegExpExecArray | null
while ((match = call.exec(source)) !== null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='src/shared/windows-lane-tree-removal-boundary.test.ts'

python - <<'PY'
from pathlib import Path
import re

workflow = Path('.github/workflows/pr.yml').read_text()
target = 'src/shared/windows-lane-tree-removal-boundary.test.ts'

start = workflow.find('- name: Test Windows-specific boundaries')
end = workflow.find('\n      - name:', start + 1)
step = workflow[start:] if end == -1 else workflow[start:end]

print(f'listed_in_windows_step={target in step}')

source = Path(target).read_text()
call = re.compile(r'(?<![\w$.])(?:[\w$]+\.)?(?:rmSync|rm)\s*\(')
offenders = []

for match in call.finditer(source):
    depth = 0
    end = match.start() + len(match.group()) - 1
    while end < len(source):
        if source[end] == '(':
            depth += 1
        elif source[end] == ')':
            depth -= 1
            if depth == 0:
                break
        end += 1
    args = source[match.start():end + 1]
    if 'recursive' in args and 'maxRetries' not in args:
        offenders.append(source[:match.start()].count('\n') + 1)

print(f'self_scan_offenders={offenders}')
PY

Repository: stablyai/orca

Length of output: 209


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- repository conventions ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -path '*/learnings/*.md' -o -path '*/architecture/*.md' -o -path '*/conventions/*.md' | sort | while read -r f; do
  echo "--- $f"
  head -80 "$f"
done

printf '%s\n' '--- workflow boundary step ---'
rg -n -A35 -B8 'Test Windows-specific boundaries|windows-lane-tree-removal-boundary|boundary' .github/workflows/pr.yml

printf '%s\n' '--- test file relevant sections ---'
cat -n src/shared/windows-lane-tree-removal-boundary.test.ts | sed -n '1,130p'

printf '%s\n' '--- scanner definitions and callers ---'
rg -n -A35 -B8 'findRawRecursiveRemovals|windows-lane-tree-removal-boundary|spec list|Windows-specific' src .github

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- complete Windows boundary command ---'
sed -n '688,735p' .github/workflows/pr.yml

printf '%s\n' '--- boundary test ---'
cat -n src/shared/windows-lane-tree-removal-boundary.test.ts

printf '%s\n' '--- source-tree scanner ---'
rg -n -A45 -B12 'findRawRecursiveRemovals|recursive.*rm|source-tree-scan|windows-lane-tree-removal' src/shared .github

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- references to the boundary test ---'
rg -n 'windows-lane-tree-removal-boundary|windows lane tree removal' .github package.json config src --glob '!src/shared/windows-lane-tree-removal-boundary.test.ts'

printf '%s\n' '--- workflow test commands near unit-test steps ---'
rg -n -A12 -B8 'vitest run|pnpm test|Test .*unit|Unit test' .github/workflows/pr.yml

printf '%s\n' '--- exact matcher-like calls in Windows-listed source files ---'
python3 - <<'PY'
from pathlib import Path
import re

workflow = Path('.github/workflows/pr.yml').read_text()
start = workflow.index('- name: Test Windows-specific boundaries')
end = workflow.index('\n      - name:', start + 1)
specs = [
    line.strip() for line in workflow[start:end].splitlines()
    if re.fullmatch(r'(?:src|tests|config)/.+\.(?:test|spec)\.(?:ts|tsx|mjs)', line.strip())
]
call = re.compile(r'(?<![\w$.])(?:[\w$]+\.)?(?:rmSync|rm)\s*\(')
for spec in specs:
    source = Path(spec).read_text()
    hits = []
    for m in call.finditer(source):
        # Match the reviewed function's parenthesis scan closely enough to identify
        # comments/string hits and real calls without executing repository code.
        depth = 0
        endpos = m.start() + len(m.group()) - 1
        while endpos < len(source):
            if source[endpos] == '(':
                depth += 1
            elif source[endpos] == ')':
                depth -= 1
                if depth == 0:
                    break
            endpos += 1
        args = source[m.start():endpos + 1]
        if 'recursive' in args and 'maxRetries' not in args:
            hits.append(source.count('\n', 0, m.start()) + 1)
    if hits:
        print(f'{spec}: {hits}')
PY

Repository: stablyai/orca

Length of output: 191


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- workflow test commands near unit-test steps ---'
rg -n -A12 -B8 'vitest run|pnpm test|Test .*unit|Unit test' .github/workflows/pr.yml || true

printf '%s\n' '--- exact matcher-like calls in Windows-listed source files ---'
python3 - <<'PY'
from pathlib import Path
import re

workflow = Path('.github/workflows/pr.yml').read_text()
start = workflow.index('- name: Test Windows-specific boundaries')
end = workflow.index('\n      - name:', start + 1)
specs = [
    line.strip() for line in workflow[start:end].splitlines()
    if re.fullmatch(r'(?:src|tests|config)/.+\.(?:test|spec)\.(?:ts|tsx|mjs)', line.strip())
]
call = re.compile(r'(?<![\w$.])(?:[\w$]+\.)?(?:rmSync|rm)\s*\(')
for spec in specs:
    source = Path(spec).read_text()
    hits = []
    for m in call.finditer(source):
        depth = 0
        endpos = m.start() + len(m.group()) - 1
        while endpos < len(source):
            if source[endpos] == '(':
                depth += 1
            elif source[endpos] == ')':
                depth -= 1
                if depth == 0:
                    break
            endpos += 1
        args = source[m.start():endpos + 1]
        if 'recursive' in args and 'maxRetries' not in args:
            hits.append(source.count('\n', 0, m.start()) + 1)
    if hits:
        print(f'{spec}: {hits}')
PY

Repository: stablyai/orca

Length of output: 7644


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- package test scripts ---'
node - <<'JS'
const pkg = require('./package.json')
for (const [name, value] of Object.entries(pkg.scripts ?? {})) {
  if (/test|vitest/i.test(name) || /test|vitest/i.test(value)) {
    console.log(`${name}: ${value}`)
  }
}
JS

printf '%s\n' '--- main test-job definitions ---'
rg -n -A28 -B10 '^[[:space:]]{2}[A-Za-z0-9_-]+:|name:.*test|vitest|pnpm run test|pnpm test' .github/workflows/pr.yml | sed -n '1,260p'

Repository: stablyai/orca

Length of output: 18066


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -A35 -B12 '^[[:space:]]{2}test:|name:.*test|run:.*pnpm (run )?test|vitest run --config config/vitest.config.ts$' .github/workflows/pr.yml

Repository: stablyai/orca

Length of output: 10223


Add the boundary test to the Windows test command.

The package-wide test runs it, but the Windows-specific command omits it. Add src/shared/windows-lane-tree-removal-boundary.test.ts to that command. If added, prevent the raw matcher from scanning its comments and fixture strings.

🧰 Tools
🪛 OpenGrep (1.26.0)

[ERROR] 70-70: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)

@nwparker

nwparker commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Superseded by #17780, which lands the same Windows-lane removeTreeSync retry policy on current main (this PR was CONFLICTING).

@nwparker

nwparker commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded by #17780.

@nwparker nwparker closed this Sep 1, 2026
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.

2 participants