Repository navigation
refactor(encode): Phase 2 — promote encoders to pkg/audio/encode (gate met) - #142
Merged
Merged
Conversation
The Opus and FLAC encoders were the ONLY thing pkg/sendspin used from
internal/server (the source decoders and TUI are used solely by the server
CLI). Promoting them to a public package therefore drops pkg/sendspin's
internal/server dependency entirely.
- Move opus_encoder.go / flac_encoder.go (+ tests) verbatim from
internal/server to pkg/audio/encode (package server -> encode); add doc.go.
- Repoint role_player.go, server.go, server_client.go: import
pkg/audio/encode and reference encode.{Opus,FLAC}Encoder /
encode.New{Opus,FLAC}Encoder.
Phase 2 GATE MET: go list -deps confirms pkg/ now imports ZERO internal/
packages. internal/server (sources + TUI) is used only by cmd/sendspin-server
now, so it can stay private to the future server-CLI repo.
Phase 2 of the three-repo split.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2 of the three-repo split (2 of 3 promotions) — and it completes the Phase 2 gate.
Change
Promote the Opus/FLAC encoders from
internal/serverto a publicpkg/audio/encode, and repoint the threepkg/sendspinusers.opus_encoder.go/flac_encoder.go(+ tests) moved verbatim (git mv, history preserved),package server→package encode, plus adoc.go(matchingpkg/audio/decode).role_player.go,server.go,server_client.go: importpkg/audio/encode, referenceencode.{Opus,FLAC}Encoder/encode.New{Opus,FLAC}Encoder.Why this finishes the gate
The encoders turned out to be the only thing
pkg/sendspinused frominternal/server(the source decoders and TUI are used solely bycmd/sendspin-server). So this PR drops the SDK'sinternal/serverdependency entirely:Phase 2 gate ("SDK has zero cross-boundary
internal/imports") is met after discovery (#141) + this PR.internal/server(sources + TUI) is now used only bycmd, so it can stay private to the future server-CLI repo.Note: third promotion downgraded to optional
The planned
pkg/audio/sourcepromotion is no longer required for the boundary — onlycmdimports the sources, not the SDK. Whether to promote them becomes a product decision (does the SDK ship built-in file/MP3/FLAC/HLS sources for library consumers, or are sources a CLI concern?). Captured in the plan; decide before/with Phase 3.Verification
go build ./..., fullgo test -race ./...(10 packages) — green. gofmt + lint clean.go doc ./pkg/audio/encoderenders.opus.Encoder(notopus.Stream), so the-tags=nolibopusfilebehavior is unchanged by the move — same as when they lived ininternal/server.