From 2682d77aef7b0e776d49847b92c24d5298684642 Mon Sep 17 00:00:00 2001 From: Dylan Trotter Date: Sat, 24 Oct 2026 11:45:43 +0000 Subject: [PATCH 1/2] stewards: a sidebar-footer toggle and a default-provider pin (BB-45) BB-44 registers the stewards list through the exclusive thread-list slot, and bb resolves an unset provider to it, so the list would win by default. Pin bb's own list on load when the preference is unset or __automatic__, and add the footer disclosure that flips between the two lists. --- plugins/stewards/DESIGN.md | 27 +++++-- plugins/stewards/README.md | 39 ++++++++++ plugins/stewards/app.test.tsx | 95 ++++++++++++++++++++++++- plugins/stewards/app.tsx | 122 ++++++++++++++++++++++++++++++++ plugins/stewards/server.test.ts | 60 +++++++++++++++- plugins/stewards/server.ts | 37 ++++++++++ 6 files changed, 371 insertions(+), 9 deletions(-) diff --git a/plugins/stewards/DESIGN.md b/plugins/stewards/DESIGN.md index f68a024c..178f5c3c 100644 --- a/plugins/stewards/DESIGN.md +++ b/plugins/stewards/DESIGN.md @@ -1270,12 +1270,27 @@ component joins them to `experimental_useSidebarThreads` and polls `thread-list/thread-list`". Registering the slot therefore makes the stewards list active on every client that has not pinned a provider, and `bb settings ui get sidebar.threadListProvider` on the dev server reads -`__automatic__`. **This PR must not land alone:** it lands with the toggle -ticket, whose server-side pin keeps bb's own list for clients that have not -opted in. Until that lands, the list is opt-in only in code, not in effect. - -The "Needs you" block and the tab badge are a separate ticket, as is the -footer toggle. +`__automatic__`. **The guard was needed:** without it the list would win by +default. On load the plugin (`server.ts`, `pinSidebarThreadListProvider`) +reads the preference and, when it is unset or `__automatic__`, sets it to +`thread-list/thread-list`; an explicit value is left alone, and a failure is +logged, never thrown. `bb.onInstall` is not usable here — it does not run for +plugins baked into the `bb-server` image — so the pin is on load. BB-44 and +BB-45 are one landing; BB-44 must not land alone. + +**The footer toggle (BB-45).** `app.tsx` registers a +`experimental_sidebarFooter` disclosure (`id: "sidebar"`, `icon: +"ShieldCheck"`): a switch that writes the same preference. On sets +`/sidebar`, the id BB-44 registers; off sets +`thread-list/thread-list`. It lists the preference when the disclosure opens +and, on an HTTP 409 revision conflict, re-lists and retries once with the +fresh revision. `__automatic__` (or a missing entry) reads as on, because it +means the stewards list is the effective provider until the pin makes the +choice explicit. The preference is server-synced, so a flip is per server: +every window of one bb server shows the same list. Each developer has their +own server behind bb-gate, so it is per developer in practice. + +The "Needs you" block and the tab badge are a separate ticket. ## Known limits diff --git a/plugins/stewards/README.md b/plugins/stewards/README.md index 4a4daab1..6382ca9c 100644 --- a/plugins/stewards/README.md +++ b/plugins/stewards/README.md @@ -297,6 +297,45 @@ bb. [DESIGN.md](DESIGN.md) is the design; this is how it is built and run. put its own binding on hold for this, but only its parent or the project steward lifts a hold. +## The sidebar thread list and its toggle + +BB-44 registers a replacement for bb's own sidebar thread list through the +exclusive `experimental_threadList` slot: one tab per stewarded project, +in-flight efforts grouped by the steward relationship, and collapsed Watches +and Recently ended rows. BB-45 makes it switchable from where you are. + +**The footer toggle.** A `ShieldCheck` icon in the sidebar footer (next to +Settings) opens a small panel above the footer row with a **Stewards +sidebar** switch and one line of help. On writes `sidebar.threadListProvider` += `stewards/sidebar` (the list BB-44 registers); off writes it back to bb's +own `thread-list/thread-list`. The sidebar's list swaps without a reload. The +footer is host-rendered and stays in place under either list, so the icon is +reachable in both states. Hide it like any footer item through bb's footer +preferences (Settings → Appearance → Sidebar → footer items, or +`sidebar.hiddenFooterItems`). + +**The Appearance page alternative.** The same choice is Settings → Appearance +→ Sidebar → the thread-list provider; the toggle is a shortcut to it, not a +second setting. Both write the one UI preference. + +**The default-provider pin.** bb resolves an unset (`__automatic__`) +provider to the first installed thread list other than the bundled +`thread-list/thread-list` — the stewards list — so without a guard BB-44 +would change everyone's sidebar the moment it landed. On load the plugin +reads the preference and, when it is unset or `__automatic__`, sets it to +`thread-list/thread-list`. An explicit value, including `stewards/sidebar`, +is left alone. The write is best-effort: a failure is logged and the sidebar +keeps working. (`bb.onInstall` is not usable here; it does not run for +plugins baked into the `bb-server` image.) + +**Per client or per server?** Checked on a dev server: the preference is +**server-synced**, so a flip is per server, not per browser. Every open +window of that bb server shows the same list, and the choice survives a +reload. `bb settings ui get sidebar.threadListProvider` — a different client — +sees the value the toggle wrote, and bb tells the other clients the preference +changed. Each developer has their own server behind bb-gate, so in practice +the choice is per developer. + ## Configuration In the project's `.bb` (the multi-repo project repo), read from committed diff --git a/plugins/stewards/app.test.tsx b/plugins/stewards/app.test.tsx index 032aaa93..699576b4 100644 --- a/plugins/stewards/app.test.tsx +++ b/plugins/stewards/app.test.tsx @@ -2,7 +2,7 @@ // BB-20: the Stewards page renders a decide item or question with fixed // choices as one button per choice plus Other…, and a text-only one with // Answer rather than Done. -import { afterEach, describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it, vi } from "vitest"; import { fireEvent, waitFor } from "@testing-library/react"; import { loadPluginApp, renderSlot, type CapturedPluginApp, type RenderedSlot } from "@get-bb/plugin-sdk/testing/app"; @@ -179,3 +179,96 @@ describe("the Stewards page's need links (BB-29)", () => { slot.lifecycle.unmount(); }); }); + +// BB-45: the sidebar-footer disclosure writes the `sidebar.threadListProvider` +// UI preference, so the stewards list BB-44 registers can be turned on and off +// from the footer instead of Settings → Appearance. +describe("the sidebar-footer toggle (BB-45)", () => { + type UiPrefEntry = { value: string; revision: number }; + type SetArgs = { key: string; value: string; expectedRevision: number }; + + /** A `uiPreferences.list()` answer with just the one preference the toggle reads. */ + const listed = (entry: UiPrefEntry) => ({ preferences: { "sidebar.threadListProvider": entry } }) as never; + + const renderToggle = async (options: { entry: UiPrefEntry; set: (args: SetArgs) => Promise }) => { + const captured = await loadApp(); + const item = captured.experimentalSidebarFooterItems[0]!; + if (item.kind !== "disclosure") throw new Error("the sidebar footer item is not a disclosure"); + const list = vi.fn(async () => listed(options.entry)); + const set = vi.fn(options.set); + const slot = renderSlot({ component: item.component }, { dismiss: () => {} }, { pluginId: "stewards", sdk: { system: { uiPreferences: { list, set } } } as never }); + return { slot, set }; + }; + + const echo = async (args: SetArgs) => ({ key: args.key, value: args.value, revision: args.expectedRevision + 1 }); + + it("registers one footer disclosure under the Stewards sidebar label", async () => { + const captured = await loadApp(); + expect(captured.experimentalSidebarFooterItems).toHaveLength(1); + expect(captured.experimentalSidebarFooterItems[0]).toMatchObject({ kind: "disclosure", id: "sidebar", label: "Stewards sidebar", icon: "ShieldCheck" }); + }); + + it("shows the switch off for bb's list and on for the stewards list", async () => { + const off = await renderToggle({ entry: { value: "thread-list/thread-list", revision: 7 }, set: echo }); + const offSwitch = await waitFor(() => off.slot.getByRole("switch", { name: "Stewards sidebar" })); + expect(offSwitch.getAttribute("aria-checked")).toBe("false"); + off.slot.lifecycle.unmount(); + + const on = await renderToggle({ entry: { value: "stewards/sidebar", revision: 7 }, set: echo }); + const onSwitch = await waitFor(() => on.slot.getByRole("switch", { name: "Stewards sidebar" })); + expect(onSwitch.getAttribute("aria-checked")).toBe("true"); + on.slot.lifecycle.unmount(); + }); + + it("turns the stewards list on with the stewards list id and the listed revision", async () => { + const { slot, set } = await renderToggle({ entry: { value: "thread-list/thread-list", revision: 7 }, set: echo }); + fireEvent.click(await waitFor(() => slot.getByRole("switch", { name: "Stewards sidebar" }))); + await waitFor(() => expect(set).toHaveBeenCalledTimes(1)); + expect(set.mock.calls[0]![0]).toEqual({ key: "sidebar.threadListProvider", value: "stewards/sidebar", expectedRevision: 7 }); + await waitFor(() => expect(slot.getByRole("switch", { name: "Stewards sidebar" }).getAttribute("aria-checked")).toBe("true")); + slot.lifecycle.unmount(); + }); + + it("turns the stewards list off by setting bb's own list", async () => { + const { slot, set } = await renderToggle({ entry: { value: "stewards/sidebar", revision: 3 }, set: echo }); + fireEvent.click(await waitFor(() => slot.getByRole("switch", { name: "Stewards sidebar" }))); + await waitFor(() => expect(set).toHaveBeenCalledTimes(1)); + expect(set.mock.calls[0]![0]).toEqual({ key: "sidebar.threadListProvider", value: "thread-list/thread-list", expectedRevision: 3 }); + await waitFor(() => expect(slot.getByRole("switch", { name: "Stewards sidebar" }).getAttribute("aria-checked")).toBe("false")); + slot.lifecycle.unmount(); + }); + + it("re-lists and retries once when the set hits a revision conflict", async () => { + let sets = 0; + let lists = 0; + const captured = await loadApp(); + const item = captured.experimentalSidebarFooterItems[0]!; + if (item.kind !== "disclosure") throw new Error("the sidebar footer item is not a disclosure"); + const slot = renderSlot({ component: item.component }, { dismiss: () => {} }, { + pluginId: "stewards", + sdk: { + system: { + uiPreferences: { + list: async () => { + lists += 1; + return listed({ value: "thread-list/thread-list", revision: lists === 1 ? 7 : 9 }); + }, + set: async (args: SetArgs) => { + sets += 1; + if (sets === 1) throw Object.assign(new Error("revision conflict"), { status: 409 }); + return { key: args.key, value: args.value, revision: args.expectedRevision + 1 }; + }, + }, + }, + } as never, + }); + fireEvent.click(await waitFor(() => slot.getByRole("switch", { name: "Stewards sidebar" }))); + await waitFor(() => expect(sets).toBe(2)); + expect(slot.inspection.sdkCalls.filter((c) => c.method === "system.uiPreferences.set")).toEqual([ + { method: "system.uiPreferences.set", args: [{ key: "sidebar.threadListProvider", value: "stewards/sidebar", expectedRevision: 7 }] }, + { method: "system.uiPreferences.set", args: [{ key: "sidebar.threadListProvider", value: "stewards/sidebar", expectedRevision: 9 }] }, + ]); + expect(lists).toBe(2); + slot.lifecycle.unmount(); + }); +}); diff --git a/plugins/stewards/app.tsx b/plugins/stewards/app.tsx index d623dbff..0d9f62be 100644 --- a/plugins/stewards/app.tsx +++ b/plugins/stewards/app.tsx @@ -13,9 +13,11 @@ import { experimental_Icon as Icon, experimental_ThreadActionsContextMenu as ThreadActionsContextMenu, experimental_ThreadStatusGlyph as ThreadStatusGlyph, + experimental_usePluginId, experimental_useSidebarThreads, useBbNavigate, useRpc, + useSdk, useSidebarThreadDraft, useSidebarThreadRowStatus, type PluginSidebarThread, @@ -1062,6 +1064,117 @@ function StewardsSidebar({ activeProjectId, isCompactViewport, onNavigate }: Plu ); } +// ---- The sidebar-footer toggle ----------------------------------------------------------------- +// +// BB-45: an icon in the sidebar footer that opens a small panel above the +// footer row with a switch for the stewards list BB-44 registers. The footer +// is host-rendered and stays in place under either list, so the toggle is +// reachable in both states. The preference it writes is the one Settings → +// Appearance → Sidebar sets; the value is the plugin id plus the `sidebar` +// slot id BB-44 registers. + +/** The value that turns the stewards list on (BB-44's `experimental_threadList` slot). */ +function stewardsThreadListId(pluginId: string): string { + return `${pluginId}/sidebar`; +} +/** bb's bundled thread list: the value that turns the stewards list off. */ +const BUILTIN_THREAD_LIST_ID = "thread-list/thread-list"; +/** What `sidebar.threadListProvider` reads while nothing is pinned. */ +const AUTOMATIC_THREAD_LIST_PROVIDER = "__automatic__"; +const THREAD_LIST_PROVIDER_KEY = "sidebar.threadListProvider"; + +/** bb answers a stale `expectedRevision` with HTTP 409. */ +function isRevisionConflict(error: unknown): boolean { + const status = typeof error === "object" && error !== null && "status" in error ? (error as { status?: unknown }).status : null; + return status === 409 || /\bHTTP\s*409\b/u.test(String(error)); +} + +type ThreadListProviderState = { status: "loading" } | { status: "ready"; on: boolean; revision: number } | { status: "error"; message: string }; + +/** + * The disclosure's body: a switch that writes `sidebar.threadListProvider`. + * The preference is read when the disclosure opens (the component mounts) and + * again after a conflict. `__automatic__` (the value while nothing is pinned) + * means bb picks the stewards list, so it reads as on until the load-time pin + * has made the choice explicit. + */ +function SidebarToggle() { + const sdk = useSdk(); + const pluginId = experimental_usePluginId(); + const onId = stewardsThreadListId(pluginId); + const [state, setState] = useState({ status: "loading" }); + const [busy, setBusy] = useState(false); + + const read = useCallback(async (): Promise<{ on: boolean; revision: number }> => { + const { preferences } = await sdk.system.uiPreferences.list(); + const entry = preferences[THREAD_LIST_PROVIDER_KEY]; + const value = entry?.value; + return { on: value === onId || value === undefined || value === AUTOMATIC_THREAD_LIST_PROVIDER, revision: entry?.revision ?? 0 }; + }, [sdk, onId]); + + useEffect(() => { + let live = true; + read().then( + (next) => { + if (live) setState({ status: "ready", ...next }); + }, + (error: unknown) => { + if (live) setState({ status: "error", message: message(error) }); + }, + ); + return () => { + live = false; + }; + }, [read]); + + const flip = useCallback(async () => { + if (state.status !== "ready" || busy) return; + const next = !state.on; + const value = next ? onId : BUILTIN_THREAD_LIST_ID; + setBusy(true); + try { + let revision: number; + try { + revision = (await sdk.system.uiPreferences.set({ key: THREAD_LIST_PROVIDER_KEY, value, expectedRevision: state.revision })).revision; + } catch (error) { + // Another window changed the preference between our list and our set: + // re-list and retry once with the fresh revision. Anything else is a + // real failure. + if (!isRevisionConflict(error)) throw error; + const fresh = await read(); + revision = (await sdk.system.uiPreferences.set({ key: THREAD_LIST_PROVIDER_KEY, value, expectedRevision: fresh.revision })).revision; + } + setState({ status: "ready", on: next, revision }); + } catch (error) { + setState({ status: "error", message: message(error) }); + } finally { + setBusy(false); + } + }, [state, busy, onId, read, sdk]); + + const on = state.status === "ready" && state.on; + return ( +
+
+ Stewards sidebar + +
+

Show the stewards list of threads grouped by project and effort. Off shows bb's own list.

+ {state.status === "error" ?

Could not change the sidebar: {state.message}

: null} +
+ ); +} + export default definePluginApp((app) => { app.slots.navPanel({ id: "board", @@ -1078,6 +1191,15 @@ export default definePluginApp((app) => { description: "Threads grouped by project and in-flight effort, with stages, workers and reviewers.", component: StewardsSidebar, }); + // The footer disclosure that writes the provider preference, so the list + // above can be turned on and off without Settings → Appearance. + app.experimental_sidebarFooter.register({ + kind: "disclosure", + id: "sidebar", + label: "Stewards sidebar", + icon: "ShieldCheck", + component: SidebarToggle, + }); app.slots.settingsSection({ id: "status", title: "Status", diff --git a/plugins/stewards/server.test.ts b/plugins/stewards/server.test.ts index f87168be..70c88cc5 100644 --- a/plugins/stewards/server.test.ts +++ b/plugins/stewards/server.test.ts @@ -37,6 +37,10 @@ function world() { /** Each thread's latest context window reading, as bb reports it. */ const usage = new Map(); const metadata = new Map>(); + /** The fake server's UI preferences, keyed by preference key. */ + const uiPreferences = new Map([["sidebar.threadListProvider", { value: "__automatic__", revision: 0 }]]); + /** Every `system.uiPreferences.set` the plugin made, for the load-time pin's tests. */ + const uiPreferencesWrites: Array<{ key: string; value: unknown; expectedRevision: number }> = []; const spawns: Array & { id: string }> = []; const sends: Array<{ threadId: string; text: string }> = []; const userTurns: Array<{ threadId: string; text: string }> = []; @@ -224,13 +228,34 @@ function world() { : userTurns.filter((t) => t.threadId === threadId).map((t, i) => ({ id: `e${i}`, seq: i, threadId, createdAt: now, scope: "thread", type: "client/turn/start", data: { initiator: "user", request: { method: "turn/start", params: { input: [{ type: "text", text: t.text }] } } } })), }, }, + system: { + uiPreferences: { + list: async () => ({ preferences: Object.fromEntries([...uiPreferences].map(([key, entry]) => [key, { ...entry }])) }), + set: async (args: { key: string; value: unknown; expectedRevision: number }) => { + const current = uiPreferences.get(args.key); + if (current !== undefined && current.revision !== args.expectedRevision) throw Object.assign(new Error(`revision conflict for ${args.key}`), { status: 409 }); + const next = { value: args.value, revision: (current?.revision ?? 0) + 1 }; + uiPreferences.set(args.key, next); + uiPreferencesWrites.push({ ...args }); + return { key: args.key, ...next }; + }, + }, + }, }; let now = Date.parse("2026-10-14T15:00:00Z"); - return { files, writes, fileContents, repos, entities, dependabotAlerts, rpcCalls, mergeGuidanceCalls, setMergeGuidanceResult: (value: typeof mergeGuidanceResult) => { mergeGuidanceResult = value; }, threads, sections, usage, metadata, spawns, sends, userTurns, githubComments, githubMerges, githubFiles, github, sdk, now: () => now, advance: (ms: number) => (now += ms) }; + return { files, writes, fileContents, repos, entities, dependabotAlerts, rpcCalls, mergeGuidanceCalls, setMergeGuidanceResult: (value: typeof mergeGuidanceResult) => { mergeGuidanceResult = value; }, threads, sections, usage, metadata, spawns, sends, userTurns, githubComments, githubMerges, githubFiles, github, sdk, uiPreferences, uiPreferencesWrites, now: () => now, advance: (ms: number) => (now += ms) }; } -async function setup(extra: Partial = {}, settings: Record = {}) { +async function setup(extra: Partial = {}, settings: Record = {}, seedProvider?: string | null | "fail-list" | "fail-set") { const w = world(); + if (seedProvider === null) w.uiPreferences.delete("sidebar.threadListProvider"); + else if (seedProvider === "fail-list") w.sdk.system.uiPreferences.list = async () => { + throw new Error("the preferences store is down"); + }; + else if (seedProvider === "fail-set") w.sdk.system.uiPreferences.set = async () => { + throw new Error("the preferences store is down"); + }; + else if (seedProvider !== undefined) w.uiPreferences.set("sidebar.threadListProvider", { value: seedProvider, revision: 4 }); const { bb, harness } = createFakePluginHost({ pluginId: "stewards", sdk: w.sdk as never, agentSkillIds: ["stewards"], settings }); await createStewardsPlugin({ now: w.now, timing: { debounceMs: 1, nightlyStaggerMs: 0 }, github: w.github, ...extra })(bb); const hooks = testHooks.get("stewards")!; @@ -4813,3 +4838,34 @@ describe("steward-spawned threads and the sidebar (BB-39)", () => { expect(instructions()).not.toContain("--section"); }); }); + +// BB-45: BB-44's dev-server check found that an unset `sidebar.threadListProvider` +// resolves to the stewards list, so the plugin pins bb's own list on load and +// leaves any explicit choice alone. +describe("the load-time sidebar thread-list pin (BB-45)", () => { + it("pins bb's own list when the preference is unset or automatic", async () => { + const unset = await setup({}, {}, null); + expect(unset.uiPreferences.get("sidebar.threadListProvider")).toMatchObject({ value: "thread-list/thread-list" }); + expect(unset.uiPreferencesWrites).toEqual([{ key: "sidebar.threadListProvider", value: "thread-list/thread-list", expectedRevision: 0 }]); + + const automatic = await setup({}, {}, "__automatic__"); + expect(automatic.uiPreferences.get("sidebar.threadListProvider")).toMatchObject({ value: "thread-list/thread-list" }); + expect(automatic.uiPreferencesWrites).toEqual([{ key: "sidebar.threadListProvider", value: "thread-list/thread-list", expectedRevision: 4 }]); + }); + + it("leaves an explicit provider alone, including the stewards list", async () => { + for (const value of ["thread-list/thread-list", "stewards/sidebar"]) { + const t = await setup({}, {}, value); + expect(t.uiPreferences.get("sidebar.threadListProvider")).toEqual({ value, revision: 4 }); + expect(t.uiPreferencesWrites).toEqual([]); + } + }); + + it("logs and carries on when the preference cannot be read or written", async () => { + for (const seed of ["fail-list", "fail-set"] as const) { + const t = await setup({}, {}, seed); + expect(t.uiPreferences.get("sidebar.threadListProvider")).toEqual({ value: "__automatic__", revision: 0 }); + expect(t.harness.logEntries.some((entry) => entry.level === "warn" && entry.message.includes("could not pin the sidebar thread list"))).toBe(true); + } + }); +}); diff --git a/plugins/stewards/server.ts b/plugins/stewards/server.ts index df25673a..067c7077 100644 --- a/plugins/stewards/server.ts +++ b/plugins/stewards/server.ts @@ -146,6 +146,42 @@ export interface StewardsDeps { } const errorMessage = (error: unknown) => (error instanceof Error ? error.message : String(error)); + +/** The UI preference that picks the sidebar thread list. */ +export const THREAD_LIST_PROVIDER_KEY = "sidebar.threadListProvider"; +/** bb's bundled thread list; pinning to it leaves the sidebar as it was. */ +export const BUILTIN_THREAD_LIST_ID = "thread-list/thread-list"; +/** What `sidebar.threadListProvider` reads while nothing is pinned. */ +const AUTOMATIC_THREAD_LIST_PROVIDER = "__automatic__"; + +/** + * BB-45: pin bb's own sidebar thread list for clients that have not opted in. + * + * BB-44 registers the stewards list through the exclusive + * `experimental_threadList` slot, and bb resolves an unset (`__automatic__`) + * provider to the first installed list other than the bundled + * `thread-list/thread-list` — the stewards list. Without this pin the sidebar + * would change for everyone the moment BB-44 lands. Set the preference to the + * bundled list on load; an explicit value (including the stewards list the + * footer toggle writes) is left alone. `bb.onInstall` does not run for plugins + * baked into the `bb-server` image, so this runs on load. Best-effort: a + * failure is logged and the sidebar keeps working. + */ +export async function pinSidebarThreadListProvider(bb: BbPluginApi): Promise { + try { + const { preferences } = await bb.sdk.system.uiPreferences.list(); + const entry = preferences[THREAD_LIST_PROVIDER_KEY]; + if (entry !== undefined && entry.value !== AUTOMATIC_THREAD_LIST_PROVIDER) return; + await bb.sdk.system.uiPreferences.set({ + key: THREAD_LIST_PROVIDER_KEY, + value: BUILTIN_THREAD_LIST_ID, + expectedRevision: entry?.revision ?? 0, + }); + bb.log.info(`stewards: pinned the sidebar thread list to ${BUILTIN_THREAD_LIST_ID}; the footer toggle switches it to ${STEWARDS_PLUGIN_ID}/sidebar`); + } catch (error) { + bb.log.warn(`stewards: could not pin the sidebar thread list: ${errorMessage(error)}`); + } +} const clip = (text: string, max: number) => (text.length <= max ? text : `${text.slice(0, max)}… (${text.length - max} more characters)`); const iso = (ms: number) => new Date(ms).toISOString().replace(/\.\d{3}Z$/u, "Z"); const lc = (s: string | null | undefined) => (s ?? "").toLowerCase(); @@ -5531,6 +5567,7 @@ export function createStewardsPlugin(deps: StewardsDeps): (bb: BbPluginApi) => P tagged.clear(); kept.clear(); }; + await pinSidebarThreadListProvider(bb); testHooks.set(bb.pluginId, { sweep, store, db, settings, forgetTags, nightlyPass: (projectId: string, night: string) => loadConfig(projectId, true).then((c) => (c === null ? undefined : nightlyPass(c, night, true))), settle: () => Promise.all([...chains.values()]).then(() => undefined), sentryDoorbell: onSentryDoorbell, sentryLeases }); }; } From cdfa1592019a1fdd3b6d4154d39c2b41580b3967 Mon Sep 17 00:00:00 2001 From: Dylan Trotter Date: Sat, 24 Oct 2026 11:50:48 +0000 Subject: [PATCH 2/2] stewards: cover the unpinned provider reading as on (BB-45) --- plugins/stewards/app.test.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/stewards/app.test.tsx b/plugins/stewards/app.test.tsx index 699576b4..998f2421 100644 --- a/plugins/stewards/app.test.tsx +++ b/plugins/stewards/app.test.tsx @@ -188,9 +188,9 @@ describe("the sidebar-footer toggle (BB-45)", () => { type SetArgs = { key: string; value: string; expectedRevision: number }; /** A `uiPreferences.list()` answer with just the one preference the toggle reads. */ - const listed = (entry: UiPrefEntry) => ({ preferences: { "sidebar.threadListProvider": entry } }) as never; + const listed = (entry: UiPrefEntry | null) => ({ preferences: entry === null ? {} : { "sidebar.threadListProvider": entry } }) as never; - const renderToggle = async (options: { entry: UiPrefEntry; set: (args: SetArgs) => Promise }) => { + const renderToggle = async (options: { entry: UiPrefEntry | null; set: (args: SetArgs) => Promise }) => { const captured = await loadApp(); const item = captured.experimentalSidebarFooterItems[0]!; if (item.kind !== "disclosure") throw new Error("the sidebar footer item is not a disclosure"); @@ -220,6 +220,15 @@ describe("the sidebar-footer toggle (BB-45)", () => { on.slot.lifecycle.unmount(); }); + it("reads an unpinned provider as on, the effective stewards list", async () => { + for (const entry of [null, { value: "__automatic__", revision: 0 }]) { + const { slot } = await renderToggle({ entry, set: echo }); + const toggle = await waitFor(() => slot.getByRole("switch", { name: "Stewards sidebar" })); + expect(toggle.getAttribute("aria-checked")).toBe("true"); + slot.lifecycle.unmount(); + } + }); + it("turns the stewards list on with the stewards list id and the listed revision", async () => { const { slot, set } = await renderToggle({ entry: { value: "thread-list/thread-list", revision: 7 }, set: echo }); fireEvent.click(await waitFor(() => slot.getByRole("switch", { name: "Stewards sidebar" })));