make(Kernel::class)->bootstrap(); $dir = storage_path('app/private/investmoz-v2'); $read = function (string $file): array { $text = file_get_contents($file); if ($text === false) { throw new RuntimeException('Missing evidence: '.basename($file)); } return json_decode(preg_replace('/^\xEF\xBB\xBF/', '', $text), true, 512, JSON_THROW_ON_ERROR); }; $backup = $read($dir.'/opportunity-resources-backup-proof.json'); $compatibility = $read($dir.'/opportunity-resources-compatibility.json'); $tests = $read($dir.'/portal-audit/phpunit-final.json'); $routeChecks = $read($dir.'/portal-audit/ensaios-rotas.json'); $hash = $app->make(OpportunityResourceInstallation::class)->fingerprint(); if (! ($backup['restore_verified'] ?? false) || ! ($backup['files_verified'] ?? false) || ($backup['target']['database'] ?? '') !== 'investemoz' || (int) ($backup['target']['port'] ?? 0) !== 5432 || ! str_ends_with($backup['restored_target']['database'] ?? '', '_test') || (int) ($backup['restored_target']['port'] ?? 0) !== 55441 || ($compatibility['target'] ?? []) !== $backup['restored_target'] || ! ($compatibility['compatibility_verified'] ?? false) || ! ($compatibility['reversal_verified'] ?? false) || ($compatibility['code_hash'] ?? '') !== $hash || ($tests['result'] ?? '') !== 'passed' || (int) ($tests['tests'] ?? 0) < 1 || ($tests['passed'] ?? 0) !== ($tests['tests'] ?? 0) || ($tests['skipped'] ?? 0) !== 0 || ($routeChecks['failures'] ?? ['missing']) !== [] || strtotime($backup['verified_at']) < time() - 86400 || hash_file('sha256', $backup['dump_path']) !== $backup['sha256'] || hash_file('sha256', $backup['files_path']) !== $backup['files_sha256']) { throw new RuntimeException('Current backup, isolated reversal and QA evidence required; no activation proof written.'); } $proof = [ 'restore_verified' => true, 'compatibility_verified' => true, 'reversal_verified' => true, 'qa_passed' => true, 'code_hash' => $hash, 'target' => $backup['target'], 'verified_at' => $backup['verified_at'], 'dump_path' => $backup['dump_path'], 'sha256' => $backup['sha256'], 'qa_scope' => 'Schema compatibility/reversal, automated server QA and frontend build/type checks; not full visual or legal acceptance.', 'tests' => ['total' => $tests['tests'], 'passed' => $tests['passed'], 'assertions' => $tests['assertions'], 'skipped_real_clamd' => 0, 'source' => 'phpunit-final.json', 'scope' => 'Regression inventory only; not individual requirement or visual acceptance'], 'browser_current_version_verified' => false, 'full_portal_acceptance' => false, 'outstanding' => ['Current UI walkthroughs: browser unavailable', 'Portable ClamD healthy now; reboot startup and periodic updates require configuration', 'GD/WebP in active web PHP and each real derivative scan not verified', 'Official geometry QA import remains private; public map layers incomplete', 'Final review/publication and specialized opportunity contracts remain open'], 'active_writes' => 0, ]; $destination = $dir.'/opportunity-resources-activation-proof.json'; if (is_file($destination)) { $archive = $dir.'/portal-audit/resources-activation-proof-'.gmdate('Ymd_His').'-'.bin2hex(random_bytes(3)).'.json'; if (! copy($destination, $archive)) { throw new RuntimeException('Cannot preserve previous activation evidence.'); } } file_put_contents($destination, json_encode($proof, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)); file_put_contents($dir.'/portal-audit/activation-evidence.json', json_encode($proof, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)); echo json_encode(['prepared' => true, 'code_hash' => $hash, 'backup_date' => $backup['verified_at'], 'installed_by_this_tool' => false, 'authenticated_action_required' => true, 'browser_verified' => false], JSON_THROW_ON_ERROR).PHP_EOL;