From e666e9533b5b3f37e61755892b221d93b2213314 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 6 Dec 2026 13:52:18 +0800 Subject: [PATCH] test(setup): share default DSH configuration fixture (#17404) --- .../filesystem/dshClientConfiguration.test.ts | 284 +++++------------- 1 file changed, 77 insertions(+), 207 deletions(-) diff --git a/tests/boundary/filesystem/dshClientConfiguration.test.ts b/tests/boundary/filesystem/dshClientConfiguration.test.ts index cde0ccad0b..94fd76981f 100644 --- a/tests/boundary/filesystem/dshClientConfiguration.test.ts +++ b/tests/boundary/filesystem/dshClientConfiguration.test.ts @@ -35,6 +35,10 @@ const command = currentClientRegistrationCommand({ platform: process.platform, }); +const configureDsh = ( + client: Parameters[0], +) => configureClientConfiguration(client, {}, command); + const writeDshYamlRows = (path: string, document: readonly unknown[]) => writeFile(path, stringifyYaml(document)); @@ -202,9 +206,7 @@ describe("DeepSeek Harness Cordis patch registration", () => { name: caller-plugin `; await writeFile(client.configPath, initial); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("# Harness home patch"); const callerPatches = cordisPatches(initial); @@ -233,9 +235,7 @@ describe("DeepSeek Harness Cordis patch registration", () => { await writeDshYamlRows(client.configPath, [ { insert: [{ ...entry, name: "not-the-harness-client", config }] }, ]); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect(parseYaml(await readFile(client.configPath, "utf8"))).toEqual([ { insert: [{ ...entry, config }] }, ]); @@ -317,9 +317,7 @@ describe("DeepSeek Harness registration identity", () => { state: "stale", command: ["redirected-launcher", "mcp"], }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect(parseYaml(await readFile(client.configPath, "utf8"))).toEqual([ { insert: [entry] }, ]); @@ -338,9 +336,7 @@ describe("DeepSeek Harness registration identity", () => { it("creates the patch list for an absent file and empties it on uninstall", async () => { const { home, client } = await harnessClient(); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const created = parseYaml( await readFile(client.configPath, "utf8"), ) as unknown[]; @@ -387,9 +383,7 @@ describe("DeepSeek Harness repair boundaries", () => { remediation: expect.stringContaining("targets a group"), }, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("failed"); + expect((await configureDsh(client)).status).toBe("failed"); expect(await dshStatus(home)).toMatchObject({ state: "stale", command: [...command], @@ -425,9 +419,7 @@ describe("DeepSeek Harness repair boundaries", () => { remediation: expect.stringContaining("Malformed Cordis patches"), }, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("failed"); + expect((await configureDsh(client)).status).toBe("failed"); expect(await readFile(client.configPath, "utf8")).toBe(initial); const host = systemUninstallHost(home); @@ -451,9 +443,7 @@ describe("DeepSeek Harness repair boundaries", () => { status: "invalid", remediation: expect.stringContaining("Malformed Cordis patches"), }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("failed"); + expect((await configureDsh(client)).status).toBe("failed"); expect(await readFile(client.configPath, "utf8")).toBe(initial); }, ); @@ -462,9 +452,7 @@ describe("DeepSeek Harness repair boundaries", () => { const { client } = await harnessClient(); await writeFile(client.configPath, "- insert: null\n"); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); }); }); @@ -505,9 +493,7 @@ it("recognizes REA inside nested Cordis groups and removes only its row", async state: "invalid", remediation: expect.stringContaining("group"), }); - expect((await configureClientConfiguration(client, {}, command)).status).toBe( - "failed", - ); + expect((await configureDsh(client)).status).toBe("failed"); expect(await readFile(client.configPath, "utf8")).toBe(initial); const host = systemUninstallHost(home); @@ -608,9 +594,7 @@ describe("DeepSeek Harness expression-backed structure", () => { async (initial, state) => { const { home, client } = await harnessClient(); await writeFile(client.configPath, initial); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("failed"); + expect((await configureDsh(client)).status).toBe("failed"); expect(await dshStatus(home)).toMatchObject({ state }); expect( await inspectClientConfiguration(client, {}, command), @@ -637,16 +621,12 @@ describe("DeepSeek Harness registration state", () => { ]); expect(await dshStatus(home)).toMatchObject({ state: "stale", command }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const patches = parseYaml(await readFile(client.configPath, "utf8")) as { insert: { disabled?: unknown }[]; }[]; expect(patches[0]?.insert[0]?.disabled).toBeUndefined(); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("inserts an otherwise matching direct-only registration", async () => { @@ -654,9 +634,7 @@ describe("DeepSeek Harness registration state", () => { const entry = canonicalEntry(); await writeDshYamlRows(client.configPath, [entry]); expect(await dshStatus(home)).toMatchObject({ state: "missing" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect(parseYaml(await readFile(client.configPath, "utf8"))).toEqual([ { insert: [entry] }, ]); @@ -668,9 +646,7 @@ describe("DeepSeek Harness registration state", () => { text.replace("args: [mcp]", "args: [mcp]\n cwd: /custom/workdir"); await writeFile(client.configPath, withCwd(staleRegistrationYaml())); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const patches = parseYaml(await readFile(client.configPath, "utf8")) as { insert: { config: { cwd?: unknown; command?: unknown } }[]; }[]; @@ -678,9 +654,7 @@ describe("DeepSeek Harness registration state", () => { expect(patches[0]?.insert[0]?.config.command).toBe(command[0]); // An otherwise-matching row with caller fields is current, not stale. - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); }); @@ -718,9 +692,7 @@ describe("DeepSeek Harness tool call timeout", () => { ], }, ]); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect( cordisPatches(await readFile(client.configPath, "utf8"))[0]?.insert?.[0] ?.config?.toolCallTimeoutMs, @@ -746,9 +718,7 @@ describe("DeepSeek Harness tool call timeout", () => { advisory: "The configured toolCallTimeoutMs (300000 ms) is shorter than the 450000 ms REA recommends: its known provider allowance (330000 ms) plus 120000 ms of operation headroom. Setup writes toolCallTimeoutMs = 450000; it never lowers a longer value.", }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect( cordisPatches(await readFile(client.configPath, "utf8"))[0]?.insert?.[0] ?.config?.toolCallTimeoutMs, @@ -773,17 +743,13 @@ describe("DeepSeek Harness tool call timeout repair", () => { `, ); expect(await dshStatus(home)).toMatchObject({ state: "stale" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect( cordisPatches(await readFile(client.configPath, "utf8"))[0]?.insert?.[0] ?.config?.toolCallTimeoutMs, ).toBe(450_000); expect(await dshStatus(home)).toMatchObject({ state: "aligned" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("repairs a malformed literal timeout with the recommended deadline", async () => { @@ -799,9 +765,7 @@ describe("DeepSeek Harness tool call timeout repair", () => { ], }, ]); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect( cordisPatches(await readFile(client.configPath, "utf8"))[0]?.insert?.[0] ?.config?.toolCallTimeoutMs, @@ -820,9 +784,7 @@ describe("DeepSeek Harness tool call timeout repair", () => { const original = document.toString(); await writeFile(client.configPath, original); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect(await readFile(client.configPath, "utf8")).toBe(original); expect(await dshStatus(home)).toMatchObject({ state: "aligned", @@ -861,13 +823,9 @@ describe("DeepSeek Harness canonical row repair", () => { stringifyYaml([row, row], { aliasDuplicateObjects: false }), ); expect(await dshStatus(home)).toMatchObject({ state: "stale", command }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect(parseYaml(await readFile(client.configPath, "utf8"))).toEqual([row]); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect(await dshStatus(home)).toMatchObject({ state: "aligned", command }); }); @@ -879,9 +837,7 @@ describe("DeepSeek Harness canonical row repair", () => { `), ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("!!js process.cwd()"); expect(text).toContain("# caller launch directory"); @@ -892,9 +848,7 @@ describe("DeepSeek Harness canonical row repair", () => { expect(patches[0]?.insert[0]?.config.command).toBe(command[0]); expect(patches[0]?.insert[0]?.config.cwd).toBe("process.cwd()"); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect(await readFile(client.configPath, "utf8")).toContain( "!!js process.cwd()", ); @@ -922,9 +876,7 @@ describe("DeepSeek Harness canonical row repair", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("!!js process.cwd()"); expect(text).not.toContain("stale-launcher"); @@ -949,9 +901,7 @@ describe("DeepSeek Harness document edges", () => { `), ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("!!js process.env.TOKEN"); expect(text).toContain("# caller token"); @@ -966,9 +916,7 @@ describe("DeepSeek Harness document edges", () => { TOKEN: "process.env.TOKEN", }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect(await readFile(client.configPath, "utf8")).toContain( "!!js process.env.TOKEN", ); @@ -1019,18 +967,14 @@ describe("DeepSeek Harness document edges", () => { }) ).find(({ client: name }) => name === "dsh"), ).toMatchObject({ state: "missing" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("# harness notes"); expect(text).toContain("# keep me"); expect(text).toContain("id: rea-mcp"); expect(text).not.toMatch(/^null$/mu); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect((await systemUninstallHost(home).removeClient(client)).status).toBe( "removed", ); @@ -1113,15 +1057,11 @@ describe("DeepSeek Harness entry ownership", () => { ); expect(await registration(home)).toMatchObject({ state: "stale" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).not.toContain("DISABLE_REA"); expect(text).not.toContain("disabled:"); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect(await registration(home)).toMatchObject({ state: "aligned" }); }); @@ -1137,9 +1077,7 @@ describe("DeepSeek Harness entry ownership", () => { // The expression is not a literal path, so doctor can still classify the // row instead of rejecting the file. expect(await registration(home)).toMatchObject({ state: "stale" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("!!js process.env.GHIDRA_INSTALL_DIR"); expect(text).not.toContain("stale-launcher"); @@ -1149,9 +1087,7 @@ describe("DeepSeek Harness entry ownership", () => { expect(patches[0]?.insert[0]?.config.env).toEqual({ GHIDRA_INSTALL_DIR: "process.env.GHIDRA_INSTALL_DIR", }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect(await readFile(client.configPath, "utf8")).toContain( "!!js process.env.GHIDRA_INSTALL_DIR", ); @@ -1261,9 +1197,7 @@ describe("DeepSeek Harness alias collapse", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("*other"); expect(text).not.toContain("*row"); @@ -1273,9 +1207,7 @@ describe("DeepSeek Harness alias collapse", () => { (insert ?? []).filter((entry) => entry.id === "rea-mcp"), ); expect(reaRows).toHaveLength(1); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("collapses an aliased entry inside one insertion", async () => { @@ -1295,9 +1227,7 @@ describe("DeepSeek Harness alias collapse", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).not.toContain("*entry"); const patches = parseYaml(text) as { insert?: { id?: string }[] }[]; @@ -1306,9 +1236,7 @@ describe("DeepSeek Harness alias collapse", () => { (insert ?? []).filter((entry) => entry.id === "rea-mcp"), ), ).toHaveLength(1); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); }); @@ -1330,9 +1258,7 @@ describe("DeepSeek Harness alias targets", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("!!js process.cwd()"); expect(text).toContain("# caller launch directory"); @@ -1342,9 +1268,7 @@ describe("DeepSeek Harness alias targets", () => { const row = patches.find((patch) => patch.insert !== undefined); expect(row?.insert?.[0]?.config?.cwd).toBe("process.cwd()"); expect(row?.insert?.[0]?.config?.command).toBe(command[0]); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); }); @@ -1369,9 +1293,7 @@ describe("DeepSeek Harness alias identity", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).not.toContain("*rows"); expect(text).toContain("stale-launcher"); @@ -1387,9 +1309,7 @@ describe("DeepSeek Harness alias identity", () => { config: expect.objectContaining({ command: command[0] }), }), ]); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("keeps an aliased Cordis tag on an environment value", async () => { @@ -1411,16 +1331,12 @@ describe("DeepSeek Harness alias identity", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("!!js process.env.TOKEN"); expect(text).toContain("*expr"); expect(text).not.toContain("stale-launcher"); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("recognizes an aliased entry id", async () => { @@ -1440,9 +1356,7 @@ describe("DeepSeek Harness alias identity", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const patches = parseYaml(await readFile(client.configPath, "utf8")) as { insert?: { id?: string }[]; }[]; @@ -1477,15 +1391,11 @@ describe("DeepSeek Harness alias cleanup", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("!!js process.env.TOKEN"); expect(text).not.toContain("stale-launcher"); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("does not validate an aliased Cordis path expression as a literal", async () => { @@ -1515,9 +1425,7 @@ describe("DeepSeek Harness alias cleanup", () => { }) ).find(({ client: name }) => name === "dsh"), ).toMatchObject({ state: "stale" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect(await readFile(client.configPath, "utf8")).toContain( "!!js process.env.GHIDRA_INSTALL_DIR", ); @@ -1588,9 +1496,7 @@ describe("DeepSeek Harness root aliases", () => { state: "stale", command: ["aliased-launcher", "mcp"], }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const entry = canonicalEntry(); expect(cordisPatches(await readFile(client.configPath, "utf8"))).toEqual([ { @@ -1654,9 +1560,7 @@ describe("DeepSeek Harness root aliases", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("!!js process.cwd()"); expect(text).not.toContain("stale-launcher"); @@ -1700,9 +1604,7 @@ describe("DeepSeek Harness inert anchors", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const inserted = loadedInserts(await readFile(client.configPath, "utf8")); expect(inserted.filter((entry) => entry.id === "other-tool")).toHaveLength( 1, @@ -1712,9 +1614,7 @@ describe("DeepSeek Harness inert anchors", () => { config: expect.objectContaining({ command: command[0] }), }), ]); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("keeps unrelated rows when uninstall removes that root alias", async () => { @@ -1775,7 +1675,7 @@ describe("DeepSeek Harness alias anchors", () => { await writeFile(client.configPath, initial); const result = operation === "setup" - ? await configureClientConfiguration(client, {}, command) + ? await configureDsh(client) : await systemUninstallHost(home).removeClient(client); expect(result.status).toBe( operation === "setup" ? "configured" : "removed", @@ -1821,17 +1721,13 @@ describe("DeepSeek Harness alias anchors", () => { `, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).not.toContain("*entryId"); expect( loadedInserts(text).filter((entry) => entry.id === "rea-mcp"), ).toHaveLength(1); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("drops a replayed root alias after its insert alias is emptied", async () => { @@ -1916,9 +1812,7 @@ describe("DeepSeek Harness runtime environment validation", () => { state: "invalid", remediation: expect.stringContaining(setting), }); - expect( - await configureClientConfiguration(client, {}, command), - ).toMatchObject({ status: "failed" }); + expect(await configureDsh(client)).toMatchObject({ status: "failed" }); expect(await readFile(client.configPath, "utf8")).toBe(original); await expect( access(`${client.configPath}.rea.backup`), @@ -1960,17 +1854,13 @@ describe("DeepSeek Harness runtime environment validation", () => { expect(await inspectClientConfiguration(client, {}, command)).toMatchObject( { status: "update" }, ); - expect( - await configureClientConfiguration(client, {}, command), - ).toMatchObject({ status: "configured" }); + expect(await configureDsh(client)).toMatchObject({ status: "configured" }); const configured = await readFile(client.configPath, "utf8"); expect(configured).toContain("!!js process.env.REA_GHIDRA_LANGUAGE_ID"); expect(configured).toContain("!!js process.env.HOPPER_LOADER_ARGS_JSON"); expect(configured).toContain("CALLER_SETTING: keep"); expect(await dshStatus(home)).toMatchObject({ state: "aligned" }); - expect( - await configureClientConfiguration(client, {}, command), - ).toMatchObject({ status: "unchanged" }); + expect(await configureDsh(client)).toMatchObject({ status: "unchanged" }); await expect( inspectClientConfiguration( client, @@ -2031,7 +1921,7 @@ describe("DeepSeek Harness source ownership", () => { await writeFile(client.configPath, initial); const result = operation === "setup" - ? await configureClientConfiguration(client, {}, command) + ? await configureDsh(client) : await systemUninstallHost(home).removeClient(client); expect(result.status).toBe( operation === "setup" ? "configured" : "removed", @@ -2139,16 +2029,12 @@ describe("DeepSeek Harness registration applicability", () => { config: {command: stale, extra: {2: two}} `; await writeFile(client.configPath, initial); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const rows = cordisPatches(await readFile(client.configPath, "utf8"))[0] ?.insert; expect(rows?.[0]?.config).toEqual({ "1": "one", true: "yes" }); expect(rows?.[1]?.config?.extra).toEqual({ "2": "two" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); }); it("uses direct-patch names as selectors and preserves the actual effective config", async () => { @@ -2172,9 +2058,7 @@ describe("DeepSeek Harness registration applicability", () => { ]); await writeFile(client.configPath, initial); expect(await dshStatus(home)).toMatchObject({ state: "stale" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect( cordisPatches(await readFile(client.configPath, "utf8"))[0]?.insert?.[0] ?.config?.env, @@ -2197,9 +2081,7 @@ describe("DeepSeek Harness registration applicability", () => { yaml.setIn([0, "insert", 0, "config", key], expression); await writeFile(client.configPath, yaml.toString()); expect((await dshStatus(home))?.state).not.toBe("aligned"); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); expect(cordisPatches(await readFile(client.configPath, "utf8"))).toEqual([ { insert: [entry] }, ]); @@ -2227,9 +2109,7 @@ describe("DeepSeek Harness registration applicability", () => { }, ]); await writeFile(client.configPath, initial); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); expect(await dshStatus(home)).toMatchObject({ state: "aligned" }); expect(await readFile(client.configPath, "utf8")).toBe(initial); }); @@ -2248,9 +2128,7 @@ describe("DeepSeek Harness registration applicability", () => { ])("refuses unsafe YAML without mutation: %s", async (initial) => { const { client } = await harnessClient(); await writeFile(client.configPath, initial); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("failed"); + expect((await configureDsh(client)).status).toBe("failed"); expect(await readFile(client.configPath, "utf8")).toBe(initial); await expect( readFile(`${client.configPath}.rea.backup`), @@ -2269,9 +2147,7 @@ describe("DeepSeek Harness ownership and editability", () => { const { home, client } = await harnessClient(); await writeFile(client.configPath, initial); expect(await dshStatus(home)).toMatchObject({ state: "invalid" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("failed"); + expect((await configureDsh(client)).status).toBe("failed"); const host = systemUninstallHost(home); expect(await host.inspectClient(client)).toMatchObject({ status: "failed", @@ -2319,9 +2195,7 @@ describe("DeepSeek Harness ownership and editability", () => { const initial = yaml.toString(); await writeFile(client.configPath, initial); expect(await dshStatus(home)).toMatchObject({ state: "stale" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("failed"); + expect((await configureDsh(client)).status).toBe("failed"); expect(await readFile(client.configPath, "utf8")).toBe(initial); const host = systemUninstallHost(home); expect(await host.inspectClient(client)).toBeUndefined(); @@ -2357,7 +2231,7 @@ describe("DeepSeek Harness aliased mapping keys", () => { await writeFile(client.configPath, initial); const result = operation === "setup" - ? await configureClientConfiguration(client, {}, command) + ? await configureDsh(client) : await systemUninstallHost(home).removeClient(client); expect(result.status).toBe( operation === "setup" ? "configured" : "removed", @@ -2371,9 +2245,7 @@ describe("DeepSeek Harness aliased mapping keys", () => { if (operation === "setup") { expect(owned[0]?.config).toMatchObject({ env: { TOKEN: "keep-me" } }); expect(await dshStatus(home)).toMatchObject({ state: "aligned" }); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("unchanged"); + expect((await configureDsh(client)).status).toBe("unchanged"); } expect(await readFile(`${client.configPath}.rea.backup`, "utf8")).toBe( initial, @@ -2400,9 +2272,9 @@ describe("DeepSeek Harness ordered selector applicability", () => { expect((await dshStatus(home))?.state).toBe( position === "before insertion" ? "aligned" : "stale", ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe(position === "before insertion" ? "unchanged" : "configured"); + expect((await configureDsh(client)).status).toBe( + position === "before insertion" ? "unchanged" : "configured", + ); expect(await dshStatus(home)).toMatchObject({ state: "aligned" }); const text = await readFile(client.configPath, "utf8"); expect( @@ -2613,9 +2485,7 @@ ${row("first-launcher")}# caller operation ${row("second-launcher")}`, ); - expect( - (await configureClientConfiguration(client, {}, command)).status, - ).toBe("configured"); + expect((await configureDsh(client)).status).toBe("configured"); const text = await readFile(client.configPath, "utf8"); expect(text).toContain("# caller operation"); expect(loadedInserts(text)).toHaveLength(1);