Skip to content

refactor(discovery): Phase 2 — promote internal/discovery to pkg/discovery - #141

Merged
chrisuthe merged 3 commits into
mainfrom
refactor/split-phase2-promote-discovery
Jun 12, 2026
Merged

chrisuthe merged 3 commits into
mainfrom
refactor/split-phase2-promote-discovery

Conversation

@chrisuthe

Copy link
Copy Markdown
Member

Phase 2 of the three-repo split (1 of 3 promotions). See docs/superpowers/plans/2026-06-11-three-repo-split.md.

Phase 2 promotes the cross-boundary internal/ packages to public pkg/ packages, because Go forbids importing another module's internal/ — so the future sendspin-player / sendspin-server repos must reach this code through the SDK's public API. This PR does the first and most self-contained one: discovery.

Change

internal/discovery (mDNS browse/advertise — Manager, Config, ServerInfo, ClientInfo, NewManager, Advertise, BrowseClients, …) is the maintained discovery implementation, used by both sides: the server advertises + browses for clients, and the player CLI browses for servers.

  • Moved verbatim (git mv, history preserved) to pkg/discovery — the name freed in Phase 0 when the orphaned/broken stale fork was deleted.
  • Repointed the four importers: main.go, pkg/sendspin/server.go, pkg/sendspin/client_dialer.go (+ its test). gofmt re-sorted the import blocks (pkg/ sorts after internal/).
  • No behavior change. pkg/sendspin no longer imports internal/discovery (verified via go list -deps).

Verification

  • go build ./..., full go test -race ./... (10 packages) — green. gofmt clean; no new lint findings.

Remaining Phase 2 (separate PRs)

  • Promote the Opus/FLAC encoders → pkg/audio/encode (CGO/opus build-tag care).
  • Promote the source decoders → pkg/audio/source (needs reconciling internal/server's own AudioSource interface + Default* constants).

Only after all three does pkg/sendspin reach zero cross-boundary internal/ imports (the Phase 2 gate). Kept separate for reviewability and to isolate the CGO risk.

internal/discovery (mDNS browse/advertise: Manager, Config, ServerInfo,
ClientInfo, NewManager) is the maintained discovery implementation, used by
both the server (advertise + browse-for-clients) and the player CLI
(browse-for-servers). For the repo split the CLI repos must reach it across
a module boundary, where Go forbids importing another module's internal/.

Move it verbatim to pkg/discovery (the name Phase 0 freed by deleting the
orphaned stale fork) and repoint the four importers (main.go, server.go,
client_dialer.go + test). No behavior change; pkg/sendspin no longer imports
internal/discovery.

Phase 2 of the three-repo split.
…CLAUDE.md

Address public-API hygiene from the PR review now that discovery is a public
package: add a godoc package comment to pkg/discovery, and remove the
internal/discovery bullet from CLAUDE.md's internal layout (the package was
promoted to pkg/discovery in this PR).
@chrisuthe
chrisuthe merged commit 230a8d7 into main Jun 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant