mirror of
https://github.com/stablyai/orca.git
synced 2026-10-24 16:03:45 +00:00
Fix ssh watcher isolation (#8463)
* fix(ssh): isolate relay filesystem watchers
* Fix relay watcher fault-harness pid file and in-process fallback isolati
- Use exclusive ('wx') creation for the fault-harness pid file so a leaked
ORCA_WATCHER_CHILD_PID_FILE env var can't clobber an existing file, and
have the harness remove the file after reading a replacement pid.
- Force useInProcessVitestFallback to false in the relay watcher pool so a
leaked VITEST env var can never load the native watcher addon in-process
on the relay; fail closed instead when the isolated child is missing.
- Thread an injectable RelayWatcherProcessPool into FsHandler/
RelayFilesystemWatchRegistry for tests, and add coverage for both fixes.
This commit is contained in:
@@ -7,6 +7,7 @@ import * as fs from 'node:fs/promises'
|
||||
import * as path from 'node:path'
|
||||
import { mkdtempSync, writeFileSync, mkdirSync, symlinkSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { subscribeWithInProcessWatcher } from '../main/ipc/parcel-watcher-in-process-fallback'
|
||||
|
||||
const { mockSubscribe } = vi.hoisted(() => ({
|
||||
mockSubscribe: vi.fn()
|
||||
@@ -121,7 +122,11 @@ describe('FsHandler', () => {
|
||||
tmpDir = mkdtempSync(path.join(tmpdir(), 'relay-fs-'))
|
||||
dispatcher = createMockDispatcher()
|
||||
const ctx = new RelayContext()
|
||||
handler = new FsHandler(dispatcher as unknown as RelayDispatcher, ctx)
|
||||
handler = new FsHandler(dispatcher as unknown as RelayDispatcher, ctx, {
|
||||
dispose: vi.fn(),
|
||||
forgetRoot: vi.fn(),
|
||||
subscribe: subscribeWithInProcessWatcher
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
Reference in New Issue
Block a user