From 65cc57c315a06f6cb0ab8e17ca0cc4fbf2e751d0 Mon Sep 17 00:00:00 2001 From: Raj Gahoi Date: Sat, 17 Oct 2026 11:12:27 +0530 Subject: [PATCH 1/2] fix(connection): prevent host with 'cfg' from force-switching endpoint type (fixes #442) Signed-off-by: Raj Gahoi --- .../components/ui/connection-form.test.tsx | 19 +++++++++++++++++++ .../src/components/ui/connection-modal.tsx | 1 - 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/frontend/src/components/ui/connection-form.test.tsx b/apps/frontend/src/components/ui/connection-form.test.tsx index 3f22edc9..04162424 100644 --- a/apps/frontend/src/components/ui/connection-form.test.tsx +++ b/apps/frontend/src/components/ui/connection-form.test.tsx @@ -53,4 +53,23 @@ describe("ConnectionForm", () => { connectionId: buildConnectionId("localhost", "6380", 0), }) }) + + it("does not force-switch endpoint type to Discovery when host contains 'cfg'", async () => { + renderForm() + + fireEvent.change(screen.getByLabelText("Host"), { target: { value: "clustercfg.example.com" } }) + fireEvent.change(screen.getByLabelText("Database"), { target: { value: "7" } }) + fireEvent.click(screen.getByRole("button", { name: "Connect" })) + + await screen.findByRole("button", { name: /Connect/ }) + + const pending = dispatched.find((a) => a.type.endsWith("connectPending")) + expect(pending?.payload).toMatchObject({ + connectionId: buildConnectionId("clustercfg.example.com", "6379", 7), + connectionDetails: expect.objectContaining({ + endpointType: "node", + db: 7, + }), + }) + }) }) diff --git a/apps/frontend/src/components/ui/connection-modal.tsx b/apps/frontend/src/components/ui/connection-modal.tsx index 1046a7e8..22e0461c 100644 --- a/apps/frontend/src/components/ui/connection-modal.tsx +++ b/apps/frontend/src/components/ui/connection-modal.tsx @@ -134,7 +134,6 @@ export function ConnectionModal({ onConnectionDetailsChange({ ...connectionDetails, host, - endpointType: host.includes("cfg") ? "cluster-endpoint" : connectionDetails.endpointType, }) }} placeholder="localhost" From b7afdb5d3c9a1b53f08866b99746f096ce043fad Mon Sep 17 00:00:00 2001 From: Raj Gahoi Date: Thu, 22 Oct 2026 03:03:41 +0530 Subject: [PATCH 2/2] feat(connection): add advisory inline hint for cluster cfg endpoint in connection modal (refs #442) Signed-off-by: Raj Gahoi --- apps/frontend/src/components/ui/connection-form.test.tsx | 9 +++++++++ apps/frontend/src/components/ui/connection-modal.tsx | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/apps/frontend/src/components/ui/connection-form.test.tsx b/apps/frontend/src/components/ui/connection-form.test.tsx index 04162424..b20c0559 100644 --- a/apps/frontend/src/components/ui/connection-form.test.tsx +++ b/apps/frontend/src/components/ui/connection-form.test.tsx @@ -59,6 +59,15 @@ describe("ConnectionForm", () => { fireEvent.change(screen.getByLabelText("Host"), { target: { value: "clustercfg.example.com" } }) fireEvent.change(screen.getByLabelText("Database"), { target: { value: "7" } }) + expect(screen.getByText("Hint: If this is a cluster configuration endpoint, switch Endpoint Type to Discovery.")).toBeInTheDocument() + expect(screen.getByLabelText("Node")).toBeChecked() + + fireEvent.change(screen.getByLabelText("Host"), { target: { value: "cluster.example.com" } }) + expect(screen.queryByText("Hint: If this is a cluster configuration endpoint, switch Endpoint Type to Discovery.")).not.toBeInTheDocument() + expect(screen.getByLabelText("Node")).toBeChecked() + expect(screen.getByLabelText("Database")).toHaveValue(7) + + fireEvent.change(screen.getByLabelText("Host"), { target: { value: "clustercfg.example.com" } }) fireEvent.click(screen.getByRole("button", { name: "Connect" })) await screen.findByRole("button", { name: /Connect/ }) diff --git a/apps/frontend/src/components/ui/connection-modal.tsx b/apps/frontend/src/components/ui/connection-modal.tsx index 22e0461c..d6b14a1c 100644 --- a/apps/frontend/src/components/ui/connection-modal.tsx +++ b/apps/frontend/src/components/ui/connection-modal.tsx @@ -141,6 +141,11 @@ export function ConnectionModal({ type="text" value={connectionDetails.host} /> + {connectionDetails.endpointType === "node" && connectionDetails.host.includes("cfg") && ( + + Hint: If this is a cluster configuration endpoint, switch Endpoint Type to Discovery. + + )}