fix(fusion): prevent nested .fusion roots and safe fn version lookup

This commit is contained in:
gsxdsm
2026-05-03 02:02:25 -07:00
parent 41bb6be0f8
commit 8ba8f63163
14 changed files with 362 additions and 20 deletions

View File

@@ -85,6 +85,7 @@ function makeMockStore() {
updatePrInfo: vi.fn().mockResolvedValue({}),
logEntry: vi.fn().mockResolvedValue(undefined),
updateTask: vi.fn().mockResolvedValue({}),
getRootDir: vi.fn().mockReturnValue("/tmp/test"),
getFusionDir: vi.fn().mockReturnValue("/tmp/test/.fusion"),
getGlobalSettingsStore: vi.fn(() => ({
getSettings: mockGlobalSettingsGetSettings,

View File

@@ -72,6 +72,7 @@ const mocks = vi.hoisted(() => {
init: vi.fn().mockResolvedValue(undefined),
watch: vi.fn().mockResolvedValue(undefined),
close: vi.fn(),
getRootDir: vi.fn().mockReturnValue(`/repo${projectId ? `/${projectId}` : ""}`),
getFusionDir: vi.fn().mockReturnValue(`/repo${projectId ? `/${projectId}` : ""}/.fusion`),
getGlobalSettingsStore: vi.fn(() => ({
getSettings: vi.fn().mockResolvedValue({}),
@@ -879,12 +880,12 @@ describe("runServe — Plugin wiring", () => {
await triggerSignal("SIGINT");
});
it("initializes PluginStore with the task store's fusion directory", async () => {
it("initializes PluginStore with the task store's project root", async () => {
const { PluginStore } = await import("@fusion/core");
await runServe(4040, {});
expect(PluginStore).toHaveBeenCalledWith("/repo/.fusion");
expect(PluginStore).toHaveBeenCalledWith("/repo");
await triggerSignal("SIGINT");
});