actingAs($user); $backupSet = BackupSet::factory()->create([ 'tenant_id' => $tenant->id, ]); $restoreRun = RestoreRun::factory()->create([ 'tenant_id' => $tenant->id, 'backup_set_id' => $backupSet->id, 'is_dry_run' => true, 'status' => 'previewed', 'results' => [], ]); $attention = app(RestoreSafetyResolver::class)->resultAttentionForRun($restoreRun); expect($attention->state)->toBe(RestoreResultAttention::STATE_NOT_EXECUTED) ->and($attention->followUpRequired)->toBeFalse(); }); it('surfaces completed runs with skipped work as follow-up required', function (): void { [$user, $tenant] = createUserWithTenant(role: 'owner'); $this->actingAs($user); $backupSet = BackupSet::factory()->create([ 'tenant_id' => $tenant->id, ]); $restoreRun = RestoreRun::factory()->create([ 'tenant_id' => $tenant->id, 'backup_set_id' => $backupSet->id, 'is_dry_run' => false, 'status' => 'completed', 'results' => [ 'foundations' => [], 'items' => [ 9 => [ 'status' => 'applied', 'policy_identifier' => 'policy-9', 'assignment_outcomes' => [ ['status' => 'skipped', 'assignment' => []], ], ], ], ], 'metadata' => [ 'non_applied' => 1, ], ]); $attention = app(RestoreSafetyResolver::class)->resultAttentionForRun($restoreRun); expect($attention->state)->toBe(RestoreResultAttention::STATE_COMPLETED_WITH_FOLLOW_UP) ->and($attention->followUpRequired)->toBeTrue() ->and($attention->primaryNextAction)->toBe('review_skipped_items'); });