'string', 'size' => 'string', ] && $entries['isos.confirm.delete.body']['parameters'] === ['name' => 'string'] && $entries['ssh_keys.confirm.delete.body']['parameters'] === ['name' => 'string'] && $entries['isos.error.request']['parameters'] === ['status' => 'integer'] && $entries['ssh_keys.error.request']['parameters'] === ['status' => 'integer'], 'Media/key parameter contracts drifted from their call sites.'); foreach ($entries as $entry) { if (!in_array($entry['scope'], ['isos', 'ssh_keys'], true) || !str_starts_with($entry['kind'], 'toast_')) { continue; } $assert(in_array($entry['toast_tone'], ['success', 'warning', 'error', 'info'], true), 'Media/key Toast copy is missing an explicit tone: ' . $entry['key']); } $paths = [ $root . '/resources/views/venix/cloud/pages/isos.tpl', $root . '/resources/views/venix/cloud/pages/keys.tpl', $root . '/public/cloud/iso-images.js', $root . '/public/cloud/ssh-keys.js', ]; $violations = UserCopyCoverageScanner::scanFiles($paths); $assert($violations === [], 'Media/key pages retain direct user-visible copy: ' . json_encode($violations, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); $referenced = []; foreach ($paths as $path) { $source = file_get_contents($path); preg_match_all( '/(?:user_copy\s+key=|\bt\()[\'\"]((?:isos|ssh_keys)\.[a-z0-9_.]+)[\'\"]/', $source, $matches ); array_push($referenced, ...$matches[1]); } foreach (array_unique($referenced) as $key) { $assert(isset($entries[$key]), 'Media/key source references an undeclared key: ' . $key); } $isoModule = file_get_contents($root . '/public/cloud/iso-images.js'); $keyModule = file_get_contents($root . '/public/cloud/ssh-keys.js'); $assert(str_contains($isoModule, 'globalThis.VenixUserCopy') && str_contains($keyModule, 'globalThis.VenixUserCopy'), 'Media/key modules must resolve feedback through the user-copy runtime.'); $assert(!preg_match('/payload\?\.(?:detail|message|msg|error)/', $keyModule) && !preg_match('/task\?\.error/', $isoModule) && !str_contains($isoModule, 'recoveryTaskFailureNotice(task)') && !preg_match('/showError\([^\n]+error\?*\.message/', $isoModule . "\n" . $keyModule), 'Media/key feedback must not expose raw backend or task messages.'); $assert(str_contains($isoModule, "t('isos.confirm.delete.body', { name: isoName })") && str_contains($keyModule, "t('ssh_keys.confirm.delete.body', { name: key.name })") && str_contains($isoModule, "t('isos.toast.import.ready.title')") && str_contains($keyModule, "t('ssh_keys.toast.deleted.title')"), 'Media/key confirmations and Toasts must use their parameterized copy contracts.'); $assert(str_contains($isoModule, 'uncertainMutations: new Set()') && str_contains($isoModule, "pageState.activeStatusUrl = 'unknown'") && substr_count($keyModule, 'if (!keepLocked) setMutationBusy(false);') === 2, 'Unknown media/key mutations must remain locally locked until a fresh page reconciliation.'); echo "ISO and SSH-key user-copy contract checks passed.\n";