fix(main): stream hygiene for dweb fetch error paths - #182
Conversation
Follow-up to #158, addressing the two non-blocking notes from its final review round: - Cancel the response body on a non-OK dweb response, and cancel the reader when a chunk callback throws (e.g. disk full mid-save), so the protocol handler stops pulling from the gateway instead of draining the rest of the transfer in the background until GC. - Loop on FileHandle.write until the whole chunk is on disk; a partial write without an error would previously truncate the saved file silently.
|
[alan-review R1] No blocking findings. Verified locally on the PR branch: Two minor notes, neither blocking:
|
Per review: if FileHandle.write ever returns bytesWritten 0 (exotic FUSE/network mounts), fail loudly instead of hanging in the retry loop until the inactivity timeout aborts the transfer.
Follow-up to #158, addressing the two non-blocking hygiene notes from its final alan review round:
ENOSPCmid-save). Previously the protocol handler would keep pulling the rest of the transfer from the gateway in the background until GC collected the locked stream.FileHandle.writemay in theory write fewer bytes than requested without throwing;sessionFetchToFilenow loops until the whole chunk is on disk instead of silently truncating the saved file.Each behavior has a unit test (body-cancel on non-OK, reader-cancel on write failure, partial-write retry loop).
http-fetch.test.js+ipc-handlers.test.js: 37/37 pass locally.