fix(client): forward the abort signal through the workspaces test double

TestWorkspaces.listDirectory now records the signal and passes it to the
installed stub, mirroring the production face, so cancellation
integration tests can observe or reject on a superseded scan instead of
the harness silently dropping it.
This commit is contained in:
creatixchu
2026-07-29 06:31:18 +08:00
parent 53240f4664
commit d80fca0db8
2 changed files with 16 additions and 7 deletions

View File

@@ -115,10 +115,13 @@ export class TestWorkspaces implements IWorkspaces {
* @param path - absolute directory to list; absent lists the home level.
* @returns the level's listing.
*/
async listDirectory(path?: string, _signal?: AbortSignal): Promise<DirectoryListing> {
this.calls.push({ method: 'listDirectory', args: [path] })
async listDirectory(path?: string, signal?: AbortSignal): Promise<DirectoryListing> {
// The signal is recorded and forwarded like the production face passes
// it to the wire, so cancellation integration tests can observe or
// reject on a superseded scan.
this.calls.push({ method: 'listDirectory', args: [path, signal] })
const stub = this.stubs.get('listDirectory')
if (stub !== undefined) return await (stub(path) as Promise<DirectoryListing>)
if (stub !== undefined) return await (stub(path, signal) as Promise<DirectoryListing>)
// The chain runs root-to-target inclusive, per the DirectoryListing
// contract — a bare root crumb would mislabel the level in browsers
// driven by this double.