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) <noreply@anthropic.com>
This commit is contained in:
@@ -101,13 +101,13 @@ func (h *PackageHandler) EnablePackage(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, gin.H{"id": id, "enabled": true})
|
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/packages/:id/disable
|
||||||
// PUT /api/v1/admin/surfaces/:id/disable (alias)
|
// PUT /api/v1/admin/surfaces/:id/disable (alias)
|
||||||
func (h *PackageHandler) DisablePackage(c *gin.Context) {
|
func (h *PackageHandler) DisablePackage(c *gin.Context) {
|
||||||
id := c.Param("id")
|
id := c.Param("id")
|
||||||
|
|
||||||
if id == "chat" || id == "admin" {
|
if id == "admin" {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": id + " cannot be disabled"})
|
c.JSON(http.StatusBadRequest, gin.H{"error": id + " cannot be disabled"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ func (h *WorkflowHandler) Publish(c *gin.Context) {
|
|||||||
stages = []models.WorkflowStage{}
|
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 {
|
type stageSnapshot struct {
|
||||||
models.WorkflowStage
|
models.WorkflowStage
|
||||||
ToolGrants []string `json:"tool_grants,omitempty"`
|
ToolGrants []string `json:"tool_grants,omitempty"`
|
||||||
|
|||||||
@@ -48,11 +48,10 @@ func (e *Engine) SeedSurfaces() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IsSurfaceEnabled checks if a surface is enabled in the registry.
|
// 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).
|
// Returns true if the surface is not found (fail-open for backward compat).
|
||||||
func (e *Engine) IsSurfaceEnabled(surfaceID string) bool {
|
func (e *Engine) IsSurfaceEnabled(surfaceID string) bool {
|
||||||
// Chat and Admin cannot be disabled — they're system-critical
|
if surfaceID == "admin" {
|
||||||
if surfaceID == "chat" || surfaceID == "admin" {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if e.stores.Packages == nil {
|
if e.stores.Packages == nil {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"switchboard-core/models"
|
"switchboard-core/models"
|
||||||
)
|
)
|
||||||
@@ -224,8 +223,6 @@ func (s *TeamStore) IsMember(ctx context.Context, teamID, userID string) (bool,
|
|||||||
return exists, err
|
return exists, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// unused but keeping for reference
|
|
||||||
var _ = fmt.Sprintf
|
|
||||||
|
|
||||||
// ── CS1 additions (v0.29.0) ─────────────────────────────────────────────
|
// ── CS1 additions (v0.29.0) ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"switchboard-core/models"
|
"switchboard-core/models"
|
||||||
@@ -231,8 +230,6 @@ func (s *TeamStore) IsMember(ctx context.Context, teamID, userID string) (bool,
|
|||||||
return exists, err
|
return exists, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// unused but keeping for reference
|
|
||||||
var _ = fmt.Sprintf
|
|
||||||
|
|
||||||
// ── CS1 additions (v0.29.0) ─────────────────────────────────────────────
|
// ── CS1 additions (v0.29.0) ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user