Skip to content

Commit 22f7a58

Browse files
t3dotggclaude
andcommitted
test: update cross-client projection test for MCP slimming
The integration test asserted MCP payloads pass through verbatim; it now asserts the slimmed shape and that the expanded row's rendered fields survive on both clients. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 95ab949 commit 22f7a58

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

‎apps/server/test/ActivityPayloadProjection.test.ts‎

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ const fixtures = [
117117
server: "repository",
118118
tool: "search",
119119
arguments: { query: "activity projection" },
120-
aggregatedOutput: "mcp payload remains available",
120+
aggregatedOutput: "mcp bulk is dropped",
121121
},
122-
ignored: "MCP data is rendered verbatim",
122+
ignored: "top-level bulk",
123123
}),
124124
makeActivity("search", "web_search", {
125125
rawOutput: {
@@ -184,13 +184,37 @@ describe("projectActivityPayload", () => {
184184
});
185185
});
186186

187-
it("passes MCP tool data through unchanged", () => {
188-
expect(projectActivityPayload(fixtures[4]!)).toBe(fixtures[4]);
187+
it("slims MCP tool data to the fields the expanded row renders", () => {
188+
expect(projectActivityPayload(fixtures[4]!).payload).toEqual({
189+
itemType: "mcp_tool_call",
190+
title: "mcp_tool_call",
191+
detail: "mcp_tool_call detail",
192+
status: "completed",
193+
requestKind: "command",
194+
data: {
195+
item: {
196+
server: "repository",
197+
tool: "search",
198+
arguments: { query: "activity projection" },
199+
},
200+
},
201+
});
189202
});
190203

191204
it("keeps current web and mobile derived output identical for every tool item type", () => {
192205
for (const activity of fixtures) {
193206
const projected = projectActivityPayload(activity);
207+
if (activity === fixtures[4]) {
208+
// MCP is the one deliberate difference: the expanded row's toolData
209+
// loses result bulk but keeps the rendered identity fields.
210+
const [entry] = deriveWorkLogEntries([projected]);
211+
expect(entry?.toolData).toEqual({
212+
server: "repository",
213+
tool: "search",
214+
arguments: { query: "activity projection" },
215+
});
216+
continue;
217+
}
194218
expect(deriveWorkLogEntries([projected])).toEqual(deriveWorkLogEntries([activity]));
195219
expect(comparableThreadFeed([projected])).toEqual(comparableThreadFeed([activity]));
196220
}
@@ -328,12 +352,12 @@ describe("context-window snapshot dedup", () => {
328352
);
329353
});
330354

331-
it("leaves snapshots without context-window activities untouched", () => {
355+
it("applies only payload slimming when there are no context-window activities", () => {
332356
const projected = projectThreadDetailSnapshot({
333357
snapshotSequence: 7,
334358
thread: makeThread([fixtures[4]!]),
335359
});
336-
expect(projected.thread.activities).toEqual([fixtures[4]]);
360+
expect(projected.thread.activities).toEqual([projectActivityPayload(fixtures[4]!)]);
337361
});
338362

339363
it("does not filter live activity-appended events", () => {

0 commit comments

Comments
 (0)