for($tenant)->create(); $policyRun = OperationRun::factory()->forTenant($tenant)->create([ 'type' => 'policy.sync', 'status' => OperationRunStatus::Queued->value, 'outcome' => OperationRunOutcome::Pending->value, 'created_at' => now()->subMinutes(20), 'context' => [ 'inventory' => [ 'coverage' => InventoryCoverage::buildPayload([ 'deviceConfiguration' => 'succeeded', ], []), ], ], ]); $backupSetUpdateRun = OperationRun::factory()->forTenant($tenant)->create([ 'type' => 'backup_set.update', 'status' => OperationRunStatus::Queued->value, 'outcome' => OperationRunOutcome::Pending->value, 'created_at' => now()->subMinutes(20), 'context' => [ 'backup_set_id' => 1, ], ]); $result = app(AdapterRunReconciler::class)->reconcile([ 'managed_environment_id' => (int) $tenant->getKey(), 'older_than_minutes' => 10, 'limit' => 10, 'dry_run' => false, ]); expect($result['candidates'] ?? null)->toBe(0) ->and($result['reconciled'] ?? null)->toBe(0) ->and($result['changes'] ?? null)->toBe([]); $policyRun->refresh(); $backupSetUpdateRun->refresh(); expect($policyRun->status)->toBe(OperationRunStatus::Queued->value) ->and($backupSetUpdateRun->status)->toBe(OperationRunStatus::Queued->value); }); it('does not auto-reconcile unsupported sync and backup families from adjacent selected-family proof in Spec362', function (): void { [, $tenant] = createUserWithTenant(role: 'owner'); $backupSet = BackupSet::factory()->for($tenant)->create(); $policyRun = OperationRun::factory()->forTenant($tenant)->create([ 'type' => 'policy.sync', 'status' => OperationRunStatus::Queued->value, 'outcome' => OperationRunOutcome::Pending->value, 'created_at' => now()->subMinutes(20), 'context' => [ 'inventory' => [ 'coverage' => InventoryCoverage::buildPayload([ 'deviceConfiguration' => 'succeeded', ], []), ], ], ]); $backupSetUpdateRun = OperationRun::factory()->forTenant($tenant)->create([ 'type' => 'backup_set.update', 'status' => OperationRunStatus::Queued->value, 'outcome' => OperationRunOutcome::Pending->value, 'created_at' => now()->subMinutes(20), 'context' => [ 'backup_set_id' => (int) $backupSet->getKey(), ], ]); expect(app(AdapterRunReconciler::class)->reconcileOperationRun($policyRun, true))->toBeNull() ->and(app(AdapterRunReconciler::class)->reconcileOperationRun($backupSetUpdateRun, true))->toBeNull(); }); it('keeps unsupported sync and backup detail surfaces diagnostic-first in Spec362', function (): void { [$user, $tenant] = createUserWithTenant(role: 'owner'); $policyRun = OperationRun::factory()->forTenant($tenant)->create([ 'type' => 'policy.sync', 'status' => OperationRunStatus::Queued->value, 'outcome' => OperationRunOutcome::Pending->value, 'created_at' => now()->subMinutes(20), ]); $backupSetUpdateRun = OperationRun::factory()->forTenant($tenant)->create([ 'type' => 'backup_set.update', 'status' => OperationRunStatus::Queued->value, 'outcome' => OperationRunOutcome::Pending->value, 'created_at' => now()->subMinutes(20), ]); Filament::setTenant(null, true); foreach ([$policyRun, $backupSetUpdateRun] as $run) { $this->actingAs($user) ->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id]) ->get(OperationRunLinks::tenantlessView($run)) ->assertSuccessful() ->assertSee('Monitoring detail') ->assertDontSee('Automatically reconciled'); } });