sshKeyOptions(')) && str_contains($pageMethod, "'user' => \$this->userBootstrap(\$user, \$actor)") && str_contains($pageMethod, "'ssh_keys' => \$keys") && str_contains($pageMethod, "\$requestedView = \$request->getQueryParams()['view'] ?? 'list'") && str_contains($pageMethod, "\$requestedView === 'add'") && str_contains($pageMethod, "'cloud_ssh_keys_view' => \$view") && str_contains($pageMethod, "'cloud_ssh_keys' => \$keys") && str_contains($pageMethod, "'cloud_ssh_keys_bootstrap_json' => \$this->safeJson(\$payload)"), 'SSH-key controller must embed an owner-scoped first-paint list and session bootstrap.'); $assert(str_contains($controller, 'JSON_HEX_TAG') && str_contains($controller, "'csrf_token' => AdminCsrf::token()") && str_contains($controller, "withHeader('Cache-Control', 'private, no-store')"), 'SSH-key HTML bootstrap must be script-safe, authenticated and non-cacheable.'); $assert(str_contains($keyService, "CloudSSHKey::where('user_id', \$userId)") && str_contains($keyService, "'id', 'name', 'fingerprint', 'created_at'") && !str_contains($keyService, "'public_key'") && !str_contains($keyOptions, "'public_key'"), 'The server-rendered key list must be owner scoped and omit key material.'); $assert(str_contains($template, 'id="ssh-keys-bootstrap" type="application/json"') && str_contains($template, '{$cloud_ssh_keys_bootstrap_json nofilter}') && str_contains($template, '{foreach $cloud_ssh_keys as $key}') && str_contains($template, '{$key.name|escape:"html"}') && str_contains($template, '{$key.fingerprint|escape:"html"}') && str_contains($template, 'id="ssh-key-list-view"') && str_contains($template, "{user_copy key='ssh_keys.list.panel.title'}") && str_contains($template, 'id="ssh-key-add-button"') && str_contains($template, '/user/cloud/ssh-keys?view=add') && str_contains($template, 'id="ssh-key-add-view"') && str_contains($template, 'id="ssh-key-name"') && str_contains($template, 'id="ssh-key-public-key"') && !str_contains($template, 'type="file"') && !str_contains($template, 'ssh-key-file') && !str_contains($template, '正在加载') && !str_contains($template, '$key.public_key'), 'SSH-key HTML must separate the list and paste-only add views without local file upload.'); $assert(!str_contains($module, '/cloud/runtime.js') && !str_contains($module, '/api/v1/session') && !str_contains($module, 'initializeSession') && str_contains($module, 'ssh-keys-bootstrap') && (str_contains($module, 'function hydrate(') || str_contains($module, 'function readBootstrap(')), 'SSH-key interactions must hydrate the embedded payload without the all-feature runtime or session API.'); $assert($initialize !== '' && !preg_match("/api\\(\\s*['\"]\\/api\\/v1\\/ssh-keys['\"]\\s*\\)/", $module) && !preg_match("/fetch\\(\\s*['\"]\\/api\\/v1\\/ssh-keys['\"]\\s*\\)/", $module), 'SSH-key first paint must not issue an unqualified collection GET after hydration.'); $assert(str_contains($module, '/api/v1/ssh-keys') && str_contains($module, "method: 'POST'") && str_contains($module, "method: 'DELETE'") && str_contains($module, "location.assign('/user/cloud/ssh-keys')") && !str_contains($module, 'importKeyFile') && !str_contains($module, 'ssh-key-file'), 'SSH-key JavaScript must retain explicit create and delete mutations.'); $assert(str_contains($module, 'globalThis.VenixUserCopy') && str_contains($module, "t('ssh_keys.confirm.delete.body', { name: key.name })") && !preg_match('/payload\?\.(?:detail|message|msg|error)/', $module) && !preg_match('/showError\([^\n]+error\?*\.message/', $module), 'SSH-key feedback must use stable copy keys and never expose raw backend messages.'); $assert(str_contains($keyApi, "['id' => (int) \$key->id, 'name' => \$key->name, 'fingerprint' => \$key->fingerprint]") && !str_contains($keyApi, "'public_key' => \$key->public_key"), 'SSH-key create API must return the safe fields required for local list hydration.'); $assert(str_contains($middleware, 'CloudAccess::actor(!$databaseOnly)') && str_contains($middleware, '#^/api/v1/ssh-keys(?:/|$)#D'), 'SSH-key API calls are database-only and must not create or contact a cloud engine session.'); echo "SSH-key server-rendered first-page performance contract passed.\n";