From 477291a09b35ee91ee9d770ac7444ae85fc981bf Mon Sep 17 00:00:00 2001 From: OrcaWin <293788423+OrcaWin@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:55:29 -0800 Subject: [PATCH] test: remove fixture inventories and diagnostic-only cases --- .../validate-plugin-files.test.mjs | 27 +---- .../script-module-dependencies.test.mjs | 66 ------------- .../source-routing/pr-package-test-paths.mjs | 1 - .../pr-unit-support-routing.test.mjs | 98 ------------------- 4 files changed, 1 insertion(+), 191 deletions(-) delete mode 100644 config/scripts/test-fixtures/script-copy-closure/script-module-dependencies.test.mjs delete mode 100644 config/scripts/workflow/source-routing/pr-unit-support-routing.test.mjs diff --git a/config/scripts/plugin-authoring/content-validation/validate-plugin-files.test.mjs b/config/scripts/plugin-authoring/content-validation/validate-plugin-files.test.mjs index 047a8d72c74..f9ddb0587af 100644 --- a/config/scripts/plugin-authoring/content-validation/validate-plugin-files.test.mjs +++ b/config/scripts/plugin-authoring/content-validation/validate-plugin-files.test.mjs @@ -1,4 +1,4 @@ -import { mkdtemp, rm, writeFile } from 'node:fs/promises' +import { mkdtemp, rm } from 'node:fs/promises' import { tmpdir } from 'node:os' import path from 'node:path' import process from 'node:process' @@ -36,29 +36,4 @@ describe('validate-plugin-files', () => { expect(result.code).toBe(1) expect(result.stderr).toContain('panel/index.html') }, 60_000) - - it('passes a scaffolded plugin, explaining why there is no release entry outside Git', async () => { - const dir = path.join(await tempRoot(), 'dusk') - await createPluginFromTemplate({ dir, template: 'theme', publisher: 'acme' }) - const result = await validate(dir) - expect(result.code, result.stderr).toBe(0) - expect(result.stdout).toContain('not in a Git repository') - }, 60_000) - - it('passes a language pack that translates protected copy, warning that Orca ignores it', async () => { - const dir = path.join(await tempRoot(), 'portuguese') - await createPluginFromTemplate({ dir, template: 'language-pack', publisher: 'acme' }) - await writeFile( - path.join(dir, 'locales', 'pt-BR.json'), - JSON.stringify({ - common: { cancel: 'Cancelar' }, - components: { 'native-chat': { approval: { allow: 'Permitir', deny: 'Negar' } } } - }) - ) - const result = await validate(dir) - expect(result.code, result.stderr).toBe(0) - expect(result.stderr).toContain( - 'warning: contributes.languagePacks "pt-BR" (locales/pt-BR.json): 2 protected strings are ignored' - ) - }, 60_000) }) diff --git a/config/scripts/test-fixtures/script-copy-closure/script-module-dependencies.test.mjs b/config/scripts/test-fixtures/script-copy-closure/script-module-dependencies.test.mjs deleted file mode 100644 index 7e0a827a2ff..00000000000 --- a/config/scripts/test-fixtures/script-copy-closure/script-module-dependencies.test.mjs +++ /dev/null @@ -1,66 +0,0 @@ -import { mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { afterAll, describe, expect, it } from 'vitest' -import { copyScriptWithLocalModules } from './script-module-dependencies.mjs' - -const fixtureDir = mkdtempSync(join(tmpdir(), 'script-module-dependencies-')) - -afterAll(() => { - rmSync(fixtureDir, { recursive: true, force: true }) -}) - -function sourceTree(files) { - const sourceDir = mkdtempSync(join(fixtureDir, 'source-')) - for (const [name, contents] of Object.entries(files)) { - writeFileSync(join(sourceDir, name), contents) - } - return sourceDir -} - -function copiedNames(files, entryName) { - const sourceDir = sourceTree(files) - const destinationDir = join(mkdtempSync(join(fixtureDir, 'dest-')), 'scripts') - copyScriptWithLocalModules(join(sourceDir, entryName), destinationDir) - const names = readdirSync(destinationDir).sort() - for (const name of names) { - expect(readFileSync(join(destinationDir, name), 'utf8'), name).toBe(files[name]) - } - return names -} - -describe('copyScriptWithLocalModules', () => { - it('preserves parent paths for modules shared with the runtime', () => { - const sourceDir = sourceTree({ 'runtime.ts': 'export const value = 42\n' }) - mkdirSync(join(sourceDir, 'scripts')) - writeFileSync(join(sourceDir, 'scripts', 'entry.mjs'), "export { value } from '../runtime'\n") - const destinationRoot = mkdtempSync(join(fixtureDir, 'dest-')) - copyScriptWithLocalModules( - join(sourceDir, 'scripts', 'entry.mjs'), - join(destinationRoot, 'scripts') - ) - expect(readFileSync(join(destinationRoot, 'runtime.ts'), 'utf8')).toBe( - 'export const value = 42\n' - ) - }) - - // Cover require-only CJS gate dependencies so copied fixture fails for target defect, not missing module. - - it('follows a require reached only through an imported module', () => { - const names = copiedNames( - { - 'entry.mjs': "import './middle.cjs'\n", - 'middle.cjs': "require('./leaf.cjs')\n", - 'leaf.cjs': 'module.exports = {}\n' - }, - 'entry.mjs' - ) - expect(names).toContain('leaf.cjs') - }) - - it('terminates on a cycle rather than recursing forever', () => { - expect( - copiedNames({ 'a.mjs': "import './b.mjs'\n", 'b.mjs': "import './a.mjs'\n" }, 'a.mjs') - ).toEqual(['a.mjs', 'b.mjs']) - }) -}) diff --git a/config/scripts/workflow/source-routing/pr-package-test-paths.mjs b/config/scripts/workflow/source-routing/pr-package-test-paths.mjs index 3166e02549d..22cec99aa84 100644 --- a/config/scripts/workflow/source-routing/pr-package-test-paths.mjs +++ b/config/scripts/workflow/source-routing/pr-package-test-paths.mjs @@ -157,7 +157,6 @@ export const WINDOWS_BOUNDARY_TESTS = [ 'config/scripts/native-build/windows/windows-pe-machine.test.mjs', 'config/scripts/native-build/windows/build-windows-cli-launcher.test.mjs', 'config/scripts/desktop-distribution/runtime-verification/verify-packaged-windows-agent-hook.test.mjs', - 'config/scripts/test-fixtures/script-copy-closure/script-module-dependencies.test.mjs', 'src/main/windows/windows-registry-addon.test.ts', 'src/main/daemon/executable-host/windows/testing/daemon-host-process-package.test.ts', 'src/shared/windows-security-addon.win32.test.ts', diff --git a/config/scripts/workflow/source-routing/pr-unit-support-routing.test.mjs b/config/scripts/workflow/source-routing/pr-unit-support-routing.test.mjs deleted file mode 100644 index 7e3a023c4f4..00000000000 --- a/config/scripts/workflow/source-routing/pr-unit-support-routing.test.mjs +++ /dev/null @@ -1,98 +0,0 @@ -import { beforeAll, describe, expect, it } from 'vitest' -import { - buildUnitDependencyGraph, - collectUnitDependencyGraph, - unitConsumers -} from '../../ci/unit-selection/dependency-graph/ci-unit-dependency-graph.mjs' -import { - CROSS_VERSION_WIRE_DIR, - discoverUnitFiles -} from '../../ci/unit-selection/dependency-graph/ci-unit-files.mjs' - -const harness = - 'src/renderer/src/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture.ts' -const structuredSessionHarness = - 'src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.test-harness.tsx' - -const unitHarnesses = [ - harness, - structuredSessionHarness, - 'src/renderer/src/store/slices/editor/editor-slice-test-harness.ts', - 'src/renderer/src/store/slices/browser/browser-slice-test-harness.ts', - 'src/renderer/src/runtime/hosted-terminals/creation/testing/web-runtime-terminal-create.test-fixture.ts', - 'src/renderer/src/runtime/sync-runtime-graph/testing/sync-runtime-graph-test-harness.ts' -] -const supportBridges = new Set([ - // Launch request suites' store rig; it takes the terminal harness's workspace layout. - 'src/renderer/src/runtime/hosted-terminals/creation/agent-launch/web-runtime-agent-launch-options.test-fixture.ts', - 'src/renderer/src/runtime/browser/creation/testing/web-runtime-browser-creation-placement-test-rig.ts', - 'src/renderer/src/components/editor/model-lifetime/retention/editor-model-lifetime-fixture.ts', - // Autosave suites' store rig; it takes the editor harness's tab-layout maps. - 'src/renderer/src/components/editor/autosave/editor-autosave-controller-test-fixture.ts', - // Closed-saving-view save suites' rig; it builds on the autosave rig above. - 'src/renderer/src/components/editor/save/queue/editor-save-closed-view.test-fixture.ts', - // Browser suites' store with main drawing their tabs; it takes the browser harness's store. - 'src/renderer/src/store/slices/browser/browser-slice-drawn-from-main.test-fixture.ts' -]) - -function productConsumers(file, graph, unitFiles) { - return [...unitConsumers([file], graph.reverse)].filter( - (consumer) => - consumer !== file && - !unitFiles.has(consumer) && - !(consumer.startsWith(CROSS_VERSION_WIRE_DIR) && consumer.endsWith('.unit.test.ts')) && - !supportBridges.has(consumer) - ) -} - -describe('unit support import ownership', () => { - let graph - let unitFiles - beforeAll(() => { - graph = collectUnitDependencyGraph() - unitFiles = new Set(discoverUnitFiles()) - }, 60_000) - - it.each(unitHarnesses)('rejects any product consumer of %s', (unitHarness) => { - expect(graph.files.has(unitHarness)).toBe(true) - expect( - [...unitConsumers([unitHarness], graph.reverse)].some((file) => unitFiles.has(file)) - ).toBe(true) - expect(productConsumers(unitHarness, graph, unitFiles)).toEqual([]) - }) - - it.each([ - "import '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'", - "export * from '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'", - "import('@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture')", - "import type { Fixture } from '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'" - ])('detects a product importer using %s', (source) => { - const importer = 'src/renderer/src/runtime/product.ts' - const test = 'src/renderer/src/runtime/ownership.test.ts' - const synthetic = buildUnitDependencyGraph( - new Map([ - [harness, 'export const value = 1'], - [importer, source], - [test, "import './web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'"] - ]) - ) - expect(productConsumers(harness, synthetic, new Set([test]))).toEqual([importer]) - }) - - it('rejects product consumers reached through an audited support bridge', () => { - const bridge = - 'src/renderer/src/components/editor/model-lifetime/retention/editor-model-lifetime-fixture.ts' - const importer = 'src/renderer/src/components/editor/product.ts' - const synthetic = buildUnitDependencyGraph( - new Map([ - [harness, 'export const value = 1'], - [ - bridge, - "import '@/runtime/web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture'" - ], - [importer, "import './model-lifetime/retention/editor-model-lifetime-fixture'"] - ]) - ) - expect(productConsumers(harness, synthetic, new Set())).toEqual([importer]) - }) -})