Skip to content
Open
Show file tree
Hide file tree
Changes from 39 commits
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
85 changes: 83 additions & 2 deletions config/scripts/check-flaky-test-pattern-ratchet.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { execFileSync } from 'node:child_process'
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { runProcessSync } from '@orca/process-host'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import {
changedFileScope,
Expand Down Expand Up @@ -44,6 +45,23 @@ describe('changedFileScope', () => {

describe('listChangedFiles', () => {
let fixture
let home
beforeEach(() => {
home = mkdtempSync(join(tmpdir(), 'flaky-ratchet-home-'))
const config = join(home, 'empty.gitconfig')
writeFileSync(config, '')
for (const key of Object.keys(process.env).filter((key) =>
key.toUpperCase().startsWith('GIT_')
)) {
vi.stubEnv(key, undefined)
}
vi.stubEnv('HOME', home)
vi.stubEnv('USERPROFILE', home)
vi.stubEnv('XDG_CONFIG_HOME', home)
vi.stubEnv('GIT_CONFIG_GLOBAL', config)
vi.stubEnv('GIT_CONFIG_SYSTEM', config)
vi.stubEnv('GIT_CONFIG_NOSYSTEM', '1')
})
const git = (...args) =>
execFileSync(
'git',
Expand All @@ -62,6 +80,7 @@ describe('listChangedFiles', () => {
vi.unstubAllEnvs()
vi.restoreAllMocks()
rmSync(fixture, { recursive: true, force: true })
rmSync(home, { recursive: true, force: true })
})

it('enforces findings in tracked files whose names Git quotes', () => {
Expand Down Expand Up @@ -105,3 +124,65 @@ describe('listChangedFiles', () => {
expect([...listChangedFiles(fixture)]).toEqual(['contribution.txt'])
})
})

describe('listChangedFiles with real Git', () => {
it.each([false, true])('selects the actual base when configured=%s', (configured) => {
const root = mkdtempSync(join(tmpdir(), 'orca-flaky-ratchet-base-'))
try {
const config = join(root, 'empty.gitconfig')
writeFileSync(config, '')
for (const key of Object.keys(process.env).filter((key) =>
key.toUpperCase().startsWith('GIT_')
)) {
vi.stubEnv(key, undefined)
}
vi.stubEnv('GIT_CONFIG_GLOBAL', config)
vi.stubEnv('GIT_CONFIG_SYSTEM', config)
vi.stubEnv('GIT_CONFIG_NOSYSTEM', '1')
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
vi.stubEnv('HOME', root)
vi.stubEnv('USERPROFILE', root)
vi.stubEnv('XDG_CONFIG_HOME', root)
vi.stubEnv('GITHUB_EVENT_NAME', undefined)
vi.stubEnv('ORCA_FLAKY_TEST_RATCHET_ALL', undefined)
const git = (...args) => {
const result = runProcessSync({ program: 'git', args, cwd: root })
expect(result.code, result.stderr).toBe(0)
return result.stdout.trim()
}
const commit = (message) =>
git(
'-c',
'user.name=Test',
'-c',
'user.email=test@example.invalid',
'commit',
'-qm',
message
)
git('init', '--quiet')
git('symbolic-ref', 'HEAD', 'refs/heads/main')
expect(realpathSync.native(git('rev-parse', '--absolute-git-dir'))).toBe(
realpathSync.native(join(root, '.git'))
)
writeFileSync(join(root, 'upstream.test.ts'), 'export const upstream = 0\n')
git('add', 'upstream.test.ts')
commit('fork baseline')
git('update-ref', 'refs/remotes/origin/main', 'HEAD')
writeFileSync(join(root, 'upstream.test.ts'), 'export const upstream = 1\n')
git('add', 'upstream.test.ts')
commit('actual main')
const actualMain = git('rev-parse', 'HEAD')
writeFileSync(join(root, 'feature.test.ts'), 'export const feature = 1\n')
git('add', 'feature.test.ts')
commit('feature')
vi.stubEnv('ORCA_CODE_QUALITY_BASE', configured ? actualMain : undefined)

expect([...listChangedFiles(root)].sort()).toEqual(
configured ? ['feature.test.ts'] : ['feature.test.ts', 'upstream.test.ts']
)
} finally {
vi.unstubAllEnvs()
rmSync(root, { recursive: true, force: true })
}
})
})
101 changes: 98 additions & 3 deletions config/scripts/vitest-node-runtime-boundary.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { globSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { globSync, mkdtempSync, readFileSync, rmSync } from 'node:fs'
import { join, resolve } from 'node:path'
import { tmpdir } from 'node:os'
import { runProcess } from '@orca/process-host'
import ts from 'typescript-api'
import { expect, it } from 'vitest'
import { expect, it, onTestFinished } from 'vitest'
import { discoverUnitFiles } from './ci-unit-files.mjs'
import { getNodeRuntimeInclude } from './vitest-node-runtime-files.mjs'
import { importsSqliteRuntime } from './vitest-sqlite-runtime-scan.mjs'

it('runs Node runtime contracts in Node even when the coordinator uses Bun', () => {
expect(process.versions.bun).toBeUndefined()
Expand Down Expand Up @@ -58,3 +61,95 @@ it('keeps exposed-GC heap measurements in the Node runtime project', () => {
}
expect(missing).toEqual([])
})

it.each([
{
fixture: 'historical release checkout and source fixture',
file: 'tests/e2e/cross-version-wire/qoder-history-search-downgrade.unit.test.ts',
pattern:
/[/\\]tests[/\\]e2e[/\\]cross-version-wire[/\\]qoder-history-search-downgrade\.unit\.test\.ts$/
},
{
fixture: 'indirect native PTY shell fixture',
file: 'src/main/daemon/repro-13767-shell-ready-marker-lost-to-exec.test.ts',
pattern:
/[/\\]src[/\\]main[/\\]daemon[/\\]repro-13767-shell-ready-marker-lost-to-exec\.test\.ts$/
},
{
fixture: 'CLI process-group termination fixture',
file: 'src/main/ipc/preflight-runnable-local-cli.test.ts',
pattern: /[/\\]src[/\\]main[/\\]ipc[/\\]preflight-runnable-local-cli\.test\.ts$/
},
{
fixture: 'Hermes filesystem preservation fixture',
file: 'src/main/hermes/hermes-config-preservation.test.ts',
pattern: /[/\\]src[/\\]main[/\\]hermes[/\\]hermes-config-preservation\.test\.ts$/
},
{
fixture: 'native session-search ownership fixture',
file: 'src/main/ai-vault-search/session-search-current-owner.test.ts',
pattern: /[/\\]src[/\\]main[/\\]ai-vault-search[/\\]session-search-current-owner\.test\.ts$/
},
{
fixture: 'native session-search device dispatch fixture',
file: 'src/main/runtime/runtime-rpc-device-key-dispatch.test.ts',
pattern: /[/\\]src[/\\]main[/\\]runtime[/\\]runtime-rpc-device-key-dispatch\.test\.ts$/
},
{
fixture: 'native session-search relay fixture',
file: 'src/main/runtime/mobile-cloud-relay/mobile-relay-e2ee.integration.test.ts',
pattern:
/[/\\]src[/\\]main[/\\]runtime[/\\]mobile-cloud-relay[/\\]mobile-relay-e2ee\.integration\.test\.ts$/
},
{
fixture: 'renderer sender census filesystem fixture',
file: 'src/renderer/src/runtime/layout-apply-paired-server-guard.test.ts',
pattern:
/[/\\]src[/\\]renderer[/\\]src[/\\]runtime[/\\]layout-apply-paired-server-guard\.test\.ts$/
}
])('collects $fixture exactly once in the Node project', async ({ file, pattern }) => {
const directory = mkdtempSync(join(tmpdir(), 'orca-runtime-list-'))
const output = join(directory, 'files.json')
const collecting = runProcess({
program: process.execPath,
args: [
'config/scripts/run-vitest.mjs',
'list',
'--config',
'config/vitest.config.ts',
file,
'--filesOnly',
`--json=${output}`
],
cwd: process.cwd(),
env: { ...process.env, ORCA_BALANCE_UNIT_SHARDS: '0' },
timeoutMs: 20_000,
detached: true,
terminationBarrier: true
})
// Join the barrier even when its final verification outlives the test body.
onTestFinished(async () => {
try {
await collecting
} finally {
rmSync(directory, { recursive: true, force: true })
}
})
const result = await collecting
expect(result.code, result.stderr).toBe(0)
const collected: unknown = JSON.parse(readFileSync(output, 'utf8'))
expect(collected).toEqual([
expect.objectContaining({
file: expect.stringMatching(pattern),
projectName: 'node-runtime'
})
])
})

it.each([
'src/main/ai-vault-search/session-search-index-pass.test.ts',
'src/main/ai-vault-search/session-search-engine.test.ts',
'src/main/persistence/profile-state/profile-state-store-factory.test.ts'
])('keeps upstream and local SQLite consumers on Node: %s', (file) => {
expect(importsSqliteRuntime(file, readFileSync(file, 'utf8'))).toBe(true)
})
17 changes: 17 additions & 0 deletions config/scripts/vitest-node-runtime-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@ import { findSqliteRuntimeTests } from './vitest-sqlite-runtime-scan.mjs'
// SQLite publication, native bindings, worker IPC, socket liveness, and V8 retention use Node.
const NODE_RUNTIME_INCLUDE = [
'src/main/runtime/structured-agent-cli-writers.test.ts',
// Native PTY callbacks and host filesystem/event-loop budgets use Node's implementation.
'src/main/shell-startup-feature-channel.test.ts',
'src/main/codex/codex-session-index-heal-state.test.ts',
'src/main/runtime/terminal/recovery/replaced-pane-handle-recovery.test.ts',
// The complete renderer sender census keeps Node's synchronous filesystem budget.
'src/renderer/src/runtime/layout-apply-paired-server-guard.test.ts',
// Preserve exact Node filesystem inode, mode, and timestamp observations.
'src/main/hermes/hermes-config-preservation.test.ts',
'config/scripts/vitest-sqlite-runtime-boundary.test.ts',
// Historical releases retain the application's Node filesystem and native-module semantics.
'tests/e2e/cross-version-wire/**/*.unit.test.ts',
'config/scripts/cloud-security-history-workflow.test.mjs',
'config/scripts/skill-recipe-shell.test.mjs',
'src/main/ssh/legacy-relay/ssh-relay-endpoint-incumbent-shell.integration.test.ts',
'src/main/ssh/ssh-remote-commands.test.ts',
'src/packages/process-host/src/run-process.test.ts',
// CLI probes assert the same Node process-group termination barrier.
'src/main/ipc/preflight-runnable-local-cli.test.ts',
'tests/e2e/cursor-quota-transport.unit.test.ts',
'tests/e2e/helpers/electron-process-shutdown.unit.test.ts',
'src/main/ai-vault-search/session-search-index-writer.test.ts',
Expand Down Expand Up @@ -45,6 +57,9 @@ const NODE_RUNTIME_INCLUDE = [
'src/main/runtime/worker-terminal-wrap-provenance.test.ts',
'tests/e2e/cross-version-wire/agent-session-clear-old-client.unit.test.ts',
'tests/e2e/cross-version-wire/agent-session-clear-old-tab-mirror.unit.test.ts',
// Released host modules import native dependencies outside this checkout's static scan.
'tests/e2e/cross-version-wire/reported-lossy-initial-snapshot.unit.test.ts',
'tests/e2e/cross-version-wire/agent-session-resume-marker-downgrade.unit.test.ts',
'tests/e2e/cross-version-wire/host-model-catalog-released-phone.unit.test.ts',
'src/main/acp/acp-structured-host-live-listing.test.ts',
'src/main/acp/acp-structured-host-configured-default.test.ts',
Expand Down Expand Up @@ -93,6 +108,8 @@ const NODE_RUNTIME_INCLUDE = [
'src/main/automations/automation-worker-durability.test.ts',
'src/**/*.node-pty.test.ts',
'src/**/node-pty-*.test.ts',
// The shell-readiness repro reaches native PTY callbacks through createPtySubprocess.
'src/main/daemon/repro-13767-shell-ready-marker-lost-to-exec.test.ts',
'src/**/*.live-shell.test.ts',
'src/**/*real-pty*.test.ts',
'src/**/*-native.test.ts',
Expand Down
5 changes: 5 additions & 0 deletions config/scripts/vitest-sqlite-runtime-scan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const SQLITE_HARNESSES = new Set([
'terminal-topology-profile-fixture',
'acknowledged-terminal-tab-retirement-fixture'
])
SQLITE_HARNESSES.add('session-search-indexer-test-fixture')
SQLITE_HARNESSES.add('session-search-engine-test-fixture')
export const SQLITE_MODULES = [
'src/main/sqlite/sync-database',
'src/main/persistence/profile-state/profile-state-sqlite-authority',
Expand All @@ -31,6 +33,9 @@ export const SQLITE_MODULES = [
'src/main/runtime/structured-agent-session-runtime',
'src/main/runtime/agent-session-record-store-slot'
]
if (!SQLITE_MODULES.includes('src/main/persistence/profile-state/profile-state-database')) {
SQLITE_MODULES.push('src/main/persistence/profile-state/profile-state-database')
}
const SQLITE_MODULE_PATHS = new Set(SQLITE_MODULES.map((module) => resolve(root, module)))
// A cheap superset of the parse below; a bare 'db' would match nearly every file.
const SQLITE_MODULE_NAMES = [
Expand Down
Loading