From 91ba9f2412d460f2d19f1900184b75570c777957 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Wed, 12 Aug 2026 21:04:50 -0400 Subject: [PATCH] fix(tui): repair baseline unit failures (#42198) --- packages/drive/test/cli/integration.test.ts | 10 +++++++--- packages/drive/test/instance/config.test.ts | 2 +- packages/tui/src/mini/mono.ts | 5 ++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/drive/test/cli/integration.test.ts b/packages/drive/test/cli/integration.test.ts index 5bdf18dff18..7573cabbdb4 100644 --- a/packages/drive/test/cli/integration.test.ts +++ b/packages/drive/test/cli/integration.test.ts @@ -120,7 +120,9 @@ describe("opencode-drive", () => { expect(initStatus).toBe(0) const artifacts = initOutput.trim() expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).exists()).toBe(true) - expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({ + expect( + Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).text()), + ).toMatchObject({ model: "simulation/gpt-sim-model", snapshots: false, permissions: [{ action: "*", resource: "*", effect: "allow" }], @@ -765,13 +767,15 @@ describe("opencode-drive", () => { gitWriteError: expect.stringContaining("must not modify Git metadata"), matches: true, }) - expect(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({ + expect( + Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "opencode.jsonc")).text()), + ).toMatchObject({ autoupdate: false, model: "simulation/gpt-sim-model", providers: { simulation: { models: { "gpt-sim-model": {} } } }, test: { declared: true, setup: true }, }) - expect(await Bun.file(join(artifacts, "files", ".opencode", "tui.jsonc")).json()).toEqual({ + expect(Bun.JSONC.parse(await Bun.file(join(artifacts, "files", ".opencode", "tui.jsonc")).text())).toEqual({ test: { declared: true, setup: true }, }) const backendEvents = (await Bun.file(join(artifacts, "backend-events.jsonl")).text()) diff --git a/packages/drive/test/instance/config.test.ts b/packages/drive/test/instance/config.test.ts index d1263b485e2..cd6d187fe82 100644 --- a/packages/drive/test/instance/config.test.ts +++ b/packages/drive/test/instance/config.test.ts @@ -15,7 +15,7 @@ describe("instance configuration", () => { const root = await initializeInstance() artifacts.push(root) - expect(await Bun.file(join(root, "files", ".opencode", "opencode.jsonc")).json()).toMatchObject({ + expect(Bun.JSONC.parse(await Bun.file(join(root, "files", ".opencode", "opencode.jsonc")).text())).toMatchObject({ model: "simulation/gpt-sim-model", providers: { simulation: { diff --git a/packages/tui/src/mini/mono.ts b/packages/tui/src/mini/mono.ts index 62205eba662..9760996e28f 100644 --- a/packages/tui/src/mini/mono.ts +++ b/packages/tui/src/mini/mono.ts @@ -91,7 +91,6 @@ function monoRenderable(renderable: Renderable): void { function monoCode(renderable: CodeRenderable): void { const onChunks = renderable.onChunks - const prose = renderable.filetype === "markdown" && onChunks !== undefined renderable.onChunks = async (chunks, context) => monoChunks((await onChunks?.(chunks, context)) ?? chunks) renderable.treeSitterClient = monoTreeSitter(renderable.treeSitterClient) @@ -112,11 +111,11 @@ function monoCode(renderable: CodeRenderable): void { configurable: true, get: contentGetter, set(value: string) { - if (!prose || !isStyledText(Reflect.get(renderable, "_initialStyledText"))) { + if (renderable.filetype !== "markdown" || !isStyledText(Reflect.get(renderable, "_initialStyledText"))) { renderable.drawUnstyledText = true renderable.initialStyledText = stringToStyledText(value) } - contentSetter(value) + contentSetter(renderable.filetype === "markdown" ? value : monoText(value)) }, })