Refactor slot response streaming messages#3017
Conversation
|
/bonk review |
|
@markphelps Bonk workflow was cancelled. View workflow run · To retry, trigger Bonk again. |
|
Based on my review of the code changes in PR #3017, here's my assessment: Review SummaryLGTM - The PR refactors slot response streaming messages cleanly and adds extensibility for future transport protocols. Key Changes
Code Quality
Minor ObservationThe |
michaeldwan
left a comment
There was a problem hiding this comment.
Clean refactor. The renames from Log/Output to LogLine/OutputChunk are a clear win -- the old names were ambiguous, especially Output which clashed with the concept of final prediction output.
A few things to address:
- Orphaned snapshot files. The old
slot_log_serializesandslot_output_serializessnapshots are still on disk now that the tests were renamed and switched to inline assertions. Delete them or runcargo insta test --unreferenced=delete. BinaryChunkencoding.Vec<u8>serializes as a JSON array of integers, which is wildly inefficient for binary payloads. If this is intentionally placeholder for a future binary transport, a doc comment saying so would prevent someone from accidentally using it over the current JSON IPC.ProtocolVersionscaffolding. Nothing sends this message yet. A brief comment on the intent would help future readers.
Minor nit: send_output burns an index even when the output spills to disk as FileOutput (where index is unused), creating gaps in the sequence. Not a bug since the orchestrator ignores index today, but worth knowing if index continuity ever matters.
| BinaryChunk { | ||
| mime_type: String, | ||
| data: Vec<u8>, | ||
| }, |
There was a problem hiding this comment.
Vec<u8> with serde's default JSON serialization produces an array of integers -- a 1 MB audio chunk becomes ~4 MB of JSON. If this will only ever transit a future binary WebSocket transport (bypassing the JSON codec), a doc comment saying so would be helpful. If it might ever go over the current JSON IPC, consider serde_bytes or base64.
| serde_json::to_value(resp).unwrap(), | ||
| json!({ | ||
| "type": "log_line", | ||
| "source": "stdout", |
There was a problem hiding this comment.
The old snapshot files slot_log_serializes.snap and slot_output_serializes.snap are now orphaned since these tests were renamed and switched to inline assertions. They should be deleted.
| Some((slot_id, result)) = slot_msg_rx.recv() => { | ||
| match result { | ||
| Ok(SlotResponse::Log { source, data }) => { | ||
| Ok(SlotResponse::ProtocolVersion { version }) => { |
There was a problem hiding this comment.
Nothing in the worker sends ProtocolVersion yet -- this arm is dead code for now. A quick comment like // TODO: worker sends ProtocolVersion on slot connect (or wherever it'll be sent) would clarify the intent for future readers.
michaeldwan
left a comment
There was a problem hiding this comment.
Approving -- the inline comments from my previous review are all minor/nits. Nothing blocking.
Summary
Test Plan