From bcaed523cd4a6e37f1c80ff7323b00d078d00700 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 14 Oct 2026 20:22:13 -0700 Subject: [PATCH] ci: contain persistent transforms and trim model overhead (#28948) --- config/scripts/ci-shard-assignment.test.mjs | 17 +++++++++++++++++ config/vitest.config.ts | 3 ++- ...e-terminal-input-delivery-model.unit.test.ts | 11 +++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/config/scripts/ci-shard-assignment.test.mjs b/config/scripts/ci-shard-assignment.test.mjs index 5c83bdc272a..44ccf5d4d4f 100644 --- a/config/scripts/ci-shard-assignment.test.mjs +++ b/config/scripts/ci-shard-assignment.test.mjs @@ -100,6 +100,23 @@ describe('timing-weighted shard selection', () => { } }) + it.each([ + { name: 'absent', path: undefined, enabled: false }, + { name: 'empty', path: '', enabled: false }, + { name: 'explicit', path: join(tmpdir(), 'orca-unit-cache-experiment'), enabled: true } + ])( + 'uses persistent transforms only with an explicit cache path ($name)', + async ({ path, enabled }) => { + vi.stubEnv('ORCA_UNIT_MODULE_CACHE_PATH', path) + vi.resetModules() + const { default: config } = await import('../vitest.config') + for (const test of [config.test, ...config.test.projects.map((project) => project.test)]) { + expect(test.fsModuleCache).toBe(enabled) + expect(test.fsModuleCachePath).toBe(enabled ? path : undefined) + } + } + ) + it('keeps nested/serial E2E files atomic and fails closed on discovery errors', () => { const spec = (id, file) => ({ id, file, tests: [{ projectName: 'electron-headless' }] }) const report = { diff --git a/config/vitest.config.ts b/config/vitest.config.ts index 1485f61565d..4ab7a3750ad 100644 --- a/config/vitest.config.ts +++ b/config/vitest.config.ts @@ -29,7 +29,8 @@ const transforms = { const testOptions = { environment: 'node', clearMocks: false, - fsModuleCache: true, + // Persistent transforms can miss source additions; only explicit cache experiments opt in. + fsModuleCache: Boolean(process.env.ORCA_UNIT_MODULE_CACHE_PATH), ...(process.env.ORCA_UNIT_MODULE_CACHE_PATH ? { fsModuleCachePath: process.env.ORCA_UNIT_MODULE_CACHE_PATH } : {}), diff --git a/tests/e2e/remote-terminal-input-delivery-model.unit.test.ts b/tests/e2e/remote-terminal-input-delivery-model.unit.test.ts index ffc7fe4a9a6..9bed931217a 100644 --- a/tests/e2e/remote-terminal-input-delivery-model.unit.test.ts +++ b/tests/e2e/remote-terminal-input-delivery-model.unit.test.ts @@ -372,7 +372,7 @@ async function runSchedule(seed: number, stats: Stats): Promise { const arrived = checkPty(ptyWrites.join(''), ops, seed) for (const op of ops) { // A write the pane reported applied really reached the PTY, whole. - if (op.result === true) { + if (op.result === true && !arrived.has(op.id)) { expect(arrived.has(op.id), `seed ${seed} op ${op.id} reported applied`).toBe(true) } } @@ -389,15 +389,18 @@ function checkPty(pty: string, ops: readonly Op[], seed: number): Set { const arrived = new Set() let position = 0 for (const op of ops) { - const where = `seed ${seed} op ${op.id} (${op.status}) at ${position}: ${JSON.stringify(pty.slice(position, position + 40))}` + const where = (): string => + `seed ${seed} op ${op.id} (${op.status}) at ${position}: ${JSON.stringify(pty.slice(position, position + 40))}` if (pty.startsWith(op.text, position)) { - expect(op.status, where).not.toBe('forbidden') + if (op.status === 'forbidden') { + expect(op.status, where()).not.toBe('forbidden') + } arrived.add(op.id) position += op.text.length continue } if (op.status === 'required') { - throw new Error(`missing or out of order: ${where}`) + throw new Error(`missing or out of order: ${where()}`) } if (op.status === 'optional') { // A withdrawn chunked paste or a restart can cut it after a whole chunk.