Files
git.stella-ops.org/src/StellaOps.Scheduler.Storage.Mongo

Scheduler Storage Mongo — Sprint 16 Handoff

This module now consumes the canonical DTOs defined in StellaOps.Scheduler.Models.
Samples covering REST shapes live under samples/api/scheduler/ and are referenced from docs/11_DATA_SCHEMAS.md#3.1.

Collections & DTO mapping

Collection DTO Notes
schedules Schedule Persist Schedule as-is. _idSchedule.Id. Use compound indexes on {tenantId, enabled} and {whenCron} per doc.
runs Run Store Run.Stats inside the document; omit deltas array when empty.
impact_snapshots ImpactSet Normalise selector filter fields exactly as emitted by the canonical serializer.
audit AuditRecord Lower-case metadata keys are already enforced by the model.

All timestamps are persisted as UTC (+00:00). Empty selector filters remain empty arrays (see impact-set.json sample).

Implementation guidance

  1. Add a project reference to StellaOps.Scheduler.Models and reuse the records directly; avoid duplicate BSON POCOs.
  2. When serialising/deserialising to MongoDB, call CanonicalJsonSerializer to keep ordering stable for diffable fixtures.
  3. Integration tests should load the JSON samples and round-trip through the Mongo persistence layer to guarantee parity.
  4. Follow docs/11_DATA_SCHEMAS.md for index requirements; update that doc if storage diverges.
  5. Register AddSchedulerMongoStorage in the host and call ISchedulerMongoInitializer.EnsureMigrationsAsync during bootstrap so collections/indexes are created before workers/web APIs start.

With these artefacts in place the dependency on SCHED-MODELS-16-101/102 is cleared—storage work can move to DOING.