From 3213149974e149aef084a44b9881a93c7bdc9dbf Mon Sep 17 00:00:00 2001 From: shoemoney Date: Tue, 23 Jun 2026 11:13:38 -0500 Subject: [PATCH] =?UTF-8?q?refactor:=20ponytail-audit=20cuts=20=E2=80=94?= =?UTF-8?q?=20dead=20Windows=20Publish=20stub=20+=20dedup=20Daemon=20iface?= =?UTF-8?q?=20=F0=9F=A7=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Repo-wide audit (per request) came back lean — no dead exports, no reinvented stdlib. Two real cuts: - delete the Windows control.Server.Publish no-op: Publish was removed from the real server when /events was trimmed, so nothing calls it. - move the control.Daemon interface into shared control.go (was duplicated across server.go + server_windows.go build-tag split → drift risk). Kept (disagreed with cutting): blobstore.Store interface is the documented M9 S3 seam (6 lines, clean contract); c.Bearer() is a tiny test accessor. --- internal/control/control.go | 10 ++++++++++ internal/control/server.go | 9 --------- internal/control/server_windows.go | 10 ---------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/internal/control/control.go b/internal/control/control.go index 7d58878..48b7557 100644 --- a/internal/control/control.go +++ b/internal/control/control.go @@ -41,6 +41,16 @@ type MountState struct { BaseSnapshot string `json:"base_snapshot"` } +// Daemon is the slice of the running daemon the control server steers. The +// daemon package implements it; declared here (not in the build-tagged server +// files) so the real server and the Windows stub share one definition and can't +// drift. The server depends on this behaviour, not the daemon package — no cycle. +type Daemon interface { + StateSnapshot() State // live per-mount + paused view for GET /state + Pause() // stop syncing until resumed + Resume() // clear pause + catch up all mounts +} + // ErrNotRunning is returned by the client helpers when the control socket is // absent or unreachable — i.e. the daemon isn't running — so callers can fall // back to disk-based behaviour instead of treating it as a hard error. diff --git a/internal/control/server.go b/internal/control/server.go index 4f98ef9..b5d5979 100644 --- a/internal/control/server.go +++ b/internal/control/server.go @@ -11,15 +11,6 @@ import ( "time" ) -// Daemon is the slice of the running daemon the control server steers. The -// daemon package implements it; kept here so the server depends on a behaviour, -// not on the daemon package (no import cycle). -type Daemon interface { - StateSnapshot() State // live per-mount + paused view for GET /state - Pause() // stop syncing until resumed - Resume() // clear pause + catch up all mounts -} - // Server hosts the control API on a Unix socket. The zero value is unusable; // build one with Serve. type Server struct { diff --git a/internal/control/server_windows.go b/internal/control/server_windows.go index ba15b3a..f152d43 100644 --- a/internal/control/server_windows.go +++ b/internal/control/server_windows.go @@ -13,13 +13,6 @@ import ( // net.Listen("unix", …) in server.go for winio.ListenPipe and the client's // net.Dial for winio.DialPipe. Until a Windows user exists, we don't build it. -// Daemon is the slice of the running daemon the control server would steer. -type Daemon interface { - StateSnapshot() State - Pause() - Resume() -} - // Server is a no-op on Windows. type Server struct{} @@ -28,6 +21,3 @@ type Server struct{} func Serve(_ context.Context, _ string, _ Daemon, _ func(string, ...any)) (*Server, error) { return nil, errors.New("control socket not supported on windows yet") } - -// Publish is a no-op on Windows. -func (s *Server) Publish(_, _ string) {}