From 3e80dcb8ef74064c973dd41fb9500554f17a0ebe Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Thu, 30 Jul 2026 02:47:14 -0700 Subject: [PATCH] fix(test): a Vite prefix-match alias silently unresolved a core subpath (greens full-suite shard 1) (#2686) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What `full-suite.yml` shard 1 on main fails with **zero test failures** — it dies on a resolution error: ``` Failed to resolve import "@fusion/core/task-delete-attribution" from "packages/dashboard/app/api/client.ts" ``` **Root cause.** Vite string aliases match by **PREFIX**. So `find: "@fusion/core"` → `core/src/index.ts` rewrites `@fusion/core/task-delete-attribution` into `core/src/index.ts/task-delete-attribution`, which cannot resolve. The narrower subpath alias has to come *first*. The module exists and *is* correctly declared in `packages/core/package.json` exports — this is purely a test-config trap, and `packages/dashboard/vitest.config.ts` already documents it in a comment. Six configs alias `@fusion/dashboard` (whose `app/api/client.ts` imports that browser-safe leaf) while lacking the narrower alias, so they inherited the trap. This carries the same one-line pattern to all six. ## Measured `dependency-graph` — the project actually red on main: | | Test files | Tests collected | |---|---|---| | before | 3 failed \| 17 passed | 147 | | after | **20 passed** | **180** | **33 tests were never collected** — neither passing nor reported as failing. That is the part worth flagging: an unresolved import removes tests from the run silently, and the shard's own summary printed no `Tests N failed` line at all, which is why this red looked like infrastructure noise rather than a real defect. No regressions: `reports` 110, `cli-printing-press` 41, `compound-engineering` 317, **gate 726** — all green. `pnpm lint` clean. `@fusion/desktop` is `1 failed | 264 passed` **both before and after**; verified pre-existing on clean `origin/main` by reverting just that one config and re-running. Cause is `@fusion-plugin-examples/roadmap` entry resolution, unrelated — **flagged, not fixed.** ## Deliberately not changed Engine's *second* `@fusion/core` alias (the `.gate-bundle/core.mjs` entry) is untouched: that lane bundles core on purpose, and pointing it at source would defeat the isolation the gate bundle exists to provide. ## Full-suite triage this came out of (for whoever owns the rest) Reading the four red shards of the last completed run on main (`30523568756`): | Shard | Real cause | Owner | |---|---|---| | 1/4 | **this PR** — resolution error, 0 test failures | — | | 2/4 | 23 failed: `store-wedge-resolution.pg`, `central-archive-secrets`, `task-delete-caller-attribution`, `task-delete-nonblocking-cleanup` | #2669 / #2675 cover the first two | | 3/4 | **watchdog SIGKILL** mid-`@fusion/engine [1/2]` — no test failures, no summary | unowned | | 4/4 | 17 failed, all in `@runfusion/fusion` CLI (`project.test.ts` 8, `task.test.ts` 5, `extension.test.ts` 2, +2) | unowned | Two of the four shard reds contain **no failing test at all**, so "main's full-suite failure count" cannot be read off the shard conclusions — it has to be read off `Tests N failed` summary lines, and shards 1 and 3 emit none. --- packages/desktop/vitest.config.ts | 8 ++++++++ packages/engine/vitest.config.ts | 8 ++++++++ plugins/fusion-plugin-cli-printing-press/vitest.config.ts | 8 ++++++++ .../fusion-plugin-compound-engineering/vitest.config.ts | 8 ++++++++ plugins/fusion-plugin-dependency-graph/vitest.config.ts | 8 ++++++++ plugins/fusion-plugin-reports/vitest.config.ts | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/packages/desktop/vitest.config.ts b/packages/desktop/vitest.config.ts index 7885553dc0..59e5201251 100644 --- a/packages/desktop/vitest.config.ts +++ b/packages/desktop/vitest.config.ts @@ -4,6 +4,14 @@ import { computeMaxWorkers } from "../core/src/__test-utils__/vitest-workers"; const maxWorkers = computeMaxWorkers(); const fusionAliases = { + /* + FNXC:VitestAliases 2026-07-30-13:10: + Must precede the broader `@fusion/core` alias: Vite string aliases match by PREFIX, so that key + rewrites this subpath to `index.ts/task-delete-attribution` and resolution fails. Reached here + transitively — this project aliases `@fusion/dashboard`, and `app/api/client.ts` imports the + browser-safe delete-attribution leaf. + */ + "@fusion/core/task-delete-attribution": resolve(__dirname, "../core/src/task-delete-attribution.ts"), "@fusion/core": resolve(__dirname, "../core/src/index.ts"), "@fusion/dashboard": resolve(__dirname, "../dashboard/src/index.ts"), "@fusion/engine": resolve(__dirname, "../engine/src/index.ts"), diff --git a/packages/engine/vitest.config.ts b/packages/engine/vitest.config.ts index 598f48b7d4..a4ef94013e 100644 --- a/packages/engine/vitest.config.ts +++ b/packages/engine/vitest.config.ts @@ -7,6 +7,14 @@ const maxWorkers = computeMaxWorkers(); export default defineConfig({ resolve: { alias: { + /* + FNXC:VitestAliases 2026-07-30-13:10: + Must precede the broader `@fusion/core` alias: Vite string aliases match by PREFIX, so that key + rewrites this subpath to `index.ts/task-delete-attribution` and resolution fails. Reached here + transitively — this project aliases `@fusion/dashboard`, and `app/api/client.ts` imports the + browser-safe delete-attribution leaf. + */ + "@fusion/core/task-delete-attribution": resolve(__dirname, "../core/src/task-delete-attribution.ts"), "@fusion/core": resolve(__dirname, "../core/src/index.ts"), "@fusion/test-utils": resolve(__dirname, "../core/src/__test-utils__/workspace.ts"), "@fusion/engine": resolve(__dirname, "./src/index.ts"), diff --git a/plugins/fusion-plugin-cli-printing-press/vitest.config.ts b/plugins/fusion-plugin-cli-printing-press/vitest.config.ts index 0712c1116e..e9f4487190 100644 --- a/plugins/fusion-plugin-cli-printing-press/vitest.config.ts +++ b/plugins/fusion-plugin-cli-printing-press/vitest.config.ts @@ -25,6 +25,14 @@ const quarantinedCliPrintingPressTests = [ export default defineConfig({ resolve: { alias: { + /* + FNXC:VitestAliases 2026-07-30-13:10: + Must precede the broader `@fusion/core` alias: Vite string aliases match by PREFIX, so that key + rewrites this subpath to `index.ts/task-delete-attribution` and resolution fails. Reached here + transitively — this project aliases `@fusion/dashboard`, and `app/api/client.ts` imports the + browser-safe delete-attribution leaf. + */ + "@fusion/core/task-delete-attribution": fileURLToPath(new URL("../../packages/core/src/task-delete-attribution.ts", import.meta.url)), "@fusion/core": fileURLToPath(new URL("../../packages/core/src/index.ts", import.meta.url)), "@fusion/plugin-sdk": fileURLToPath(new URL("../../packages/plugin-sdk/src/index.ts", import.meta.url)), "@fusion/dashboard": fileURLToPath(new URL("../../packages/dashboard/app/index.ts", import.meta.url)), diff --git a/plugins/fusion-plugin-compound-engineering/vitest.config.ts b/plugins/fusion-plugin-compound-engineering/vitest.config.ts index 33cf21b46e..4db8348112 100644 --- a/plugins/fusion-plugin-compound-engineering/vitest.config.ts +++ b/plugins/fusion-plugin-compound-engineering/vitest.config.ts @@ -45,6 +45,14 @@ export default defineConfig({ find: /^@fusion-plugin-examples\/compound-engineering$/, replacement: fileURLToPath(new URL("./src/index.ts", import.meta.url)), }, + /* + FNXC:VitestAliases 2026-07-30-13:10: + Must precede the broader `@fusion/core` alias: Vite string aliases match by PREFIX, so that key + rewrites this subpath to `index.ts/task-delete-attribution` and resolution fails. Reached here + transitively — this project aliases `@fusion/dashboard`, and `app/api/client.ts` imports the + browser-safe delete-attribution leaf. + */ + { find: "@fusion/core/task-delete-attribution", replacement: fileURLToPath(new URL("../../packages/core/src/task-delete-attribution.ts", import.meta.url)) }, { find: "@fusion/core", replacement: fileURLToPath(new URL("../../packages/core/src/index.ts", import.meta.url)) }, { find: "@fusion/test-utils/pg-test-harness", diff --git a/plugins/fusion-plugin-dependency-graph/vitest.config.ts b/plugins/fusion-plugin-dependency-graph/vitest.config.ts index bba1943043..c39bbb92ec 100644 --- a/plugins/fusion-plugin-dependency-graph/vitest.config.ts +++ b/plugins/fusion-plugin-dependency-graph/vitest.config.ts @@ -26,6 +26,14 @@ export default defineConfig({ find: /^@fusion-plugin-examples\/dependency-graph$/, replacement: fileURLToPath(new URL("./src/index.ts", import.meta.url)), }, + /* + FNXC:VitestAliases 2026-07-30-13:10: + Must precede the broader `@fusion/core` alias: Vite string aliases match by PREFIX, so that key + rewrites this subpath to `index.ts/task-delete-attribution` and resolution fails. Reached here + transitively — this project aliases `@fusion/dashboard`, and `app/api/client.ts` imports the + browser-safe delete-attribution leaf. + */ + { find: "@fusion/core/task-delete-attribution", replacement: fileURLToPath(new URL("../../packages/core/src/task-delete-attribution.ts", import.meta.url)) }, { find: "@fusion/core", replacement: fileURLToPath(new URL("../../packages/core/src/index.ts", import.meta.url)) }, { find: "@fusion/plugin-sdk", diff --git a/plugins/fusion-plugin-reports/vitest.config.ts b/plugins/fusion-plugin-reports/vitest.config.ts index 8d252eafec..dbfa9b84dc 100644 --- a/plugins/fusion-plugin-reports/vitest.config.ts +++ b/plugins/fusion-plugin-reports/vitest.config.ts @@ -25,6 +25,14 @@ const quarantinedReportsTests = [ export default defineConfig({ resolve: { alias: { + /* + FNXC:VitestAliases 2026-07-30-13:10: + Must precede the broader `@fusion/core` alias: Vite string aliases match by PREFIX, so that key + rewrites this subpath to `index.ts/task-delete-attribution` and resolution fails. Reached here + transitively — this project aliases `@fusion/dashboard`, and `app/api/client.ts` imports the + browser-safe delete-attribution leaf. + */ + "@fusion/core/task-delete-attribution": fileURLToPath(new URL("../../packages/core/src/task-delete-attribution.ts", import.meta.url)), "@fusion/core": fileURLToPath(new URL("../../packages/core/src/index.ts", import.meta.url)), // FNXC:Clipboard 2026-07-12-00:00: The reports plugin imports the dashboard clipboard helper through its package subpath export; keep this exact alias ahead of the package root alias so vitest does not collapse the subpath to src/index.ts. "@fusion/dashboard/app/utils/copyToClipboard": fileURLToPath(new URL("../../packages/dashboard/app/utils/copyToClipboard.ts", import.meta.url)),