fix(host): race directory reads against the caller's signal; report aborts as cancelled
Every filesystem await in the browse scan (opendir and each read) now races the signal through raceAbort, so a stalled network open/read stops with a departed caller and an already-aborted request rejects even for an empty level; the abandoned settlement is swallowed and an abandoned open that still mints a handle is closed, never leaked. apiproxy maps an aborted listing to the cancelled wire code, matching pickDirectory and command.execute, instead of reporting a false internal failure. The fixture spec call sites gain the wire signal argument the previous commit's static lane flagged.
This commit is contained in:
@@ -1090,6 +1090,11 @@ export function createApiProxy(ctx: Context, defaults: ApiProxyDefaults): ApiPro
|
||||
// stops the backend's directory scan instead of outliving it.
|
||||
return ok(request, await capability.list(request.payload.path, signal))
|
||||
} catch (error: unknown) {
|
||||
// An abort is the caller's own timeout/disconnect, not a server
|
||||
// failure — same code pickDirectory and command.execute report.
|
||||
if (signal.aborted) {
|
||||
return err(request, { code: 'cancelled', message: 'directory listing was aborted', details: {} })
|
||||
}
|
||||
return err(request, directoryError(error))
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user