From e56c392aa6fe0321d95a083fcff30eb87b48e1ca Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Tue, 24 Nov 2026 00:37:07 -0500 Subject: [PATCH] Knowledge row says when the bases last synced, and a stopped sync plainly The Knowledge row on the sources overview showed the gateway's updated_at, which was the newest time a base's settings were edited. The gateway now sends the newest successful sync or ready upload, plus stopped_at when a source's last sync stopped. The row says "Last sync stopped 5 min ago" then, and the panel keeps when content last came in. --- dashboard/e2e/knowledge-builtin.spec.ts | 19 ++++++++++++++++ .../src/components/knowledge/builtin.tsx | 22 +++++++++++++------ dashboard/src/lib/builtin-bases.ts | 3 +++ docs/content/docs/concepts/knowledge.mdx | 2 +- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/dashboard/e2e/knowledge-builtin.spec.ts b/dashboard/e2e/knowledge-builtin.spec.ts index 8dd614a7..08516d4f 100644 --- a/dashboard/e2e/knowledge-builtin.spec.ts +++ b/dashboard/e2e/knowledge-builtin.spec.ts @@ -25,6 +25,7 @@ interface Base { builtin: true; counts: { label: string; count: number }[]; updated_at: string | null; + stopped_at?: string | null; access: { open: boolean; why: string | null }; audience: { roles: string[]; people: string[]; readers: boolean; paused: boolean }; audience_label: string; @@ -482,6 +483,24 @@ test.describe("built-in search: switching the base", () => { await expect(box(page)).toBeFocused(); }); + test("Knowledge says when it last synced, and a stopped sync plainly, never the base's old settings date", async ({ page }) => { + const db = await mock(page, true); + const team = db.bases.find((b) => b.key === "team")!; + // The gateway's newest successful sync, 4 minutes ago. + team.updated_at = iso(4); + await page.goto("/knowledge/"); + await expect(card(page, "team").getByTestId("builtin-fresh")).toHaveText("Updated 4 min ago"); + await expect(card(page, "team").getByTestId("builtin-state")).toHaveCount(0); + + // The latest sync stopped: the row says so, the panel keeps what it holds. + team.stopped_at = iso(5); + team.updated_at = iso(35); + await page.reload(); + await expect(card(page, "team").getByTestId("builtin-fresh")).toHaveText("Last sync stopped 5 min ago"); + await card(page, "team").getByTestId("builtin-open").click(); + await expect(page.getByTestId("builtin-panel")).toContainText("Updated 35 min ago. Last sync stopped 5 min ago"); + }); + test("with nothing typed a tab only narrows; the next search runs there", async ({ page }) => { const db = await mock(page, true); await page.goto("/knowledge/"); diff --git a/dashboard/src/components/knowledge/builtin.tsx b/dashboard/src/components/knowledge/builtin.tsx index 78664d29..0d99da31 100644 --- a/dashboard/src/components/knowledge/builtin.tsx +++ b/dashboard/src/components/knowledge/builtin.tsx @@ -68,15 +68,23 @@ function BaseIcon({ k, size = "md" }: { k: BuiltinKey; size?: "sm" | "md" }) { function freshness(b: BuiltinBase): { words: string; live: boolean } { if (b.live) return { words: b.updated_at ? `Live, updated ${timeAgo(b.updated_at)}` : "Live", live: true }; - if (b.updated_at) return { words: `Updated ${timeAgo(b.updated_at)}`, live: false }; - return { words: "Not read yet", live: false }; + const stopped = b.stopped_at ? `Last sync stopped ${timeAgo(b.stopped_at)}` : ""; + if (b.updated_at) return { words: `Updated ${timeAgo(b.updated_at)}${stopped ? `. ${stopped}` : ""}`, live: false }; + return { words: stopped || "Not read yet", live: false }; +} + +/** The row's few words: "Live", a stopped sync, or how long ago it changed. */ +function rowFreshness(b: BuiltinBase): string { + if (b.live) return "Live"; + if (b.stopped_at) return `Last sync stopped ${timeAgo(b.stopped_at)}`; + return b.updated_at ? `Updated ${timeAgo(b.updated_at)}` : ""; } /** The one state worth a pill on the overview, if any. */ function stateOf(b: BuiltinBase): { tone: "warning" | "neutral"; words: string } | null { if (!b.access.open) return { tone: "warning", words: "Not open to you" }; if (b.audience.paused) return { tone: "neutral", words: "Paused" }; - if (!b.updated_at && !b.live) return { tone: "neutral", words: "Not read yet" }; + if (!b.updated_at && !b.live && !b.stopped_at) return { tone: "neutral", words: "Not read yet" }; return null; } @@ -228,15 +236,15 @@ function BaseCard({ b, onOpen }: { b: BuiltinBase; onOpen: (el: HTMLElement) => const people = b.audience.people.length; const who = `${roles.length ? roles.join(", ") : "All roles"}${people ? ` +${people}` : ""}`; const whoSpoken = `${roles.length ? listWords(roles) : "All roles"}${people ? ` and ${plural(people, "person", "people")}` : ""}`; - // The row says "Live" or how long ago; the panel has both. - const fresh = b.live ? "Live" : b.updated_at ? `Updated ${timeAgo(b.updated_at)}` : ""; + // The row says "Live", a stopped sync, or how long ago; the panel has all. + const fresh = rowFreshness(b); const status = state ? ( {state.words} ) : ( - + {fresh} ); @@ -700,7 +708,7 @@ function PanelBody({ b, canManage, readersOn, onChange, onSearch }: { b: Builtin {b.access.open ? Open to you : Not open to you} {b.audience.paused && Paused} - + {fresh.words} diff --git a/dashboard/src/lib/builtin-bases.ts b/dashboard/src/lib/builtin-bases.ts index a6b2960f..75b94669 100644 --- a/dashboard/src/lib/builtin-bases.ts +++ b/dashboard/src/lib/builtin-bases.ts @@ -36,6 +36,9 @@ export interface BuiltinBase { live?: boolean; /** When what it holds last changed; null: not read yet. */ updated_at: string | null; + /** When a sync that stopped did (its last sync stopped); null or absent: + * none did. `updated_at` still says what it holds. */ + stopped_at?: string | null; /** Whether the person looking may read it, and why not. */ access: { open: boolean; why: string | null }; audience: BuiltinAudience; diff --git a/docs/content/docs/concepts/knowledge.mdx b/docs/content/docs/concepts/knowledge.mdx index 74430418..ad591607 100644 --- a/docs/content/docs/concepts/knowledge.mdx +++ b/docs/content/docs/concepts/knowledge.mdx @@ -5,7 +5,7 @@ description: The team's six built-in bases, and documents from your apps, upload ## The team's built-in bases -Every team has six bases with nothing to set up: **Code**, **Work** (tickets, pull requests, runs, reviews and plans), **Infrastructure** (AWS resources, where each is defined and what AWS has pending), **Logs**, **Security** and **Knowledge** (the bases below). The **Knowledge** page shows each with its counts and when it last changed, and admins choose who reads each one. +Every team has six bases with nothing to set up: **Code**, **Work** (tickets, pull requests, runs, reviews and plans), **Infrastructure** (AWS resources, where each is defined and what AWS has pending), **Logs**, **Security** and **Knowledge** (the bases below). The **Knowledge** page shows each with its counts and when it was last refreshed (for **Knowledge**, the newest successful sync or upload across the bases; for **Security**, the newest scan), and admins choose who reads each one. When a source's last sync stopped, the row says **Last sync stopped** and when, and its details still say when it last brought content in. Chat, the Knowledge page, share links and connected AI tools all read through the same check: your role, the base's readers and, for an AI tool, the scopes it was given. A share link keeps the search, never the results, and searches again as whoever opens it; it lasts 1, 7 or 30 days and the sharer or an admin can end it.