From ecdf969dce91b5771d4f581c4b8c9cd5cbc9cf53 Mon Sep 17 00:00:00 2001 From: QQ Date: Wed, 18 Nov 2026 08:19:39 +0800 Subject: [PATCH] Import packages/plugin/tests/harness-remote-bridge.test.ts --- .../tests/harness-remote-bridge.test.ts | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/packages/plugin/tests/harness-remote-bridge.test.ts b/packages/plugin/tests/harness-remote-bridge.test.ts index e3716b6..eb9b660 100644 --- a/packages/plugin/tests/harness-remote-bridge.test.ts +++ b/packages/plugin/tests/harness-remote-bridge.test.ts @@ -1484,7 +1484,30 @@ describe('HarnessRemoteBridge', () => { }, }, { - name: 'rejects readBytes when path is not relative when baseFile is provided', + name: 'resolves readBytes when the path is absolute inside the workspace even with baseFile', + run: async () => { + dispatch.mockClear() + await expect( + bridge.call({ + endpoint: 'workspaceFiles/readBytes', + payload: { + args: { + workspaceFileScopeId: 'session-1', + path: insideFile, + options: { baseFile: 'sub/nested.txt' }, + }, + }, + }), + ).resolves.toMatchObject({ ok: true }) + expect(dispatch).toHaveBeenCalledWith( + 'workspaceFiles/readBytes', + expect.objectContaining({ args: expect.objectContaining({ path: 'inside.txt' }) }), + expect.any(AbortSignal), + ) + }, + }, + { + name: 'rejects readBytes when an absolute path stays outside the workspace with baseFile', run: async () => { dispatch.mockClear() await expect( @@ -1500,7 +1523,12 @@ describe('HarnessRemoteBridge', () => { }), ).rejects.toMatchObject({ code: 'WORKSPACE_PATH_DENIED' }) expect(dispatch).not.toHaveBeenCalled() - + }, + }, + { + name: 'rejects readBytes when the path carries a URL scheme with baseFile', + run: async () => { + dispatch.mockClear() await expect( bridge.call({ endpoint: 'workspaceFiles/readBytes',