forked from molecule-ai/molecule-core
Operators and audit agents can now detect silent cron failures across all workspaces with a single AdminAuth-gated request — no per-workspace bearer tokens required. This closes the proactive detection gap that left issue #85 (cron died silently 10+ hours) undetectable until users noticed missing work. Changes: - platform/internal/handlers/admin_schedules_health.go: new AdminSchedulesHealthHandler - GET /admin/schedules/health joins workspace_schedules + workspaces (excluding removed workspaces), computes status (ok|stale|never_run) and stale_threshold_seconds (2 × cron interval via scheduler.ComputeNextRun) - computeStaleThreshold() and classifyScheduleStatus() extracted as package-level helpers for direct unit testing - platform/internal/handlers/admin_schedules_health_test.go: 16 tests - Unit tests for computeStaleThreshold (5min/hourly/daily crons, invalid expr, invalid timezone) and classifyScheduleStatus (never_run/stale/ok/zero-threshold) - Integration tests via sqlmock: empty result, never_run classification, stale detection, ok status, DB error → 500, multi-workspace response, required JSON fields coverage - platform/internal/router/router.go: register GET /admin/schedules/health behind middleware.AdminAuth(db.DB), mirroring the /admin/liveness gate Closes #618 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| cmd/server | ||
| internal | ||
| migrations | ||
| pkg/provisionhook | ||
| Dockerfile | ||
| Dockerfile.tenant | ||
| entrypoint-tenant.sh | ||
| go.mod | ||
| go.sum | ||