|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
$root = dirname(__DIR__);
|
|
|
|
|
$assert = static function (bool $condition, string $message): void {
|
|
|
|
|
if (!$condition) {
|
|
|
|
|
throw new RuntimeException($message);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$reservation = file_get_contents(
|
|
|
|
|
$root . '/app/Services/Cloud/CloudTemplateImportReservation.php'
|
|
|
|
|
);
|
|
|
|
|
$multipart = file_get_contents(
|
|
|
|
|
$root . '/app/Services/Cloud/CloudTemplateMultipartAcquisition.php'
|
|
|
|
|
);
|
|
|
|
|
$cancellation = file_get_contents(
|
|
|
|
|
$root . '/app/Services/Cloud/CloudTemplateImportCancellation.php'
|
|
|
|
|
);
|
|
|
|
|
$frontend = file_get_contents(
|
|
|
|
|
$root . '/public/cloud/admin-template-upload.js'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$assert(is_string($reservation)
|
|
|
|
|
&& str_contains($reservation, "'last_modified', 'sha256'")
|
|
|
|
|
&& str_contains($reservation,
|
|
|
|
|
'开始上传前必须完成云镜像 SHA-256 校验')
|
|
|
|
|
&& str_contains($reservation,
|
|
|
|
|
'CloudTemplateStoragePublicationService::reserve($intent)'),
|
|
|
|
|
'Local template upload did not freeze identity before provider I/O.');
|
|
|
|
|
|
|
|
|
|
$assert(is_string($multipart)
|
|
|
|
|
&& str_contains($multipart,
|
|
|
|
|
'CloudStorageArtifactService::claimPrimaryPreparation(')
|
|
|
|
|
&& str_contains($multipart,
|
|
|
|
|
'prepareKnownIdentityMultipartUpload(')
|
|
|
|
|
&& str_contains($multipart,
|
|
|
|
|
'CloudStorageArtifactService::markPrimaryAwaitingReceipt(')
|
|
|
|
|
&& str_contains($multipart,
|
|
|
|
|
'CloudStorageArtifactService::completePrimary(')
|
|
|
|
|
&& str_contains($multipart,
|
|
|
|
|
"(string) \$identity['sha256']")
|
|
|
|
|
&& str_contains($multipart, 'inspectObject(')
|
|
|
|
|
&& str_contains($multipart,
|
|
|
|
|
'findMultipartUploadsByExactObjectKey(')
|
|
|
|
|
&& str_contains($multipart,
|
|
|
|
|
'reschedulePrimaryAfterStableAbsence(')
|
|
|
|
|
&& str_contains($multipart,
|
|
|
|
|
'markPrimaryPreparationAttention(')
|
|
|
|
|
&& str_contains($multipart, 'ACTION_RECONCILE_MULTIPART_START'),
|
|
|
|
|
'Multipart template upload lost its original-operation recovery fence.');
|
|
|
|
|
|
|
|
|
|
$assert(is_string($cancellation)
|
|
|
|
|
&& str_contains($cancellation,
|
|
|
|
|
'cancelNeverDispatched($intent, $client)')
|
|
|
|
|
&& str_contains($cancellation,
|
|
|
|
|
'cancelAfterConfirmedAbort($intent, $client)')
|
|
|
|
|
&& str_contains($cancellation,
|
|
|
|
|
'CloudTemplateStoragePublicationService::primaryRuntime(')
|
|
|
|
|
&& str_contains($cancellation,
|
|
|
|
|
"->where('template_import_intent_id', (string) \$intent->id)")
|
|
|
|
|
&& !str_contains($cancellation, 'self::runtime($intent)'),
|
|
|
|
|
'Template cancellation retained the legacy frozen-runtime cleanup path.');
|
|
|
|
|
|
|
|
|
|
$hashPosition = is_string($frontend)
|
|
|
|
|
? strpos($frontend, 'const sha256 = await activeHash.promise;') : false;
|
|
|
|
|
$reservePosition = is_string($frontend)
|
|
|
|
|
? strpos($frontend, "'/api/v1/admin/cloud-template-imports', {") : false;
|
|
|
|
|
$assert(is_int($hashPosition) && is_int($reservePosition)
|
|
|
|
|
&& $hashPosition < $reservePosition
|
|
|
|
|
&& str_contains($frontend, 'protection_pending === true')
|
|
|
|
|
&& str_contains($frontend, 'const unknownCreate =')
|
|
|
|
|
&& !str_contains($frontend,
|
|
|
|
|
"body: { sha256 }, response: 'task'"),
|
|
|
|
|
'Template upload UI crosses storage before hashing or rejects protection wait.');
|
|
|
|
|
|
|
|
|
|
echo "Template multipart storage-ledger contract passed.\n";
|