test(worktree): align teardown/watch tests with verified-exit behavior (#10115)
- orca-runtime: 'stop cannot be proven' now requires the fresh PTY inventory to still show the pty live (empty inventory proves exit post-#10106). - git-common-watch: swap worktrees dir->file synchronously so no poll tick observes the transient ENOENT window and fabricates a delete. (cherry picked from commit e11736d7e170982eeebe09256eb549446a4f4f7b) Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { appendFile, mkdtemp, mkdir, realpath, rm, writeFile } from 'node:fs/promises'
|
||||
import { rmSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { subscribeViaWatcherProcess } from './parcel-watcher-process'
|
||||
@@ -362,8 +363,11 @@ describe('worktree git-common polling gate (non-darwin)', () => {
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, POLL_MS * 2))
|
||||
const worktreesDir = join(commonDir, 'worktrees')
|
||||
await rm(worktreesDir, { recursive: true, force: true })
|
||||
await writeFile(worktreesDir, 'not-a-dir')
|
||||
// Swap dir -> file synchronously so no event-loop turn (and thus no poll
|
||||
// tick) observes the transient ENOENT window, which would legitimately emit
|
||||
// a delete and defeat the non-ENOENT assertion below.
|
||||
rmSync(worktreesDir, { recursive: true, force: true })
|
||||
writeFileSync(worktreesDir, 'not-a-dir')
|
||||
await new Promise((resolve) => setTimeout(resolve, POLL_MS * 4))
|
||||
|
||||
expect(received.flat()).not.toContainEqual({ type: 'delete', path: entry })
|
||||
|
||||
@@ -36951,7 +36951,11 @@ describe('OrcaRuntimeService', () => {
|
||||
})
|
||||
|
||||
it('does not start Git removal when physical PTY stop cannot be proven', async () => {
|
||||
const localProvider = createProviderStub(async () => [])
|
||||
// A failed stop only rejects when a fresh inventory still shows the PTY
|
||||
// live; keep pty-1 present so the exit cannot be proven.
|
||||
const localProvider = createProviderStub(async () => [
|
||||
{ id: 'pty-1', cwd: '/tmp', title: 'shell' }
|
||||
])
|
||||
const runtime = new OrcaRuntimeService(store, undefined, {
|
||||
getLocalProvider: () => localProvider as never
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user