Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 24 additions & 3 deletions packages/dashboard/src/__tests__/routes-automation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ function createMockStore(overrides: Partial<TaskStore> = {}): TaskStore {
updatePrInfo: vi.fn().mockResolvedValue(undefined),
updateIssueInfo: vi.fn().mockResolvedValue(undefined),
getRootDir: vi.fn().mockReturnValue("/fake/root"),
/*
FNXC:DashboardTests 2026-07-18-09:45:
Backup automation path calls resolveGlobalBackupRoot(store) which requires
getGlobalSettingsDir. Full-suite shard 4 failed FN-7537 manual backup parity
with "store.getGlobalSettingsDir is not a function" after product drift.
*/
getGlobalSettingsDir: vi.fn().mockReturnValue("/fake/global/.fusion"),
listWorkflowSteps: vi.fn().mockResolvedValue([]),
createWorkflowStep: vi.fn(),
getWorkflowStep: vi.fn(),
Expand Down Expand Up @@ -1402,7 +1409,15 @@ describe("Automation routes", () => {
...FAKE_SCHEDULE,
command: "fn backup --create",
});
const store = createMockStore({ getFusionDir: vi.fn().mockReturnValue(fusionDir) } as any);
/*
FNXC:DashboardTests 2026-07-18-09:45:
resolveGlobalBackupRoot reads getGlobalSettingsDir (not getFusionDir). Point both
at the temp fixture so FN-7537 still asserts the in-process backup intercept.
*/
const store = createMockStore({
getFusionDir: vi.fn().mockReturnValue(fusionDir),
getGlobalSettingsDir: vi.fn().mockReturnValue(fusionDir),
} as any);
const app = express();
app.use(express.json());
app.use("/api", createApiRoutes(store, { automationStore: mockStore as any }));
Expand Down Expand Up @@ -1445,7 +1460,10 @@ describe("Automation routes", () => {
},
],
});
const store = createMockStore({ getFusionDir: vi.fn().mockReturnValue(fusionDir) } as any);
const store = createMockStore({
getFusionDir: vi.fn().mockReturnValue(fusionDir),
getGlobalSettingsDir: vi.fn().mockReturnValue(fusionDir),
} as any);
const app = express();
app.use(express.json());
app.use("/api", createApiRoutes(store, { automationStore: mockStore as any }));
Expand All @@ -1472,7 +1490,10 @@ describe("Automation routes", () => {
...FAKE_SCHEDULE,
command: "fn backup --create",
});
const store = createMockStore({ getFusionDir: vi.fn().mockReturnValue(fusionDir) } as any);
const store = createMockStore({
getFusionDir: vi.fn().mockReturnValue(fusionDir),
getGlobalSettingsDir: vi.fn().mockReturnValue(fusionDir),
} as any);
const app = express();
app.use(express.json());
app.use("/api", createApiRoutes(store, { automationStore: mockStore as any }));
Expand Down
12 changes: 11 additions & 1 deletion packages/dashboard/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,19 @@ export default defineConfig({
__dirname,
"../../plugins/fusion-plugin-grok-runtime/src/index.ts",
),
/*
FNXC:DashboardTests 2026-07-18-09:45:
Alias Claude runtime to probes-entry (probe + model discovery only), not the full
ACP index — same class as CLI #2292. Importing index pulls @agentclientprotocol/sdk
and breaks dashboard-api-quality under source-checkout full-suite resolution.
*/
"@fusion-plugin-examples/claude-runtime": resolve(
__dirname,
"../../plugins/fusion-plugin-claude-runtime/src/index.ts",
"../../plugins/fusion-plugin-claude-runtime/src/probes-entry.ts",
),
"@fusion-plugin-examples/claude-runtime/probe": resolve(
__dirname,
"../../plugins/fusion-plugin-claude-runtime/src/probe.ts",
Comment on lines 592 to +598

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python - <<'PY'
from pathlib import Path

text = Path("packages/dashboard/vitest.config.ts").read_text()
specific = text.index('"`@fusion-plugin-examples/claude-runtime/probe`"')
base = text.index('"`@fusion-plugin-examples/claude-runtime`"')
assert specific < base, "The specific /probe alias must precede the base alias"
PY

Repository: Runfusion/Fusion

Length of output: 297


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Show the relevant section with line numbers.
sed -n '570,620p' packages/dashboard/vitest.config.ts | cat -n

# Search for similar alias ordering patterns in the repo.
rg -n '"`@fusion-plugin-examples/`.*/probe"|resolve\(' packages/dashboard -g 'vitest.config.ts' -g 'vite.config.ts' -g '*.ts' | sed -n '1,120p'

Repository: Runfusion/Fusion

Length of output: 16186


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

sed -n '570,620p' packages/dashboard/vitest.config.ts | cat -n
rg -n '"`@fusion-plugin-examples/`.*/probe"|resolve\(' packages/dashboard -g 'vitest.config.ts' -g 'vite.config.ts' -g '*.ts' | sed -n '1,120p'

Repository: Runfusion/Fusion

Length of output: 14944


🌐 Web query:

Vite resolve.alias array order first match prefix exact string alias subpath documentation

💡 Result:

In Vite, the resolve.alias configuration supports either an object or an array of objects [1][2]. When using the array format (Array<{ find: string | RegExp, replacement: string }>), the order of the entries is significant because Vite processes them sequentially and applies the first matching rule it encounters [1][3]. Key points regarding order, prefix matching, and string aliases: 1. Order Matters: Vite evaluates aliases in the order they are defined in the array [1][4]. The first rule that matches the import path will be applied, and subsequent rules for that path will be ignored [3]. 2. Prefix Collisions: If you have aliases that share a common prefix (e.g., @app and @app/components), the more specific alias (the longer path) must be defined before the more general alias [3]. If the general alias is listed first, it will intercept and handle the import, preventing the more specific rule from ever being evaluated [3]. 3. Array vs. Object: While the object format (Record<string, string>) is convenient for simple, exact-prefix mapping, it does not guarantee evaluation order in the same explicit way as an array [2][3]. The array format is required when you need to use Regular Expressions for complex patterns or when you must strictly control the precedence of competing aliases [1][3]. To ensure correct resolution, always order your alias array from the most specific paths to the most general ones [3]. Example of correct ordering: resolve: { alias: [ { find: '@app/components', replacement: '/absolute/path/to/components' }, // More specific first { find: '@app', replacement: '/absolute/path/to/app' } // Less specific second ] }

Citations:


🌐 Web query:

Vite object alias string prefix matching order specific alias before base object syntax

💡 Result:

In Vite, the resolve.alias configuration—whether defined as an object or an array—is processed in the order specified, with the first matching rule taking precedence [1][2][3]. Because Vite evaluates these entries sequentially and stops at the first successful match, the order of your aliases is critical, especially when dealing with overlapping or nested path prefixes [3]. When multiple aliases share a common prefix (e.g., @core and @core/auth), defining the more specific alias before the less specific one ensures that the correct path is resolved [3]. If the less specific alias (e.g., @core) is defined first, it will intercept imports intended for the more specific one (e.g., @core/auth) [3]. Key points regarding configuration: - Array Format: The array format (Array<{ find, replacement }>) is recommended for most configurations because it explicitly preserves the order of entries and allows for more complex patterns like Regular Expressions [1][2][3]. - Object Format: While the object format (Record<string, string>) is convenient for simple aliases, it relies on the iteration order of object keys, which is generally reliable in modern JavaScript but can be less transparent than an explicit array [1][2]. - Implementation Details: Internally, Vite processes these aliases in a top-down manner [4]. If you use the array format, your configuration should explicitly list your most specific aliases (e.g., those with longer or more distinct path segments) at the top of the array [3]. If you find that an alias is being incorrectly overridden, reordering your resolve.alias configuration to prioritize the most specific path match will resolve the issue [5][3].

Citations:


Place the /probe alias before the base alias.

The broader @fusion-plugin-examples/claude-runtime alias will also match @fusion-plugin-examples/claude-runtime/probe, so that import can resolve to probes-entry.ts/probe instead of src/probe.ts.

Suggested fix
-      "`@fusion-plugin-examples/claude-runtime`": resolve(
-        __dirname,
-        "../../plugins/fusion-plugin-claude-runtime/src/probes-entry.ts",
-      ),
       "`@fusion-plugin-examples/claude-runtime/probe`": resolve(
         __dirname,
         "../../plugins/fusion-plugin-claude-runtime/src/probe.ts",
       ),
+      "`@fusion-plugin-examples/claude-runtime`": resolve(
+        __dirname,
+        "../../plugins/fusion-plugin-claude-runtime/src/probes-entry.ts",
+      ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@fusion-plugin-examples/claude-runtime": resolve(
__dirname,
"../../plugins/fusion-plugin-claude-runtime/src/index.ts",
"../../plugins/fusion-plugin-claude-runtime/src/probes-entry.ts",
),
"@fusion-plugin-examples/claude-runtime/probe": resolve(
__dirname,
"../../plugins/fusion-plugin-claude-runtime/src/probe.ts",
"`@fusion-plugin-examples/claude-runtime/probe`": resolve(
__dirname,
"../../plugins/fusion-plugin-claude-runtime/src/probe.ts",
),
"`@fusion-plugin-examples/claude-runtime`": resolve(
__dirname,
"../../plugins/fusion-plugin-claude-runtime/src/probes-entry.ts",
),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/vitest.config.ts` around lines 592 - 598, Reorder the
aliases in the Vitest configuration so
"`@fusion-plugin-examples/claude-runtime/probe`" is declared before the broader
"`@fusion-plugin-examples/claude-runtime`" alias, ensuring probe imports resolve
to src/probe.ts rather than through probes-entry.ts.

),
/*
FNXC:OmpAcp 2026-07-11-23:35:
Expand Down
Loading