test(wsl): run contained-delete script under sh in Linux CI - #18349
test(wsl): run contained-delete script under sh in Linux CI#18349fettpl wants to merge 1 commit into
Conversation
Execute WSL_CONTAINED_DELETE_SCRIPT with production argv on Linux so kind, symlink, missing-leaf, and happy-path behavior cannot regress behind mocked execFile. Skip non-Linux hosts: the script needs /proc/self/cwd and GNU stat. Fixes stablyai#18284
|
Warning Review limit reachedNext included review available in 46 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
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 |
There was a problem hiding this comment.
ℹ️ No critical issues — one optional coverage note below.
Reviewed changes
src/main/wsl-contained-delete.script.test.ts— a new Linux-gated integration test that builds production argv viacontainedDeleteCommandand runs the realWSL_CONTAINED_DELETE_SCRIPTundersh(throughrunProcess,shell: false), asserting filesystem side effects for four cases: directory-leaf delete,kindmismatch rejection, intermediate-symlink escape rejection, and missing-leaf no-op.
I ran pnpm exec vitest run --config config/vitest.config.ts src/main/wsl-contained-delete.script.test.ts on this Linux runner — 4/4 passed, and the assertions are tight against real filesystem side effects (deleted leaf is gone, outside secret survives, exit 65 + rejection marker on stderr), so this genuinely fails on a script regression rather than passing vacuously.
ℹ️ Non-recursive (regular file / rm -f) branch is not exercised
All four cases pass recursive: true, so the script's expected_kind='regular file' → rm -f -- "$leaf_path" success path (the else at src/main/wsl-contained-delete.ts:72) never runs end-to-end. That branch is production-relevant — deleting individual files under an approved root (e.g. session.json) is a real call path — and the existing argv-only tests in wsl-unc-delete.test.ts pin its argv but never execute the script, so a regression in the rm -f branch would still ship green. Consider adding one non-recursive file-delete case.
Technical details
# Add a non-recursive (regular file) delete case
## Affected sites
- src/main/wsl-contained-delete.script.test.ts:60 — every `it` case calls `runContainedDelete` with `true`
## Required outcome
- Exercise the `expected_kind = 'regular file'` → `rm -f --` path by calling `runContainedDelete(leaf, approvedRoot, false)` on a regular file and asserting `code === 0`, the file is gone, and an outside survivor is untouched.
## Suggested approach
- Add one `it('deletes an approved regular-file leaf')` case mirroring the happy path with a file plus `recursive: false`.DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ELI5
The WSL contained-delete helper is a real
shprogram that walks approved roots then deletes one leaf. Default tests only check the argv we would pass towsl.exe; they never run the script. This PR runs that script undershon Linux CI so a broken kind/symlink/missing-leaf path fails the unit shard instead of shipping green.What Changed
src/main/wsl-contained-delete.script.test.ts.containedDeleteCommand, thenrunProcesssshwith that argv (noshell: true, no mockedexecFile).ORCA_WSL_DELETE_REJECT:kind), intermediate symlink escape (ORCA_WSL_DELETE_REJECT:symlink, outside leaf survives), missing leaf (exit 0 no-op).describe.skipIf(process.platform !== 'linux')— the script uses/proc/self/cwd,/proc/self/fd, and GNUstat -Lc, which Darwin and Windows do not provide. Ubuntu unit shards still run it. Existingwsl-unc-delete.test.tsargv tests are unchanged.Why
PR unit tests run on
ubuntu-latest. MockedexecFilecannot catch a regression inWSL_CONTAINED_DELETE_SCRIPT. The script is generic POSIX aside from Linux/proc+ GNUstat, so Linux CI can execute it withoutwsl.exeorORCA_REAL_WSL_DELETE_TEST.Linked Issue
Fixes #18284
Visual Proof
N/A (no visual change). Tests only; no UI, layout, or renderer change.
Testing
Verification:
pnpm test src/main/wsl-contained-delete.script.test.ts— 4 skipped on Darwin (linux-only gate)pnpm test src/main/wsl-unc-delete.test.ts— 9 passedpnpm tc:node— exit 0pnpm run check:code-quality:changed— 0 findingsnode:22-bookworm): the same four cases viacontainedDeleteCommand+shall passed (happy path,kind,symlink,missing leaf)Platforms: macOS (skip path) and Linux (Docker,
/proc+ GNUstat). Windows skipped by the linux-only gate. SSH not exercised; this is a local CI characterization of a POSIX script.AI Disclosure
Review
path.join;containedDeleteCommandstill emits POSIX components. Spawn goes throughrunProcess(shell: false, programsh). NometaKey.shin Linux CI. Loss of contact is not involved.os.tmpdir()directory; cleanup refuses paths outside that tmp root. The symlink case asserts an outside leaf is not deleted. Tests neverrm -rf /and never target the approved root itself (containedDeleteCommandreturns null for that).shinvocations with a 10s timeout; no extra CI workflow.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Did not change
WSL_CONTAINED_DELETE_SCRIPT. Did not enableORCA_REAL_WSL_DELETE_TESTon Windows CI. Did not commitplans/.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)