Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
111cf3f
test: isolate repository fixtures from host and worker state
Oct 25, 2026
6bfed46
Merge upstream main and retain its census retirement
Oct 25, 2026
dbccf5b
test: isolate Git fixture repository selection
Oct 25, 2026
123e48a
test: settle shared fixture imports before teardown
Oct 25, 2026
f42cae9
test: await activation fixture imports before resetting state
Oct 25, 2026
09d079c
test: isolate fixture Git configuration from host signing and filters
Oct 25, 2026
a8a89f7
Keep inline split fixture from probing a real repository
Oct 25, 2026
b7068d6
Isolate runtime probes and finish DNS fixture shutdown
Oct 25, 2026
20c0dc8
Await native watcher teardown and state mutation readiness in fixtures
Oct 25, 2026
edf893a
Assert native watcher release starts before fixture deletion
Oct 25, 2026
a0f875b
Join native fixture cleanup after interrupted verification
Oct 25, 2026
c56478f
test: await rejected SOCKS client shutdown
Oct 25, 2026
6d1856b
Canonicalize real Git fixture paths with the native filesystem resolver
Oct 25, 2026
4c04ce3
Keep rejected stress clients writable across peer FIN
Oct 25, 2026
0f3226e
Wait for the child startup gate before releasing the readiness probe
Oct 25, 2026
76e9a1d
Isolate real Git divergence probes from inherited repository state
Oct 25, 2026
f56ba0d
Settle rejected watcher setup before removing native test fixtures
Oct 25, 2026
ff648c5
Settle every native watcher release before reporting fixture cleanup …
Oct 25, 2026
61c56f9
Merge main and honor retired browser probe tests
Oct 26, 2026
eb7f940
Honor the configured main base in the flaky-test ratchet
Oct 27, 2026
87bad09
Keep the pairing encoder import used by WSL rollback coverage
Oct 27, 2026
6073054
Explain the unchanged real-child startup deadline
Oct 27, 2026
af9c705
Merge main and reuse upstream WSL test connector setup
Oct 27, 2026
78a5eb0
Run native host regression contracts in the Node runtime
Oct 27, 2026
b0f0e50
Merge upstream main typecheck repair for fixtures
Oct 27, 2026
4f8f462
test: run CLI and filesystem preservation contracts in Node
Oct 27, 2026
7e6774b
test: classify native session-search and sender census runtimes
Oct 27, 2026
a30888a
Merge upstream flaky-test base fix and retain isolated Git regressions
Oct 27, 2026
f6ff565
test: align startup polling and verify real CLI timeouts
Oct 27, 2026
9a86c7d
Merge upstream Git path handling and strengthen hostile fixture inputs
Oct 27, 2026
3b65d5f
test: keep historical release fixtures on the application runtime
Oct 28, 2026
3ef1096
test: isolate runtime collection from shard exclusions
Oct 28, 2026
8ddcce3
test: isolate Git fixture homes and repository overrides
Oct 28, 2026
9a38405
test: scope the ratchet helper to owned Git state
Oct 28, 2026
5f5ae37
test: separate native SQLite extensions from upstream registries
Oct 28, 2026
8f0d49c
test: join mutation process groups before fixture teardown
Oct 28, 2026
3fad417
test: treat quiescent zombie groups as stopped mutation work
Oct 28, 2026
5005506
test: join collector teardown and match preload mock contract
Oct 28, 2026
0420767
test: join late mutation groups and collector cleanup lifecycle
Oct 29, 2026
f6d31ef
test: validate owned PID publication before group lookup
Oct 29, 2026
b3cbfd0
test: preserve store cleanup and complete launch metadata fixtures
Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 39 additions & 14 deletions config/scripts/zcode-credential-workflow.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -121,27 +121,46 @@ function executeScope(directory, overrides = {}) {
}

// The workflow owns Bash execution on Windows; this contract executes the same source on Unix.
it.skipIf(process.platform === 'win32')(
'selects the original path groups, including deletions and renames',
() => {
it.skipIf(process.platform === 'win32').each([
['default caller', {}],
[
'caller identity',
{
GIT_AUTHOR_NAME: 'Caller',
GIT_AUTHOR_EMAIL: 'caller@example.test',
GIT_COMMITTER_NAME: 'Caller',
GIT_COMMITTER_EMAIL: 'caller@example.test'
}
]
])(
'selects the original path groups, including deletions and renames (%s)',
(_label, inheritedIdentity) => {
const directory = mkdtempSync(join(tmpdir(), 'orca-zcode-workflow-'))
const git = (args) => execFileSync('git', args, { cwd: directory, stdio: 'pipe' })
const git = (args) =>
execFileSync('git', args, {
cwd: directory,
stdio: 'pipe',
env: {
...process.env,
...inheritedIdentity,
GIT_AUTHOR_NAME: 'Fixture',
GIT_AUTHOR_EMAIL: 'fixture@example.test',
GIT_COMMITTER_NAME: 'Fixture',
GIT_COMMITTER_EMAIL: 'fixture@example.test'
}
})
const write = (file, value) => {
mkdirSync(dirname(join(directory, file)), { recursive: true })
writeFileSync(join(directory, file), value)
}
let parent
const commit = () => {
git(['add', '-A'])
git([
'-c',
'user.name=Fixture',
'-c',
'user.email=fixture@example.test',
'commit',
'--allow-empty',
'-qm',
'fixture'
])
const tree = git(['write-tree']).toString().trim()
parent = git(['commit-tree', tree, ...(parent ? ['-p', parent] : []), '-m', 'fixture'])
.toString()
.trim()
git(['update-ref', 'HEAD', parent])
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
const cases = [
['src/main/zcode/credentials.ts', true, true],
Expand All @@ -160,6 +179,12 @@ it.skipIf(process.platform === 'win32')(
git(['init', '-q'])
write('README.md', 'fixture')
commit()
expect(git(['reflog', 'show', '--format=%gn <%ge>', '-1', 'HEAD']).toString().trim()).toBe(
'Fixture <fixture@example.test>'
)
expect(git(['show', '-s', '--format=%an <%ae>', 'HEAD']).toString().trim()).toBe(
'Fixture <fixture@example.test>'
)
expect(executeScope(directory)).toEqual({ account: 'true', credentials: 'true' })
for (const [file, runsAccount, runsCredentials] of cases) {
write(file, 'first')
Expand Down
55 changes: 41 additions & 14 deletions src/main/daemon/node-pty-fd-leak.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
import { execFileSync, spawn } from 'node:child_process'
import { once } from 'node:events'
import { existsSync, readdirSync, readFileSync, readlinkSync, renameSync } from 'node:fs'
import {
copyFileSync,
cpSync,
existsSync,
mkdirSync,
mkdtempSync,
readdirSync,
readFileSync,
readlinkSync,
rmSync
} from 'node:fs'
import { createRequire } from 'node:module'
import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import { setTimeout as delay } from 'node:timers/promises'
import * as pty from 'node-pty'
import { describe, expect, it } from 'vitest'
import { getNodePtySpawnHelperCandidates } from '../providers/local-pty-utils'

const require = createRequire(import.meta.url)

function currentRevokedFdCount(): number {
return execFileSync('lsof', ['-p', String(process.pid)], { encoding: 'utf8' })
.split('\n')
Expand All @@ -24,6 +39,26 @@ function getExistingSpawnHelper(): string {
return helperPath as string
}

/** Exercise the real native failure path without renaming another worker's helper. */
function createPtyWithoutSpawnHelper(helperPath: string): {
spawn: typeof pty.spawn
dispose: () => void
} {
const root = mkdtempSync(join(tmpdir(), 'orca-pty-no-helper-'))
const dispose = (): void => rmSync(root, { recursive: true, force: true })
try {
cpSync(dirname(require.resolve('node-pty')), join(root, 'lib'), { recursive: true })
const nativeDir = join(root, 'build', 'Release')
mkdirSync(nativeDir, { recursive: true })
copyFileSync(join(dirname(helperPath), 'pty.node'), join(nativeDir, 'pty.node'))
const isolatedPty: typeof pty = require(join(root, 'lib', 'index.js'))
return { spawn: isolatedPty.spawn, dispose }
} catch (error) {
dispose()
throw error
}
}

async function spawnExitingPty(index: number): Promise<void> {
const proc = pty.spawn('/bin/sh', ['-c', 'exit 0'], {
name: 'xterm-256color',
Expand Down Expand Up @@ -57,32 +92,24 @@ describeOnDarwin('node-pty macOS spawn fd handling', () => {

it('does not leak fds when native posix_spawn setup fails', async () => {
const helperPath = getExistingSpawnHelper()
const hiddenHelperPath = `${helperPath}.orca-test-hidden`
expect(existsSync(hiddenHelperPath)).toBe(false)

const isolatedPty = createPtyWithoutSpawnHelper(helperPath)
const before = currentOpenFdCount()
renameSync(helperPath, hiddenHelperPath)
const restoreHelper = (): void => {
if (existsSync(hiddenHelperPath) && !existsSync(helperPath)) {
renameSync(hiddenHelperPath, helperPath)
}
}
process.on('exit', restoreHelper)
try {
for (let i = 0; i < 20; i++) {
expect(() =>
pty.spawn('/bin/sh', ['-c', 'exit 0'], {
isolatedPty.spawn('/bin/sh', ['-c', 'exit 0'], {
name: 'xterm-256color',
cols: 80,
rows: 24,
cwd: process.cwd(),
env: { ...process.env, ORCA_FD_LEAK_TEST_INDEX: String(i) }
})
).toThrow(/node-pty: posix_spawn failed: ENOENT/)
// A failure-injection fixture must not disable the helper used by other test workers.
expect(existsSync(helperPath)).toBe(true)
}
} finally {
restoreHelper()
process.off('exit', restoreHelper)
isolatedPty.dispose()
}

await delay(500)
Expand Down
3 changes: 1 addition & 2 deletions src/main/emulator/serve-sim-kill-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ vi.mock('electron', () => ({ app: {} }))
import { serveSimKillArgs } from './serve-sim-execution'

const SERVE_SIM_ENTRY = join(
dirname(createRequire(import.meta.url).resolve('serve-sim/package.json')),
'dist',
dirname(createRequire(import.meta.url).resolve('serve-sim/middleware')),
'serve-sim.js'
)
const DEVICE_A = 'AAAAAAAA-0000-0000-0000-000000000001'
Expand Down
12 changes: 11 additions & 1 deletion src/main/git/worktree-base-divergence-real-git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,20 @@ async function createRepo(): Promise<string> {
let emptyCommitSequence = 0

function commitEmpty(repoPath: string, count: number): void {
const tree = git(repoPath, ['write-tree'])
let parent = git(repoPath, ['rev-parse', 'HEAD'])
for (let index = 0; index < count; index += 1) {
emptyCommitSequence += 1
git(repoPath, ['commit', '--quiet', '--allow-empty', '-m', `commit ${emptyCommitSequence}`])
parent = git(repoPath, [
'commit-tree',
tree,
'-p',
parent,
'-m',
`commit ${emptyCommitSequence}`
])
}
git(repoPath, ['update-ref', 'HEAD', parent])
}

afterEach(async () => {
Expand Down
24 changes: 23 additions & 1 deletion src/main/runtime/terminal/surface/pty-pane-copy-census.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ function enclosingFunctionName(node: ts.Node): string | null {

type Census = { sites: { site: string; allowed: boolean }[]; unguarded: string[] }

/** Keep every production file, including ones reached only through test imports. */
function collectProductionRoots(
rootNames: readonly string[],
options: ts.CompilerOptions
): string[] {
// Parsing discovers the original production inventory without building types for all test trees.
// Return only names so this temporary program can be collected before type checking starts.
return ts
.createProgram({ rootNames, options })
.getSourceFiles()
.filter((source) => isProductionFile(source.fileName))
.map((source) => source.fileName)
}

function collectCopyAccesses(): Census {
const configPath = path.join(ROOT, 'config/tsconfig.node.json')
const parsed = ts.getParsedCommandLineOfConfigFile(
Expand All @@ -63,7 +77,15 @@ function collectCopyAccesses(): Census {
if (!parsed) {
throw new Error('cannot read config/tsconfig.node.json')
}
const program = ts.createProgram({ rootNames: parsed.fileNames, options: parsed.options })
const rootNames = collectProductionRoots(parsed.fileNames, parsed.options)
const program = ts.createProgram({ rootNames, options: parsed.options })
expect(
program
.getSourceFiles()
.filter((source) => isProductionFile(source.fileName))
.map((source) => source.fileName)
.sort()
).toEqual([...rootNames].sort())
const checker = program.getTypeChecker()
const recordSource = program.getSourceFile(RECORD_FILE)
if (!recordSource) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @vitest-environment happy-dom
import { act, cleanup, fireEvent, render } from '@testing-library/react'
import { act, cleanup, fireEvent, render, waitFor } from '@testing-library/react'
import { afterEach, expect, it, vi } from 'vitest'
import type { Editor } from '@tiptap/react'
import type * as EditorInstance from './useRichMarkdownEditorInstance'
Expand Down Expand Up @@ -61,7 +61,7 @@ it.each(['outside', 'null', 'inside'] as const)(
headerSlot={<input aria-label="inside" />}
/>
)
await act(async () => {})
await waitFor(() => expect(live.editor?.isInitialized).toBe(true))
const editor = live.editor
const root = view.container.querySelector('.rich-markdown-editor-shell')
if (!editor || !root) {
Expand Down