step 5 (partial): strip dropped packages from production code

Removed all references to dropped packages in non-test code.
Zero dropped imports, store refs, or model types remaining.

Major removals:
  - scheduler/ package (entire dir) — tasks moved to extension track
  - taskutil/ package (entire dir)
  - health/ package (entire dir) — provider/tool health
  - sandbox/provider_module.go — provider.complete module
  - handlers: workflow_entry, workflow_instances, workflow_forms,
    workflow_assignments, workflow_monitor, health_admin (6 files)
  - auth/session.go, middleware/session_auth.go
  - store/{postgres,sqlite}/sessions.go, tasks.go

Rewrites:
  - store/{postgres,sqlite}/health.go — kernel-only Prune
    (ws_tickets, rate_limit_counters, stale presence)
  - handlers/admin.go: 847→467 lines (stripped provider CRUD)
  - handlers/teams.go: 520→411 lines (stripped model listing)
  - sandbox/runner.go: removed ProviderResolver
  - sandbox/workflow_module.go: 216→83 lines (definition-only)
  - main.go: 1579→1325 lines (stripped dropped package init)
  - pages/pages.go: stripped channel/session lookups
  - events/types.go: stripped chat/channel/workspace event routes
  - models: stripped stale types, constants, notification types

Store interface cleanup:
  - Removed SessionStore, TaskStore from Stores struct
  - Stripped workflow assignment methods from WorkflowStore iface
  - Stripped assignment methods from PG+SQLite workflow stores
  - Updated testhelper.go table list to kernel-only

Migrations: removed 008_tasks.sql (both dialects)

-9665/+69 lines across 51 files.
This commit is contained in:
2026-03-25 21:13:01 -04:00
parent ebea16344c
commit e4b7ee98a5
55 changed files with 95 additions and 9981 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/gin-gonic/gin"
"switchboard-core/providers"
"switchboard-core/store"
)
@@ -137,7 +136,6 @@ func (e *Engine) registerLoaders() {
e.RegisterLoader("projects", e.projectsLoader)
}
// ListDataProviders returns the keys of all registered data providers.
// Used for manifest validation — DataRequires entries must match a key here.
func (e *Engine) ListDataProviders() []string {
keys := make([]string, 0, len(e.loaders))
@@ -331,7 +329,6 @@ func sectionCategory(section string) string {
// loadProviderTypes returns the registered provider type metadata.
func loadProviderTypes() []ProviderTypeOption {
types := providers.ListTypes()
out := make([]ProviderTypeOption, 0, len(types))
for _, t := range types {
out = append(out, ProviderTypeOption{ID: t.ID, Name: t.Name})

View File

@@ -624,9 +624,9 @@ type WorkflowPageData struct {
ChannelDescription string
SessionID string
SessionName string
StageMode string // chat_only | form_only | form_chat | review
StageMode string // custom | form_only | form_chat | review
StageName string
FormTemplateJSON string // typed form template JSON (empty if chat_only)
FormTemplateJSON string // typed form template JSON (empty if custom)
TotalStages int
CurrentStage int
SurfacePkgID string // v0.30.2: custom package surface override (empty = use StageMode)
@@ -648,7 +648,7 @@ type WorkflowLandingPageData struct {
PersonaName string
PersonaIcon string
StageCount int
FirstStageMode string // chat_only | form_only | form_chat (v0.29.3)
FirstStageMode string // custom | form_only | form_chat (v0.29.3)
ResumeURL string // non-empty if visitor has an active session
}
@@ -661,61 +661,17 @@ func (e *Engine) RenderWorkflow() gin.HandlerFunc {
// Load channel metadata
var title, description string
if e.stores.Channels != nil && channelID != "" {
ch, err := e.stores.Channels.GetByID(c.Request.Context(), channelID)
if err == nil {
title = ch.Title
description = ch.Description
}
}
if title == "" {
title = "Workflow"
}
// Load session display name
sessionName := "Visitor"
if e.stores.Sessions != nil && sessionID != "" {
sp, err := e.stores.Sessions.GetByID(c.Request.Context(), sessionID)
if err == nil {
sessionName = sp.DisplayName
}
}
// Load workflow stage info for form rendering (v0.29.3)
var stageMode, stageName, formTplJSON, surfacePkgID, brandingJSON string
var totalStages, currentStage int
stageMode = "chat_only" // default
if e.stores.Channels != nil && channelID != "" {
ws, wsErr := e.stores.Channels.GetWorkflowStatus(c.Request.Context(), channelID)
if wsErr == nil && ws != nil && ws.WorkflowID != nil {
currentStage = ws.CurrentStage
// v0.35.0: Load workflow branding
if wf, wfErr := e.stores.Workflows.GetByID(c.Request.Context(), *ws.WorkflowID); wfErr == nil && wf != nil {
if len(wf.Branding) > 0 && string(wf.Branding) != "{}" {
brandingJSON = string(wf.Branding)
}
}
if stages, sErr := e.stores.Workflows.ListStages(c.Request.Context(), *ws.WorkflowID); sErr == nil && len(stages) > 0 {
totalStages = len(stages)
if currentStage < len(stages) {
stg := stages[currentStage]
stageMode = stg.StageMode
stageName = stg.Name
if stageMode == "" {
stageMode = "chat_only"
}
if stageMode != "chat_only" {
formTplJSON = string(stg.FormTemplate)
}
if stg.SurfacePkgID != nil {
surfacePkgID = *stg.SurfacePkgID
}
}
}
}
}
stageMode = "custom" // default
instanceName, _, _ := e.loadBranding()
@@ -791,7 +747,7 @@ func (e *Engine) RenderWorkflowLanding() gin.HandlerFunc {
if len(stages) > 0 {
data.FirstStageMode = stages[0].StageMode
if data.FirstStageMode == "" {
data.FirstStageMode = "chat_only"
data.FirstStageMode = "custom"
}
if stages[0].PersonaID != nil {
if p, err := e.stores.Personas.GetByID(ctx, *stages[0].PersonaID); err == nil {
@@ -803,12 +759,6 @@ func (e *Engine) RenderWorkflowLanding() gin.HandlerFunc {
// Check for existing active session
sbSession, err := c.Cookie("sb_session")
if err == nil && sbSession != "" && e.stores.Sessions != nil {
sess, err := e.stores.Sessions.GetByToken(ctx, sbSession)
if err == nil && sess != nil {
data.ResumeURL = "/w/" + sess.ChannelID
}
}
instanceName, _, _ := e.loadBranding()