test: align transition recovery projection contract

go
codex 2 weeks ago
parent 6eef9f03a5
commit e57ac44fbd

@ -71,8 +71,8 @@ $finishLocked = static function (CloudJob $source, array $payload,
});
};
// Legacy in-flight scalar tasks remain recoverable while transition-owned
// tasks require the exact typed public-network projection.
// Recovery accepts only the transition-owned typed public-network projection.
// Retired scalar tasks have no recovery authority after the clean break.
$projectionMethod = new ReflectionMethod(
CloudAdminOperationRecoveryService::class,
'effectProjection'
@ -81,28 +81,20 @@ $legacyProjection = [
'uuid' => (string) CloudInstance::find(1)->uuid,
'network_changed' => true,
];
$assert($projectionMethod->invoke(
null,
$legacyProjection,
'network_change',
'applied',
false
) === $legacyProjection,
'Legacy scalar network-change recovery schema was removed too early.');
$typedProjectionRejected = false;
$legacyProjectionRejected = false;
try {
$projectionMethod->invoke(
null,
$legacyProjection,
'network_change',
'applied',
true
false
);
} catch (Throwable) {
$typedProjectionRejected = true;
$legacyProjectionRejected = true;
}
$assert($typedProjectionRejected,
'Transition recovery accepted a projection without public_network.');
$assert($legacyProjectionRejected,
'Recovery accepted a retired scalar network-change projection.');
$typedProjection = $legacyProjection + [
'public_network' => $dispatch->target()->toArray(),
];

Loading…
Cancel
Save