TenantAtlas/tests/Unit
ahmido 4d3fcd28a9 feat/032-backup-scheduling-mvp (#34)
What
Implements tenant-scoped backup scheduling end-to-end: schedules CRUD, minute-based dispatch, queued execution, run history, manual “Run now/Retry”, retention (keep last N), and auditability.

Key changes

Filament UI: Backup Schedules resource with tenant scoping + SEC-002 role gating.
Scheduler + queue: tenantpilot:schedules:dispatch command wired in scheduler (runs every minute), creates idempotent BackupScheduleRun records and dispatches jobs.
Execution: RunBackupScheduleJob syncs policies, creates immutable backup sets, updates run status, writes audit logs, applies retry/backoff mapping, and triggers retention.
Run history: Relation manager + “View” modal rendering run details.
UX polish: row actions grouped; bulk actions grouped (run now / retry / delete). Bulk dispatch writes DB notifications (shows in notifications panel).
Validation: policy type hard-validation on save; unknown policy types handled safely at runtime (skipped/partial).
Tests: comprehensive Pest coverage for CRUD/scoping/validation, idempotency, job outcomes, error mapping, retention, view modal, run-now/retry notifications, bulk delete (incl. operator forbidden).
Files / Areas

Filament: BackupScheduleResource.php and app/Filament/Resources/BackupScheduleResource/*
Scheduling/Jobs: app/Console/Commands/TenantpilotDispatchBackupSchedules.php, app/Jobs/RunBackupScheduleJob.php, app/Jobs/ApplyBackupScheduleRetentionJob.php, console.php
Models/Migrations: app/Models/BackupSchedule.php, app/Models/BackupScheduleRun.php, database/migrations/backup_schedules, backup_schedule_runs
Notifications: BackupScheduleRunDispatchedNotification.php
Specs: specs/032-backup-scheduling-mvp/* (tasks/checklist/quickstart updates)
How to test (Sail)

Run tests: ./vendor/bin/sail artisan test tests/Feature/BackupScheduling
Run formatter: ./vendor/bin/sail php ./vendor/bin/pint --dirty
Apply migrations: ./vendor/bin/sail artisan migrate
Manual dispatch: ./vendor/bin/sail artisan tenantpilot:schedules:dispatch
Notes

Uses DB notifications for queued UI actions to ensure they appear in the notifications panel even under queue fakes in tests.
Checklist gate for 032 is PASS; tasks updated accordingly.

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local>
Reviewed-on: #34
2026-01-05 04:22:13 +00:00
..
BackupScheduling feat/032-backup-scheduling-mvp (#34) 2026-01-05 04:22:13 +00:00
AppProtectionPolicyNormalizerTest.php feat/009-app-protection-policy (#11) 2025-12-29 16:11:50 +00:00
AssignmentBackupServiceTest.php fix: improve assignment capture/restore and filter name handling (#8) 2025-12-28 13:59:12 +00:00
AssignmentFetcherTest.php 013-scripts-management (#19) 2026-01-01 22:02:30 +00:00
AssignmentFilterResolverTest.php feat/004-assignments-scope-tags (#4) 2025-12-23 21:49:58 +00:00
AssignmentRestoreServiceTest.php feat/009-app-protection-policy (#11) 2025-12-29 16:11:50 +00:00
BackupItemTest.php feat/004-assignments-scope-tags (#4) 2025-12-23 21:49:58 +00:00
BulkActionPermissionTest.php feat/031-tenant-portfolio-context-switch (#32) 2026-01-04 21:28:08 +00:00
BulkBackupSetDeleteJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkBackupSetForceDeleteJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkBackupSetRestoreJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkOperationAbortMethodTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkOperationRunProgressTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkPolicyDeleteJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkPolicyExportJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkPolicyVersionForceDeleteJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkPolicyVersionPruneJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkPolicyVersionRestoreJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkRestoreRunDeleteJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
BulkRestoreRunRestoreJobTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
CircuitBreakerTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
CompliancePolicyNormalizerTest.php feat(007): device config & compliance snapshot/restore improvements (#9) 2025-12-29 12:46:20 +00:00
DefaultPolicyNormalizerDiffTest.php feat(007): device config & compliance snapshot/restore improvements (#9) 2025-12-29 12:46:20 +00:00
DeviceConfigurationPolicyNormalizerTest.php fix: improve assignment capture/restore and filter name handling (#8) 2025-12-28 13:59:12 +00:00
ExampleTest.php Initial commit from Specify template 2025-12-10 22:27:21 +01:00
FoundationMappingServiceTest.php feat(006): foundations + assignment mapping and preview-only restore guard (#7) 2025-12-26 23:44:31 +00:00
FoundationSnapshotServiceTest.php feat/012-windows-update-rings (#18) 2026-01-01 10:44:17 +00:00
GraphClientEndpointResolutionTest.php feat: endpoint security restore execution (023) (#25) 2026-01-03 22:44:08 +00:00
GraphClientScopeTest.php dev-merges/c709b36 (#3) 2025-12-21 23:15:12 +00:00
GraphContractFallbackTest.php feat: merge 001-filament-json 2025-12-14 20:23:18 +01:00
GraphContractRegistryActualDataTest.php feat/009-app-protection-policy (#11) 2025-12-29 16:11:50 +00:00
GraphContractRegistrySettingsApplySanitizerTest.php feat: merge 001-filament-json 2025-12-14 20:23:18 +01:00
GraphContractRegistrySettingsWriteStrategyTest.php dev-merges/c709b36 (#3) 2025-12-21 23:15:12 +00:00
GraphContractRegistryTest.php feat(007): device config & compliance snapshot/restore improvements (#9) 2025-12-29 12:46:20 +00:00
GroupResolverTest.php feat/004-assignments-scope-tags (#4) 2025-12-23 21:49:58 +00:00
ManagedDeviceAppConfigurationNormalizerTest.php feat/017-policy-types-mam-endpoint-security-baselines (#23) 2026-01-03 02:06:35 +00:00
MicrosoftGraphClientListPoliciesSelectTest.php feat/017-policy-types-mam-endpoint-security-baselines (#23) 2026-01-03 02:06:35 +00:00
MicrosoftGraphClientTest.php Intune RBAC: graceful unsupported-account handling, health-check fixes, tests and docs updates 2025-12-13 01:25:06 +01:00
PolicyCaptureOrchestratorTest.php feat/017-policy-types-mam-endpoint-security-baselines (#23) 2026-01-03 02:06:35 +00:00
PolicyNormalizerRoutingTest.php fix: improve assignment capture/restore and filter name handling (#8) 2025-12-28 13:59:12 +00:00
PolicyNormalizerSettingsCatalogFlattenTest.php dev-merges/c709b36 (#3) 2025-12-21 23:15:12 +00:00
PolicyNormalizerSettingsCatalogTest.php dev-merges/c709b36 (#3) 2025-12-21 23:15:12 +00:00
PolicyNormalizerTest.php feat/027-enrollment-config-subtypes (#31) 2026-01-04 13:25:15 +00:00
PolicyPickerOptionLabelTest.php 015-policy-picker-ux (#21) 2026-01-02 13:59:15 +00:00
PolicySnapshotServiceTest.php feat/027-enrollment-config-subtypes (#31) 2026-01-04 13:25:15 +00:00
PolicyVersionEligibilityTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
RbacOnboardingServiceTest.php Intune RBAC: graceful unsupported-account handling, health-check fixes, tests and docs updates 2025-12-13 01:25:06 +01:00
RestoreRunDeletableTest.php feat/005-bulk-operations (#5) 2025-12-25 13:32:36 +00:00
RestoreRunTest.php feat/004-assignments-scope-tags (#4) 2025-12-23 21:49:58 +00:00
ScopeTagResolverTest.php feat/004-assignments-scope-tags (#4) 2025-12-23 21:49:58 +00:00
ScriptsPolicyNormalizerTest.php 013-scripts-management (#19) 2026-01-01 22:02:30 +00:00
SettingsCatalogPolicyNormalizerTest.php feat/017-policy-types-mam-endpoint-security-baselines (#23) 2026-01-03 02:06:35 +00:00
TenantCurrentTest.php feat/012-windows-update-rings (#18) 2026-01-01 10:44:17 +00:00
TenantPermissionServiceTest.php feat(006): foundations + assignment mapping and preview-only restore guard (#7) 2025-12-26 23:44:31 +00:00
TenantResourceConsentUrlTest.php dev-merges/c709b36 (#3) 2025-12-21 23:15:12 +00:00
TenantScopeTest.php feat: TenantPilot v1 - Complete implementation (Phases 1-12) 2025-12-12 02:27:54 +01:00
VersionDiffTest.php feat: TenantPilot v1 - Complete implementation (Phases 1-12) 2025-12-12 02:27:54 +01:00
WindowsDriverUpdateProfileNormalizerTest.php feat/018-driver-updates-wufb (#27) 2026-01-04 00:38:54 +00:00