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.
44 lines
1014 B
Go
44 lines
1014 B
Go
package sqlite
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"switchboard-core/database"
|
|
)
|
|
|
|
// ── HealthStore ─────────────────────────────
|
|
|
|
type HealthStore struct{}
|
|
|
|
func NewHealthStore() *HealthStore { return &HealthStore{} }
|
|
|
|
// Prune deletes stale kernel data older than the given time.
|
|
func (s *HealthStore) Prune(ctx context.Context, before time.Time) (int64, error) {
|
|
var total int64
|
|
ts := before.UTC().Format("2006-01-02 15:04:05")
|
|
|
|
res, _ := database.DB.ExecContext(ctx,
|
|
`DELETE FROM ws_tickets WHERE expires_at < ?`, ts)
|
|
if res != nil {
|
|
n, _ := res.RowsAffected()
|
|
total += n
|
|
}
|
|
|
|
res, _ = database.DB.ExecContext(ctx,
|
|
`DELETE FROM rate_limit_counters WHERE window_start < ?`, ts)
|
|
if res != nil {
|
|
n, _ := res.RowsAffected()
|
|
total += n
|
|
}
|
|
|
|
res, _ = database.DB.ExecContext(ctx,
|
|
`DELETE FROM user_presence WHERE last_seen < ? AND status = 'offline'`, ts)
|
|
if res != nil {
|
|
n, _ := res.RowsAffected()
|
|
total += n
|
|
}
|
|
|
|
return total, nil
|
|
}
|