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:
@@ -1,69 +0,0 @@
|
||||
-- ==========================================
|
||||
-- Switchboard Core — 008 Tasks
|
||||
-- ==========================================
|
||||
-- Task scheduling and run history.
|
||||
-- Stripped: persona_id (kept nullable, no FK), output_channel_id,
|
||||
-- provider_config_id. Output modes: notification | webhook | log.
|
||||
-- ==========================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tasks (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
owner_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
team_id UUID REFERENCES teams(id) ON DELETE SET NULL,
|
||||
name TEXT NOT NULL,
|
||||
description TEXT DEFAULT '',
|
||||
scope TEXT NOT NULL DEFAULT 'personal'
|
||||
CHECK (scope IN ('personal', 'team', 'global')),
|
||||
task_type TEXT NOT NULL DEFAULT 'action'
|
||||
CHECK (task_type IN ('action', 'workflow', 'system')),
|
||||
system_function TEXT DEFAULT '',
|
||||
persona_id TEXT,
|
||||
model_id TEXT,
|
||||
system_prompt TEXT DEFAULT '',
|
||||
user_prompt TEXT DEFAULT '',
|
||||
workflow_id UUID REFERENCES workflows(id) ON DELETE SET NULL,
|
||||
tool_grants JSONB,
|
||||
schedule TEXT NOT NULL,
|
||||
timezone TEXT NOT NULL DEFAULT 'UTC',
|
||||
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||
trigger_token TEXT UNIQUE,
|
||||
max_tokens INTEGER NOT NULL DEFAULT 4096,
|
||||
max_tool_calls INTEGER NOT NULL DEFAULT 10,
|
||||
max_wall_clock INTEGER NOT NULL DEFAULT 300,
|
||||
output_mode TEXT NOT NULL DEFAULT 'log'
|
||||
CHECK (output_mode IN ('notification', 'webhook', 'log')),
|
||||
webhook_url TEXT,
|
||||
webhook_secret TEXT,
|
||||
notify_on_complete BOOLEAN NOT NULL DEFAULT false,
|
||||
notify_on_failure BOOLEAN NOT NULL DEFAULT true,
|
||||
last_run_at TIMESTAMPTZ,
|
||||
next_run_at TIMESTAMPTZ,
|
||||
run_count INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_tasks_next_run ON tasks(next_run_at) WHERE is_active = true;
|
||||
CREATE INDEX IF NOT EXISTS idx_tasks_owner ON tasks(owner_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_tasks_team ON tasks(team_id);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_tasks_trigger_token
|
||||
ON tasks(trigger_token) WHERE trigger_token IS NOT NULL;
|
||||
|
||||
-- ── Task Runs ───────────────────────────────
|
||||
|
||||
CREATE TABLE IF NOT EXISTS task_runs (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
task_id UUID NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
||||
status TEXT NOT NULL DEFAULT 'running'
|
||||
CHECK (status IN ('queued', 'running', 'completed', 'failed', 'budget_exceeded', 'cancelled')),
|
||||
trigger_payload TEXT,
|
||||
started_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
completed_at TIMESTAMPTZ,
|
||||
tokens_used INTEGER DEFAULT 0,
|
||||
tool_calls INTEGER DEFAULT 0,
|
||||
wall_clock INTEGER DEFAULT 0,
|
||||
error TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_task_runs_task ON task_runs(task_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_task_runs_status ON task_runs(task_id, status);
|
||||
@@ -1,62 +0,0 @@
|
||||
-- ==========================================
|
||||
-- Switchboard Core — 008 Tasks (SQLite)
|
||||
-- ==========================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tasks (
|
||||
id TEXT PRIMARY KEY,
|
||||
owner_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
team_id TEXT REFERENCES teams(id) ON DELETE SET NULL,
|
||||
name TEXT NOT NULL,
|
||||
description TEXT DEFAULT '',
|
||||
scope TEXT NOT NULL DEFAULT 'personal'
|
||||
CHECK (scope IN ('personal', 'team', 'global')),
|
||||
task_type TEXT NOT NULL DEFAULT 'action'
|
||||
CHECK (task_type IN ('action', 'workflow', 'system')),
|
||||
system_function TEXT DEFAULT '',
|
||||
persona_id TEXT,
|
||||
model_id TEXT,
|
||||
system_prompt TEXT DEFAULT '',
|
||||
user_prompt TEXT DEFAULT '',
|
||||
workflow_id TEXT REFERENCES workflows(id) ON DELETE SET NULL,
|
||||
tool_grants TEXT,
|
||||
schedule TEXT NOT NULL,
|
||||
timezone TEXT NOT NULL DEFAULT 'UTC',
|
||||
is_active INTEGER NOT NULL DEFAULT 1,
|
||||
trigger_token TEXT UNIQUE,
|
||||
max_tokens INTEGER NOT NULL DEFAULT 4096,
|
||||
max_tool_calls INTEGER NOT NULL DEFAULT 10,
|
||||
max_wall_clock INTEGER NOT NULL DEFAULT 300,
|
||||
output_mode TEXT NOT NULL DEFAULT 'log'
|
||||
CHECK (output_mode IN ('notification', 'webhook', 'log')),
|
||||
webhook_url TEXT,
|
||||
webhook_secret TEXT,
|
||||
notify_on_complete INTEGER NOT NULL DEFAULT 0,
|
||||
notify_on_failure INTEGER NOT NULL DEFAULT 1,
|
||||
last_run_at TEXT,
|
||||
next_run_at TEXT,
|
||||
run_count INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_tasks_next_run ON tasks(next_run_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_tasks_owner ON tasks(owner_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_tasks_team ON tasks(team_id);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_tasks_trigger_token ON tasks(trigger_token);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS task_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
task_id TEXT NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
||||
status TEXT NOT NULL DEFAULT 'running'
|
||||
CHECK (status IN ('queued', 'running', 'completed', 'failed', 'budget_exceeded', 'cancelled')),
|
||||
trigger_payload TEXT,
|
||||
started_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
completed_at TEXT,
|
||||
tokens_used INTEGER DEFAULT 0,
|
||||
tool_calls INTEGER DEFAULT 0,
|
||||
wall_clock INTEGER DEFAULT 0,
|
||||
error TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_task_runs_task ON task_runs(task_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_task_runs_status ON task_runs(task_id, status);
|
||||
@@ -253,18 +253,20 @@ func TruncateAll(t *testing.T) {
|
||||
}
|
||||
|
||||
tables := []string{
|
||||
// Task system
|
||||
"task_runs",
|
||||
"tasks",
|
||||
// Workflow system
|
||||
"workflow_assignments",
|
||||
// HA
|
||||
"rate_limit_counters",
|
||||
"ws_tickets",
|
||||
// Workflows
|
||||
"workflow_versions",
|
||||
"workflow_stages",
|
||||
"workflows",
|
||||
// Sessions
|
||||
"session_participants",
|
||||
// Files
|
||||
"files",
|
||||
// Extensions
|
||||
"ext_data_tables",
|
||||
"extension_permissions",
|
||||
"ext_dependencies",
|
||||
"ext_connections",
|
||||
"package_user_settings",
|
||||
"packages",
|
||||
// Resource grants & groups
|
||||
"resource_grants",
|
||||
"group_members",
|
||||
@@ -272,53 +274,10 @@ func TruncateAll(t *testing.T) {
|
||||
// Notifications
|
||||
"notification_preferences",
|
||||
"notifications",
|
||||
// Usage & audit
|
||||
"usage_log",
|
||||
// Audit
|
||||
"audit_log",
|
||||
// Channel internals
|
||||
"channel_cursors",
|
||||
"messages",
|
||||
"channel_models",
|
||||
"channel_participants",
|
||||
"channel_knowledge_bases",
|
||||
"user_model_settings",
|
||||
// Projects
|
||||
"project_notes",
|
||||
"project_knowledge_bases",
|
||||
"project_channels",
|
||||
// Knowledge bases
|
||||
"persona_knowledge_bases",
|
||||
"kb_chunks",
|
||||
"kb_documents",
|
||||
"knowledge_bases",
|
||||
// Notes
|
||||
"note_links",
|
||||
"notes",
|
||||
// Memory
|
||||
"memory_extraction_log",
|
||||
"memories",
|
||||
// Workspaces
|
||||
"workspace_chunks",
|
||||
"workspace_files",
|
||||
"git_credentials",
|
||||
"workspaces",
|
||||
// Channels & folders
|
||||
"channels",
|
||||
"folders",
|
||||
"projects",
|
||||
// Providers & health
|
||||
"model_pricing",
|
||||
"provider_health",
|
||||
"capability_overrides",
|
||||
"routing_policies",
|
||||
"tool_health",
|
||||
"model_catalog",
|
||||
// Personas
|
||||
"persona_grants",
|
||||
"persona_group_members",
|
||||
"persona_groups",
|
||||
"personas",
|
||||
"provider_configs",
|
||||
// Presence
|
||||
"user_presence",
|
||||
// Teams & users
|
||||
"team_members",
|
||||
"teams",
|
||||
|
||||
Reference in New Issue
Block a user