From 925d2038232b2eca203d09c9842d8b3c20bcb9f4 Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 6 Oct 2026 10:39:05 -0500 Subject: [PATCH] test(connections): cover bounded history and fix Storybook selector types Co-Authored-By: Paperclip --- .../adapters/grok-local/src/server/grok-home.test.ts | 12 +++++++++++- .../stories/provider-routing-02-connect.stories.tsx | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/adapters/grok-local/src/server/grok-home.test.ts b/packages/adapters/grok-local/src/server/grok-home.test.ts index 77524dde08b..8af7b788a39 100644 --- a/packages/adapters/grok-local/src/server/grok-home.test.ts +++ b/packages/adapters/grok-local/src/server/grok-home.test.ts @@ -3,7 +3,7 @@ import os from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it, vi } from "vitest"; -import { GROK_SYNC_ALLOWLIST, stageGrokHomeForSync } from "./grok-home.js"; +import { GROK_SYNC_ALLOWLIST, grokHomeHasSession, stageGrokHomeForSync } from "./grok-home.js"; describe("GROK_SYNC_ALLOWLIST", () => { it("holds exactly one name: auth.json", () => { @@ -29,6 +29,16 @@ describe("stageGrokHomeForSync", () => { return root; } + it("starts fresh instead of throwing when private history exceeds the lookup bound", async () => { + const root = await makeRoot("paperclip-grok-large-history-"); + const sessions = path.join(root, "sessions"); + await fs.mkdir(sessions); + for (let offset = 0; offset < 5001; offset += 100) { + await Promise.all(Array.from({ length: Math.min(100, 5001 - offset) }, (_, index) => fs.writeFile(path.join(sessions, `other-${offset + index}.json`), "{}"))); + } + await expect(grokHomeHasSession(root, "requested-session")).resolves.toBe(false); + }); + it("stages auth.json and stages no other file", async () => { const root = await makeRoot("paperclip-grok-stage-"); const home = path.join(root, "grok-home"); diff --git a/ui/storybook/stories/provider-routing-02-connect.stories.tsx b/ui/storybook/stories/provider-routing-02-connect.stories.tsx index 978972e45be..8d0f42ca24c 100644 --- a/ui/storybook/stories/provider-routing-02-connect.stories.tsx +++ b/ui/storybook/stories/provider-routing-02-connect.stories.tsx @@ -105,7 +105,7 @@ export const CustomEndpointWalkthrough: Story = { "https://models.example.com/v1", ); await userEvent.type(canvas.getByLabelText("API key"), "storybook-example"); - await userEvent.click(canvas.getByRole("button", { name: "Connect", exact: true })); + await userEvent.click(canvas.getByRole("button", { name: /^Connect$/ })); await expect( canvas.getByRole("heading", { name: "Connection ready" }), ).toBeVisible();