Skip to content

Commit edbce8e

Browse files
committed
fix(test): use plain marker string for review mock matcher
The patchMatch function was using JSON-escaped patch text to match against the serialized request body. This fails with the responses API (/v1/responses) because the patch text gets double-escaped when nested inside the JSON body. Use a simple unique marker string instead.
1 parent 05572e7 commit edbce8e

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

packages/app/e2e/session/session-review.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ function edit(file: string, prev: string, next: string) {
4040
)
4141
}
4242

43-
function patchMatch(patchText: string) {
44-
const escaped = JSON.stringify(patchText).slice(1, -1)
45-
return (hit: { body: Record<string, unknown> }) => bodyText(hit).includes(escaped)
43+
function patchMatch(marker: string) {
44+
return (hit: { body: Record<string, unknown> }) => bodyText(hit).includes(marker)
4645
}
4746

4847
async function patchWithMock(
4948
llm: Parameters<typeof test>[0]["llm"],
5049
sdk: Parameters<typeof withSession>[0],
5150
sessionID: string,
5251
patchText: string,
52+
marker: string,
5353
) {
54-
await llm.toolMatch(patchMatch(patchText), "apply_patch", { patchText })
54+
await llm.toolMatch(patchMatch(marker), "apply_patch", { patchText })
5555
await sdk.session.promptAsync({
5656
sessionID,
5757
agent: "build",
@@ -266,7 +266,7 @@ test("review applies inline comment clicks without horizontal overflow", async (
266266
async (project) => {
267267
await withSession(project.sdk, `e2e review comment ${tag}`, async (session) => {
268268
project.trackSession(session.id)
269-
await patchWithMock(llm, project.sdk, session.id, seed([{ file, mark: tag }]))
269+
await patchWithMock(llm, project.sdk, session.id, seed([{ file, mark: tag }]), tag)
270270

271271
await expect
272272
.poll(
@@ -328,7 +328,7 @@ test("review file comments submit on click without clipping actions", async ({
328328
async (project) => {
329329
await withSession(project.sdk, `e2e review file comment ${tag}`, async (session) => {
330330
project.trackSession(session.id)
331-
await patchWithMock(llm, project.sdk, session.id, seed([{ file, mark: tag }]))
331+
await patchWithMock(llm, project.sdk, session.id, seed([{ file, mark: tag }]), tag)
332332

333333
await expect
334334
.poll(
@@ -387,7 +387,7 @@ test("review keeps scroll position after a live diff update", async ({ page, llm
387387
async (project) => {
388388
await withSession(project.sdk, `e2e review ${tag}`, async (session) => {
389389
project.trackSession(session.id)
390-
await patchWithMock(llm, project.sdk, session.id, seed(list))
390+
await patchWithMock(llm, project.sdk, session.id, seed(list), tag)
391391

392392
await expect
393393
.poll(
@@ -441,7 +441,7 @@ test("review keeps scroll position after a live diff update", async ({ page, llm
441441
const prev = await spot(page, hit.file)
442442
if (!prev) throw new Error(`missing review row for ${hit.file}`)
443443

444-
await patchWithMock(llm, project.sdk, session.id, edit(hit.file, hit.mark, next))
444+
await patchWithMock(llm, project.sdk, session.id, edit(hit.file, hit.mark, next), next)
445445

446446
await expect
447447
.poll(

0 commit comments

Comments
 (0)