feat(scheduler): plugin architecture + Doctor health check plugin

- Create ISchedulerJobPlugin abstraction with JobKind routing
- Add SchedulerPluginRegistry for plugin discovery and resolution
- Wrap existing scan logic as ScanJobPlugin (zero behavioral change)
- Extend Schedule model with JobKind (default "scan") and PluginConfig (jsonb)
- Add SQL migrations 007 (job_kind/plugin_config) and 008 (doctor_trends table)
- Implement DoctorJobPlugin replacing standalone doctor-scheduler service
- Add PostgresDoctorTrendRepository for persistent trend storage
- Register Doctor trend endpoints at /api/v1/scheduler/doctor/trends/*
- Seed 3 default Doctor schedules (daily full, hourly quick, weekly compliance)
- Comment out doctor-scheduler container in compose and services-matrix
- Update Doctor architecture docs and AGENTS.md with scheduling migration info

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-08 16:24:46 +03:00
parent 53f294400f
commit 908619e739
32 changed files with 1619 additions and 55 deletions

View File

@@ -67,3 +67,14 @@ Every `IDoctorCheck` implementation MUST have a corresponding documentation arti
- Development: https://localhost:10260, http://localhost:10261
- Local alias: https://doctor.stella-ops.local, http://doctor.stella-ops.local
- Env var: STELLAOPS_DOCTOR_URL
## Doctor Scheduling (DEPRECATED standalone service)
The standalone `StellaOps.Doctor.Scheduler` service is deprecated as of Sprint 20260408-003.
Doctor health check scheduling is now handled by the Scheduler service's `DoctorJobPlugin`
(jobKind="doctor") in `src/JobEngine/StellaOps.Scheduler.__Libraries/StellaOps.Scheduler.Plugin.Doctor/`.
- Schedule CRUD: use the Scheduler API with `jobKind="doctor"` and `pluginConfig` for Doctor-specific options.
- Trend storage: moved from in-memory to Scheduler's PostgreSQL schema (`scheduler.doctor_trends`).
- Trend endpoints: served by the Scheduler at `/api/v1/scheduler/doctor/trends/*`.
- The Doctor WebService remains unchanged as the execution engine for health checks.
- Source code for the old scheduler is kept for one release cycle before removal.

View File

@@ -0,0 +1,24 @@
# StellaOps.Doctor.Scheduler (DEPRECATED)
> **DEPRECATED** as of Sprint 20260408-003. This standalone service is replaced by the
> `DoctorJobPlugin` in the Scheduler service (`src/JobEngine/StellaOps.Scheduler.__Libraries/StellaOps.Scheduler.Plugin.Doctor/`).
## Migration Summary
| Capability | Before (this service) | After (Scheduler plugin) |
|---|---|---|
| Schedule CRUD | In-memory, `/api/v1/doctor/scheduler/schedules` | Scheduler API with `jobKind="doctor"` |
| Cron evaluation | `DoctorScheduleWorker` background service | Scheduler's existing cron infrastructure |
| Run execution | `ScheduleExecutor` HTTP calls to Doctor WebService | `DoctorJobPlugin.ExecuteAsync()` |
| Trend storage | `InMemoryTrendRepository` (volatile) | `scheduler.doctor_trends` PostgreSQL table |
| Trend endpoints | `/api/v1/doctor/scheduler/trends/*` | `/api/v1/scheduler/doctor/trends/*` |
## What Stays
- **Doctor WebService** (`src/Doctor/StellaOps.Doctor.WebService/`): unchanged, remains the health check execution engine.
- **Doctor Plugins** (`src/Doctor/__Plugins/`): unchanged, loaded by Doctor WebService.
## Removal Timeline
Source code is kept for one release cycle. The `doctor-scheduler` container is commented out
in `docker-compose.stella-ops.yml` and disabled in `services-matrix.env`.