From dd44f69e2bae6f82d4cb134ccc573c953c485409 Mon Sep 17 00:00:00 2001 From: dotta Date: Fri, 20 Mar 2026 08:17:00 -0500 Subject: [PATCH] Fix PAP-576 settings toggles and transcript default Co-Authored-By: Paperclip --- ui/src/adapters/transcript.test.ts | 30 +++++++++++++++++++ ui/src/adapters/transcript.ts | 2 +- ui/src/pages/InstanceExperimentalSettings.tsx | 6 ++-- ui/src/pages/InstanceGeneralSettings.tsx | 6 ++-- 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 ui/src/adapters/transcript.test.ts diff --git a/ui/src/adapters/transcript.test.ts b/ui/src/adapters/transcript.test.ts new file mode 100644 index 00000000..8b56163e --- /dev/null +++ b/ui/src/adapters/transcript.test.ts @@ -0,0 +1,30 @@ +import { describe, expect, it } from "vitest"; +import { buildTranscript, type RunLogChunk } from "./transcript"; + +describe("buildTranscript", () => { + const ts = "2026-03-20T13:00:00.000Z"; + const chunks: RunLogChunk[] = [ + { ts, stream: "stdout", chunk: "opened /Users/dotta/project\n" }, + { ts, stream: "stderr", chunk: "stderr /Users/dotta/project" }, + ]; + + it("defaults username censoring to off when options are omitted", () => { + const entries = buildTranscript(chunks, (line, entryTs) => [{ kind: "stdout", ts: entryTs, text: line }]); + + expect(entries).toEqual([ + { kind: "stdout", ts, text: "opened /Users/dotta/project" }, + { kind: "stderr", ts, text: "stderr /Users/dotta/project" }, + ]); + }); + + it("still redacts usernames when explicitly enabled", () => { + const entries = buildTranscript(chunks, (line, entryTs) => [{ kind: "stdout", ts: entryTs, text: line }], { + censorUsernameInLogs: true, + }); + + expect(entries).toEqual([ + { kind: "stdout", ts, text: "opened /Users/d****/project" }, + { kind: "stderr", ts, text: "stderr /Users/d****/project" }, + ]); + }); +}); diff --git a/ui/src/adapters/transcript.ts b/ui/src/adapters/transcript.ts index 238764ae..98b19454 100644 --- a/ui/src/adapters/transcript.ts +++ b/ui/src/adapters/transcript.ts @@ -29,7 +29,7 @@ export function buildTranscript( ): TranscriptEntry[] { const entries: TranscriptEntry[] = []; let stdoutBuffer = ""; - const redactionOptions = { enabled: opts?.censorUsernameInLogs ?? true }; + const redactionOptions = { enabled: opts?.censorUsernameInLogs ?? false }; for (const chunk of chunks) { if (chunk.stream === "stderr") { diff --git a/ui/src/pages/InstanceExperimentalSettings.tsx b/ui/src/pages/InstanceExperimentalSettings.tsx index 0a19ffd2..ac04ae07 100644 --- a/ui/src/pages/InstanceExperimentalSettings.tsx +++ b/ui/src/pages/InstanceExperimentalSettings.tsx @@ -83,15 +83,15 @@ export function InstanceExperimentalSettings() { aria-label="Toggle isolated workspaces experimental setting" disabled={toggleMutation.isPending} className={cn( - "relative inline-flex h-6 w-11 items-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60", + "relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60", enableIsolatedWorkspaces ? "bg-green-600" : "bg-muted", )} onClick={() => toggleMutation.mutate(!enableIsolatedWorkspaces)} > diff --git a/ui/src/pages/InstanceGeneralSettings.tsx b/ui/src/pages/InstanceGeneralSettings.tsx index b73f488e..9720c98f 100644 --- a/ui/src/pages/InstanceGeneralSettings.tsx +++ b/ui/src/pages/InstanceGeneralSettings.tsx @@ -82,15 +82,15 @@ export function InstanceGeneralSettings() { aria-label="Toggle username log censoring" disabled={toggleMutation.isPending} className={cn( - "relative inline-flex h-6 w-11 items-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60", + "relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60", censorUsernameInLogs ? "bg-green-600" : "bg-muted", )} onClick={() => toggleMutation.mutate(!censorUsernameInLogs)} >