feat(FN-2394): add Fusion reinstall flow for Pi extensions

- Add dashboard route and server handling to reinstall the Fusion Pi extension
- Introduce a client API helper and wire a reinstall action into PiExtensionsManager
- Polish action spacing and document Fusion reinstall recovery in the CLI README
- Expand route, API, and component tests including reinstall refresh stability coverage
- Add a changeset for @runfusion/fusion patch release
This commit is contained in:
Fusion
2026-04-24 05:05:11 -07:00
committed by gsxdsm
parent 0ebe20e487
commit f078a4e946
11 changed files with 244 additions and 31 deletions

View File

@@ -55,6 +55,7 @@ import {
fetchPiSettings,
updatePiSettings,
installPiPackage,
reinstallFusionPiPackage,
fetchPiExtensions,
updatePiExtensions,
fetchProjectTasks,
@@ -5962,6 +5963,45 @@ describe("installPiPackage", () => {
});
});
describe("reinstallFusionPiPackage", () => {
const originalFetch = globalThis.fetch;
afterEach(() => {
globalThis.fetch = originalFetch;
});
it("sends POST to /api/pi-settings/reinstall-fusion", async () => {
globalThis.fetch = vi.fn().mockReturnValue(
mockFetchResponse(true, { success: true, source: "npm:@runfusion/fusion" })
);
const result = await reinstallFusionPiPackage();
expect(result).toEqual({ success: true, source: "npm:@runfusion/fusion" });
expect(globalThis.fetch).toHaveBeenCalledWith("/api/pi-settings/reinstall-fusion", expect.objectContaining({
method: "POST",
}));
});
it("forwards projectId query parameter when provided", async () => {
globalThis.fetch = vi.fn().mockReturnValue(
mockFetchResponse(true, { success: true, source: "npm:@runfusion/fusion" })
);
await reinstallFusionPiPackage("proj-123");
expect(globalThis.fetch).toHaveBeenCalledWith("/api/pi-settings/reinstall-fusion?projectId=proj-123", expect.objectContaining({
method: "POST",
}));
});
it("throws API error message on failure", async () => {
globalThis.fetch = vi.fn().mockReturnValue(mockFetchResponse(false, { error: "Reinstall failed" }, 500));
await expect(reinstallFusionPiPackage()).rejects.toThrow("Reinstall failed");
});
});
describe("fetchPiExtensions", () => {
const originalFetch = globalThis.fetch;