Python
Right rail: hidden by default, toggle persists per-device
Rohit C Prasade7bd499f403c
diff --git a/surfaces/gui/e2e/fixtures.ts b/surfaces/gui/e2e/fixtures.tsindex b6fccb05..36eb4183 100644--- a/surfaces/gui/e2e/fixtures.ts+++ b/surfaces/gui/e2e/fixtures.ts@@ -354,6 +354,16 @@ const PROVIDERS = [/** Install the API + WebSocket mocks on a page. Returns handles for assertions/seed data. */export async function mockApi(page: import("@playwright/test").Page) {+ // The rail defaults to HIDDEN (UX-038 follow-up). Existing specs were written+ // against a visible rail, so run them in the "user opened it" state; the+ // default + persistence themselves are pinned by rail-default.spec.ts.+ await page.addInitScript(() => {+ try {+ if (!localStorage.getItem("ocw-e2e-rail-default")) {+ localStorage.setItem("coworker:rail-hidden:v1", "0");+ }+ } catch { /* ignore */ }+ });const subscriptions: any[] = [// One existing subscription (a non-pinned session) so the Slack page's per-workspace// "Listening" row has an entry. Relay-mode channels are team-qualified (slack:T…/C…).diff --git a/surfaces/gui/e2e/rail-default.spec.ts b/surfaces/gui/e2e/rail-default.spec.tsnew file mode 100644index 00000000..acd2827f--- /dev/null+++ b/surfaces/gui/e2e/rail-default.spec.ts@@ -0,0 +1,45 @@+// UX-038 follow-up (owner ruling 2026-08-21): the right rail starts hidden and the+// topbar toggle's choice survives a restart. Deep links (artifact chips) force-show+// transiently without overwriting the stored preference.+import { expect } from "@playwright/test";+import { test } from "./fixtures";++async function clearRailPref(page: import("@playwright/test").Page) {+ await page.goto("/");+ await page.evaluate(() => {+ localStorage.setItem("ocw-e2e-rail-default", "1"); // opt out of the fixture seed+ localStorage.removeItem("coworker:rail-hidden:v1");+ });+ await page.reload();+}++test("rail is hidden by default; the toggle persists across restarts", async ({ page }) => {+ await clearRailPref(page);+ await expect(page.getByTestId("rail-toggle-artifacts")).toHaveCount(0);++ // Show it — the choice must survive a reload ("restart").+ await page.getByRole("button", { name: "Show side panel" }).click();+ await expect(page.getByTestId("rail-toggle-artifacts")).toBeVisible();+ await page.reload();+ await expect(page.getByTestId("rail-toggle-artifacts")).toBeVisible();++ // Hide it — that persists too.+ await page.getByRole("button", { name: "Hide side panel" }).click();+ await page.reload();+ await expect(page.getByTestId("rail-toggle-artifacts")).toHaveCount(0);+});++test("an artifact chip force-shows the rail without overwriting the hidden preference", async ({ page }) => {+ await clearRailPref(page);+ // "show the report" makes the fixture echo carry an [artifact:] chip.+ await page.getByPlaceholder(/Ask the coworker/).fill("show the report");+ await page.getByRole("button", { name: "Send" }).click();++ // The transcript's artifact chip opens the viewer even though the rail is hidden.+ await page.getByTestId("artifact-chip").click();+ await expect(page.getByTestId("artifact-frame")).toBeVisible();++ // The stored preference is untouched: a reload starts hidden again.+ await page.reload();+ await expect(page.getByTestId("rail-toggle-artifacts")).toHaveCount(0);+});diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsxindex b04f353f..32234c21 100644--- a/surfaces/gui/src/App.tsx+++ b/surfaces/gui/src/App.tsx@@ -117,6 +117,7 @@ function normalizeTodos(raw: unknown): TodoItem[] {// consults the real persona's requires_folder once available).const gatesWorkspaceFallback = (a: string) => a === "code";const LAST_SESSION_KEY = "coworker:last-session-by-agent:v1";+const RAIL_HIDDEN_KEY = "coworker:rail-hidden:v1";const NAV_COLLAPSED_KEY = "coworker:nav-collapsed:v1";type LastSession = { sessionId: string; workspace: string; updatedAt: number };@@ -283,7 +284,16 @@ export function App() {const [boardDetailId, setBoardDetailId] = useState<number | null>(null);// # team chat overlay — opened from the team entry's chat row.const [chatTeam, setChatTeam] = useState<string | null>(null);- const [railHidden, setRailHidden] = useState(false);+ // UX-038 follow-up (owner ruling 2026-08-21): the rail starts HIDDEN and the+ // topbar toggle persists per-device. Deep links (artifact/board chips, Access)+ // still force-show transiently — they never overwrite the stored preference.+ const [railHidden, setRailHidden] = useState<boolean>(() => {+ try { return localStorage.getItem(RAIL_HIDDEN_KEY) !== "0"; } catch { return true; }+ });+ const setRailHiddenPersist = useCallback((v: boolean) => {+ setRailHidden(v);+ try { localStorage.setItem(RAIL_HIDDEN_KEY, v ? "1" : "0"); } catch { /* best effort */ }+ }, []);// Left-nav collapse (⌘B): when collapsed the sidebar leaves the grid so content reclaims the// width; hovering the left edge peeks it back as a floating overlay. Persisted per-device.const [navCollapsed, setNavCollapsed] = useState<boolean>(() => {@@ -1786,7 +1796,7 @@ export function App() {{/* Right: session-settings icon (§23) + panel toggle. Model/mode/persona chrome isgone — the facts live in the subtitle, the controls in the composer (§22). */}<div className="main-topbar-side main-topbar-actions" onPointerDown={beginWindowDrag}>- {agent === "cowork" && railHidden && artifactCount > 0 && (+ {railHidden && artifactCount > 0 && (<buttonclassName="topbar-artifacts-btn"onMouseDown={(e) => e.stopPropagation()}@@ -1804,7 +1814,7 @@ export function App() {<buttonclassName="topbar-icon-btn"onMouseDown={(e) => e.stopPropagation()}- onClick={() => setRailHidden((h) => !h)}+ onClick={() => setRailHiddenPersist(!railHidden)}aria-label={railHidden ? "Show side panel" : "Hide side panel"}title={railHidden ? "Show side panel" : "Hide side panel"}>