TenantAtlas/specs/032-backup-scheduling-mvp/tasks.md
ahmido beffbfca4c feat/032-backup-scheduling-mvp (#33)
Ziel: MVP-Spezifikation für “Automatisierte Backups per Zeitplan (pro Tenant)” als Grundlage für die Implementierung (Spec-first).
Scope (MVP):
Tenant-scoped backup_schedules + backup_schedule_runs
Dispatcher erstellt idempotente Runs (Unique Slot) + Queue-Job führt Run aus
“Run now” / “Retry”, Run-History, Retention (keep last N)
No catch-up für verpasste Slots
Wichtige Klarstellungen (aus Constitution abgeleitet):
Jede Operation ist tenant-scoped und schreibt Audit Logs (Dispatcher/Run/Retention; keine Secrets/Tokens)
Graph-Aufrufe laufen über die bestehende Abstraktion (keine Hardcodings)
Retry/Backoff: Throttling → Backoff; 401/403 → kein Retry
Authorization (MVP):
TenantRole-Matrix (readonly/operator/manager/owner) statt neuer Permission-Registry
Nicht im MVP:
Kein Restore-Scheduling
Kein Cross-Tenant Bulk Scheduling / Templates
Kein Catch-up von missed runs
Review-Fokus:
Semantik “1 Run = 1 BackupSet”
Concurrency/Lock-Verhalten (bei laufendem Run → skipped)
DST/Timezone-Regeln + Slot-Minutenpräzision
Artefakte:
spec.md
plan.md
tasks.md
requirements.md

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local>
Reviewed-on: #33
2026-01-04 23:54:56 +00:00

2.2 KiB

Tasks: Backup Scheduling MVP (032)

Date: 2026-01-05 Input: spec.md, plan.md

Phase 1: Spec & Setup

  • T001 Create specs/032-backup-scheduling-mvp (spec/plan/tasks + checklist).

Phase 2: Data Model

  • T002 Add migrations: backup_schedules + backup_schedule_runs (tenant-scoped, indexes, unique slot).
  • T003 Add models + relationships (Tenant->schedules, Schedule->runs, Run->backupSet).

Phase 3: Scheduling + Dispatch

  • T004 Add command tenantpilot:schedules:dispatch.
  • T005 Register scheduler to run every minute.
  • T006 Implement due-calculation (timezone, daily/weekly) + next_run_at computation.
  • T007 Implement idempotent run creation (unique slot) + cache lock.

Phase 4: Jobs

  • T008 Implement RunBackupScheduleJob (sync -> select policy IDs -> create backup set -> update run + schedule).
  • T009 Implement ApplyBackupScheduleRetentionJob (keep last N, soft-delete backup sets).
  • T010 Add error mapping to error_code (TOKEN_EXPIRED, PERMISSION_MISSING, GRAPH_THROTTLE, UNKNOWN).
  • T021 Add audit logging for dispatcher/run/retention (tenant-scoped; no secrets).
  • T022 Implement retry/backoff strategy for RunBackupScheduleJob (no retry on 401/403).

Phase 5: Filament UI

  • T011 Add BackupScheduleResource (tenant-scoped): CRUD + enable/disable.
  • T012 Add Runs UI (relation manager or resource) with details + link to BackupSet.
  • T013 Add actions: Run now + Retry (permission-gated); notifications persisted to DB.
  • T023 Wire authorization to TenantRole (readonly/operator/manager/owner) for schedule CRUD and run actions.

Phase 6: Tests

  • T014 Unit: due-calculation + next_run_at.
  • T015 Feature: dispatcher idempotency (unique slot); lock behavior.
  • T016 Job-level: successful run creates backup set, updates run/schedule (Graph mocked).
  • T017 Job-level: token/permission/throttle errors map to error_code and status.
  • T018 Retention: keeps last N and deletes older backup sets.
  • T024 Tests: audit logs written (run success + retention delete) and retry policy behavior.

Phase 7: Verification

  • T019 Run targeted tests (Pest).
  • T020 Run Pint (./vendor/bin/pint --dirty).