feat(FN-2663): add cached update-check setting, APIs, and banner

- Add global updateCheckEnabled setting to core schema/types and wire dashboard command to cache update checks in the CLI
- Implement dashboard server update-check cache module plus REST routes for status and refresh behavior
- Add dashboard client hook, legacy API helpers, and UpdateAvailableBanner UI to show cached CLI update notices
- Cover update-check server routes, hook behavior, banner rendering, and route registration with focused tests
- Document update-check configuration and API behavior in architecture and settings reference docs
This commit is contained in:
Fusion
2026-04-27 01:40:07 -07:00
committed by gsxdsm
parent 90a28dfe23
commit e80850e7c9
18 changed files with 827 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
import { describe, it, expect, vi } from "vitest";
import { fireEvent, render, screen } from "@testing-library/react";
import { useState } from "react";
import { UpdateAvailableBanner } from "../UpdateAvailableBanner";
describe("UpdateAvailableBanner", () => {
it("renders version information and release notes link", () => {
render(
<UpdateAvailableBanner latestVersion="0.7.0" currentVersion="0.6.0" onDismiss={vi.fn()} />,
);
expect(screen.getByText(/Update available: v0.7.0 \(current: v0.6.0\)/)).toBeInTheDocument();
expect(screen.getByText("npm i -g @runfusion/fusion")).toBeInTheDocument();
expect(screen.getByRole("link", { name: "Release notes" })).toHaveAttribute(
"href",
"https://github.com/Runfusion/Fusion/releases",
);
});
it("dismiss button calls onDismiss", () => {
const onDismiss = vi.fn();
render(
<UpdateAvailableBanner latestVersion="0.7.0" currentVersion="0.6.0" onDismiss={onDismiss} />,
);
fireEvent.click(screen.getByRole("button", { name: "Dismiss update notice" }));
expect(onDismiss).toHaveBeenCalledTimes(1);
});
it("can be hidden by parent on dismiss", () => {
function Harness() {
const [visible, setVisible] = useState(true);
if (!visible) return null;
return (
<UpdateAvailableBanner
latestVersion="0.7.0"
currentVersion="0.6.0"
onDismiss={() => setVisible(false)}
/>
);
}
render(<Harness />);
expect(screen.getByRole("status")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Dismiss update notice" }));
expect(screen.queryByRole("status")).toBeNull();
});
});