From 57c981d52d291c293d242cf2dc93bec628b273a7 Mon Sep 17 00:00:00 2001 From: Jeffrey Smith Date: Fri, 27 Mar 2026 13:06:07 +0000 Subject: [PATCH] Clean up dead Go code in handlers, pages, and stores - Remove "chat" from surface disable guard (only admin needs it) - Remove "chat" from IsSurfaceEnabled always-on check - Remove unused fmt.Sprintf references in team stores - Update stale comments referencing personas and chat surfaces Co-Authored-By: Claude Opus 4.6 (1M context) --- server/handlers/packages.go | 4 ++-- server/handlers/workflows.go | 2 +- server/pages/pages_surfaces.go | 5 ++--- server/store/postgres/team.go | 3 --- server/store/sqlite/team.go | 3 --- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/server/handlers/packages.go b/server/handlers/packages.go index daf4675..c884bf7 100644 --- a/server/handlers/packages.go +++ b/server/handlers/packages.go @@ -101,13 +101,13 @@ func (h *PackageHandler) EnablePackage(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"id": id, "enabled": true}) } -// DisablePackage disables a package. Chat and Admin cannot be disabled. +// DisablePackage disables a package. Admin cannot be disabled. // PUT /api/v1/admin/packages/:id/disable // PUT /api/v1/admin/surfaces/:id/disable (alias) func (h *PackageHandler) DisablePackage(c *gin.Context) { id := c.Param("id") - if id == "chat" || id == "admin" { + if id == "admin" { c.JSON(http.StatusBadRequest, gin.H{"error": id + " cannot be disabled"}) return } diff --git a/server/handlers/workflows.go b/server/handlers/workflows.go index 71d093e..46432b7 100644 --- a/server/handlers/workflows.go +++ b/server/handlers/workflows.go @@ -285,7 +285,7 @@ func (h *WorkflowHandler) Publish(c *gin.Context) { stages = []models.WorkflowStage{} } - // Snapshot includes persona tool grants at publish time (frozen for running instances) + // Snapshot stages at publish time (frozen for running instances) type stageSnapshot struct { models.WorkflowStage ToolGrants []string `json:"tool_grants,omitempty"` diff --git a/server/pages/pages_surfaces.go b/server/pages/pages_surfaces.go index b7214cf..3370e7c 100644 --- a/server/pages/pages_surfaces.go +++ b/server/pages/pages_surfaces.go @@ -48,11 +48,10 @@ func (e *Engine) SeedSurfaces() { } // IsSurfaceEnabled checks if a surface is enabled in the registry. -// Chat and Admin are always enabled (system-critical). +// Admin is always enabled (system-critical). // Returns true if the surface is not found (fail-open for backward compat). func (e *Engine) IsSurfaceEnabled(surfaceID string) bool { - // Chat and Admin cannot be disabled — they're system-critical - if surfaceID == "chat" || surfaceID == "admin" { + if surfaceID == "admin" { return true } if e.stores.Packages == nil { diff --git a/server/store/postgres/team.go b/server/store/postgres/team.go index dfd7088..e4190fe 100644 --- a/server/store/postgres/team.go +++ b/server/store/postgres/team.go @@ -4,7 +4,6 @@ import ( "context" "database/sql" "encoding/json" - "fmt" "switchboard-core/models" ) @@ -224,8 +223,6 @@ func (s *TeamStore) IsMember(ctx context.Context, teamID, userID string) (bool, return exists, err } -// unused but keeping for reference -var _ = fmt.Sprintf // ── CS1 additions (v0.29.0) ───────────────────────────────────────────── diff --git a/server/store/sqlite/team.go b/server/store/sqlite/team.go index dfed79d..a627b47 100644 --- a/server/store/sqlite/team.go +++ b/server/store/sqlite/team.go @@ -4,7 +4,6 @@ import ( "context" "database/sql" "encoding/json" - "fmt" "time" "switchboard-core/models" @@ -231,8 +230,6 @@ func (s *TeamStore) IsMember(ctx context.Context, teamID, userID string) (bool, return exists, err } -// unused but keeping for reference -var _ = fmt.Sprintf // ── CS1 additions (v0.29.0) ─────────────────────────────────────────────