src/Arcp.Client/ArcpClient.fs calls assembler.Append(chunkSeq, data, enc, more) |> ignore when dispatching JobEventBody.ResultChunk. ChunkAssembler.Append returns Error for out-of-order chunks and can throw for invalid base64 data, but the dispatch path neither completes the job result with an error nor closes the event stream. A malformed or reordered chunk stream can therefore leave callers with a final job.result but no usable bytes from TryReadResultBytes, with no clear indication of the protocol violation.
Fix prompt: handle chunk assembly failures in dispatchJobEvent. When Append returns Error, remove the handle, complete the event channel, and complete ResultSetter with that ARCPError; when decoding base64 throws, catch FormatException inside ChunkAssembler.Append and return ARCPError.InvalidRequest instead of throwing through the receive loop. Add unit tests for out-of-order chunk sequences and invalid base64 chunks that assert handle.Result completes with an error and the event stream terminates predictably.
src/Arcp.Client/ArcpClient.fscallsassembler.Append(chunkSeq, data, enc, more) |> ignorewhen dispatchingJobEventBody.ResultChunk.ChunkAssembler.AppendreturnsErrorfor out-of-order chunks and can throw for invalid base64 data, but the dispatch path neither completes the job result with an error nor closes the event stream. A malformed or reordered chunk stream can therefore leave callers with a finaljob.resultbut no usable bytes fromTryReadResultBytes, with no clear indication of the protocol violation.Fix prompt: handle chunk assembly failures in
dispatchJobEvent. WhenAppendreturnsError, remove the handle, complete the event channel, and completeResultSetterwith thatARCPError; when decoding base64 throws, catchFormatExceptioninsideChunkAssembler.Appendand returnARCPError.InvalidRequestinstead of throwing through the receive loop. Add unit tests for out-of-order chunk sequences and invalid base64 chunks that asserthandle.Resultcompletes with an error and the event stream terminates predictably.