feat: migrate from msgpack to protobuf (handler-base v1.0.0)
Some checks failed
CI / Test (push) Successful in 3m0s
CI / Lint (push) Successful in 3m1s
CI / Release (push) Successful in 1m17s
CI / Docker Build & Push (push) Failing after 7m26s
CI / Notify (push) Successful in 1s

- Replace msgpack encoding with protobuf wire format
- Update field names to proto convention (SessionId)
- Cast int fields to int32 (ChunkIndex, TotalChunks, SampleRate, Count)
- Use pointer slices for repeated messages ([]*TTSVoiceInfo)
- Rewrite tests for proto round-trips
This commit is contained in:
2026-02-21 15:30:51 -05:00
parent 147c60fd64
commit 238bf47844
5 changed files with 42 additions and 48 deletions

View File

@@ -12,7 +12,7 @@ import (
"testing"
"git.daviestechlabs.io/daviestechlabs/handler-base/messages"
"github.com/vmihailenco/msgpack/v5"
"google.golang.org/protobuf/proto"
)
// ────────────────────────────────────────────────────────────────────────────
@@ -67,21 +67,21 @@ func TestSynthesisE2E_StreamChunks(t *testing.T) {
// Verify typed chunk struct
msg := messages.TTSAudioChunk{
SessionID: "test-session",
ChunkIndex: chunkIdx,
TotalChunks: totalChunks,
SessionId: "test-session",
ChunkIndex: int32(chunkIdx),
TotalChunks: int32(totalChunks),
Audio: chunk,
IsLast: isLast,
SampleRate: 24000,
}
// Round-trip through msgpack
data, _ := msgpack.Marshal(&msg)
data, _ := proto.Marshal(&msg)
var decoded messages.TTSAudioChunk
_ = msgpack.Unmarshal(data, &decoded)
_ = proto.Unmarshal(data, &decoded)
if decoded.SessionID != "test-session" {
t.Errorf("chunk %d: session = %v", chunkIdx, decoded.SessionID)
if decoded.SessionId != "test-session" {
t.Errorf("chunk %d: session = %v", chunkIdx, decoded.SessionId)
}
if decoded.IsLast != isLast {
t.Errorf("chunk %d: is_last = %v, want %v", chunkIdx, decoded.IsLast, isLast)
@@ -266,13 +266,13 @@ func BenchmarkAudioChunking(b *testing.B) {
}
chunk := audioBytes[i:end]
msg := &messages.TTSAudioChunk{
SessionID: "bench",
ChunkIndex: i / chunkSize,
TotalChunks: totalChunks,
SessionId: "bench",
ChunkIndex: int32(i / chunkSize),
TotalChunks: int32(totalChunks),
Audio: chunk,
SampleRate: 24000,
}
_, _ = msgpack.Marshal(msg)
_, _ = proto.Marshal(msg)
}
}
}