Skip to content

Commit c00a11d

Browse files
Lock landing survival on MCP connect failure (CL-5600) (#458)
Product code already routes mcp.status failures through surfaceSystemNotice (CL-5618). Strengthen the product-host channel test so a re-route through appendStreamRow cannot wipe the mountain without failing the suite.
1 parent 519eec0 commit c00a11d

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

src/tui/runtime-channels.test.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { describe, expect, test } from "bun:test"
1313

1414
import { createHarness } from "./harness.js"
1515
import { mountProductHost, type ProductHostConfig } from "./product-host.js"
16+
import { isLanding } from "./shell.js"
1617

1718
async function mountHeadless(overrides: Partial<ProductHostConfig> = {}): Promise<{
1819
host: Awaited<ReturnType<typeof mountProductHost>>
@@ -129,15 +130,36 @@ describe("mcp.status channel", () => {
129130
}
130131
})
131132

132-
test("a failed connect keeps a row saying the tools are gone", async () => {
133-
const { emitter, frame, cleanup } = await mountHeadless()
133+
test("a failed connect keeps the landing mountain and rides the notice strip (CL-5600)", async () => {
134+
// Full product-host path: mcp.status → mcpNotice → surfaceSystemNotice.
135+
// The unit landing suite covers surfaceSystemNotice alone; this locks the
136+
// wire so a future re-route through appendStreamRow cannot wipe the hero
137+
// again without failing here.
138+
const { host, emitter, frame, cleanup } = await mountHeadless()
134139
try {
140+
expect(isLanding(host.shell)).toBe(true)
141+
const before = await frame()
142+
const markBefore = before
143+
.split("\n")
144+
.filter((row) => /[]/.test(row)).length
145+
expect(markBefore).toBeGreaterThan(0)
146+
135147
emitter.emit("mcp.status", {
136148
name: "linear",
137149
state: "failed",
138150
error: "ECONNREFUSED",
139151
})
140-
expect(await frame()).toContain("its tools are unavailable")
152+
const painted = await frame()
153+
expect(painted).toContain("its tools are unavailable")
154+
expect(painted).toContain("mcp linear did not connect")
155+
// Still on landing: no transcript row, mountain still painted, wording on flash.
156+
expect(isLanding(host.shell)).toBe(true)
157+
expect(host.shell.streamLog).toEqual([])
158+
expect(host.shell.statusFlash).toContain("mcp linear did not connect")
159+
const markAfter = painted
160+
.split("\n")
161+
.filter((row) => /[]/.test(row)).length
162+
expect(markAfter).toBe(markBefore)
141163
} finally {
142164
cleanup()
143165
}

0 commit comments

Comments
 (0)