π OpenHands: AI-Driven Development
fix(sidebar): hide the Getting started checklist on a canvas locked to a Cloud host (OHE-3683) (#18739)
Hiep Le630e587a0de0
diff --git a/__tests__/components/features/sidebar/sidebar-onboarding-checklist.test.tsx b/__tests__/components/features/sidebar/sidebar-onboarding-checklist.test.tsxindex 0faff73196..69e5707167 100644--- a/__tests__/components/features/sidebar/sidebar-onboarding-checklist.test.tsx+++ b/__tests__/components/features/sidebar/sidebar-onboarding-checklist.test.tsx@@ -526,6 +526,7 @@ describe("SidebarOnboardingChecklist", () => {afterEach(() => {__resetActiveStoreForTests();+ vi.unstubAllEnvs();});it("steps aside while the setup guide is shown", async () => {@@ -553,5 +554,16 @@ describe("SidebarOnboardingChecklist", () => {screen.queryByTestId("super-admin-setup-guide"),).not.toBeInTheDocument();});++ it("never shows on a canvas locked to its Cloud host, even with no setup guide", async () => {+ vi.stubEnv("VITE_LOCK_TO_CLOUD", "https://ohe.example.com");+ serveCloudUser(["view_automations"]);++ renderOnCloud();++ await expect(+ screen.findByTestId("sidebar-onboarding-checklist"),+ ).rejects.toThrow();+ });});});diff --git a/__tests__/routes/app-settings.test.tsx b/__tests__/routes/app-settings.test.tsxindex 0bfb04a817..72e9bc81c3 100644--- a/__tests__/routes/app-settings.test.tsx+++ b/__tests__/routes/app-settings.test.tsx@@ -1,7 +1,7 @@import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { render, screen, waitFor } from "@testing-library/react";import userEvent from "@testing-library/user-event";-import { beforeEach, describe, expect, it, vi } from "vitest";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import AppSettingsScreen from "#/routes/app-settings";import SettingsService from "#/api/settings-service/settings-service.api";import { MOCK_DEFAULT_USER_SETTINGS } from "#/mocks/handlers";@@ -82,6 +82,10 @@ describe("AppSettingsScreen", () => {activeBackendState.kind = "local";});+ afterEach(() => {+ vi.unstubAllEnvs();+ });+it("keeps edits after a failed save and lets the user retry successfully", async () => {// Arrange: a real save mutation remains pending until the service rejects.const user = userEvent.setup();@@ -194,6 +198,21 @@ describe("AppSettingsScreen", () => {expect(submitButton).toBeDisabled();});+ it("hides the Getting Started checklist switch on a canvas locked to its Cloud host", async () => {+ vi.stubEnv("VITE_LOCK_TO_CLOUD", "https://app.all-hands.dev");+ activeBackendState.kind = "cloud";+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());++ renderAppSettingsScreen();++ expect(+ await screen.findByTestId("enable-sound-notifications-switch"),+ ).toBeInTheDocument();+ expect(+ screen.queryByTestId("show-getting-started-checklist-switch"),+ ).not.toBeInTheDocument();+ });+it("does not submit analytics consent for cloud backends", async () => {activeBackendState.kind = "cloud";const saveSettingsSpy = vidiff --git a/src/components/features/sidebar/use-sidebar-onboarding-checklist.ts b/src/components/features/sidebar/use-sidebar-onboarding-checklist.tsindex 52b2111780..3aa3d6a3f3 100644--- a/src/components/features/sidebar/use-sidebar-onboarding-checklist.ts+++ b/src/components/features/sidebar/use-sidebar-onboarding-checklist.ts@@ -114,29 +114,25 @@ export function useSidebarOnboardingChecklist() {settings?.agent_settings?.mcp_config,]);- // Locked-to-Cloud blocks the Canvas LLM and Agent settings pages these two- // items link to, and "customize-agent" only completes by visiting one- // (OHE-3457).- const isLockedToCloud = getLockedCloudHost() !== null;-const items = useMemo((): SidebarOnboardingChecklistItemState[] =>- SIDEBAR_ONBOARDING_CHECKLIST_ITEM_IDS.filter(- (id) =>- !isLockedToCloud ||- (id !== "configure-llm" && id !== "customize-agent"),- ).map((id) => ({+ SIDEBAR_ONBOARDING_CHECKLIST_ITEM_IDS.map((id) => ({id,isComplete: completionById[id],})),- [completionById, isLockedToCloud],+ [completionById],);const completedCount = items.filter((item) => item.isComplete).length;const isAllComplete = completedCount === items.length;+ // A canvas locked to a Cloud host (SaaS / self-hosted OHE) never shows the+ // checklist: the main app owns setup there (OHE-3457, OHE-3683).+ const isLockedToCloud = getLockedCloudHost() !== null;+// The Super Admin setup guide replaces this checklist while it is shown.const isVisible =+ !isLockedToCloud &&onboardingCompleted &&!isDismissed &&!isAllComplete &&diff --git a/src/routes/app-settings.tsx b/src/routes/app-settings.tsxindex 0ef025c81c..da64a4e605 100644--- a/src/routes/app-settings.tsx+++ b/src/routes/app-settings.tsx@@ -240,7 +240,8 @@ function AppSettingsForm() {{t(I18nKey.SETTINGS$SOUND_NOTIFICATIONS)}</SettingsSwitch>- <GettingStartedChecklistSwitch />+ {/* Locked-to-Cloud never shows the checklist (OHE-3683). */}+ {getLockedCloudHost() === null && <GettingStartedChecklistSwitch />}<RecommendedAutomationsSwitch /><div className="border-t border-border pt-6 mt-2">