open($archive, ZipArchive::CREATE | ZipArchive::EXCL) !== true) { throw new RuntimeException('Unable to create the private artifact ZIP.'); } foreach ($files as $file) { $zip->addFile($target.'/'.$file, $file); } $zip->close(); } $zip = new ZipArchive; if ($zip->open($archive) !== true || $zip->numFiles !== count($files)) { throw new RuntimeException('Private ZIP inventory mismatch.'); } foreach ($files as $file) { if (hash('sha256', $zip->getFromName($file)) !== $hashes[$file]) { throw new RuntimeException('Private ZIP differs from the canonical source.'); } } $zip->close(); $proof = ['date' => '2026-11-22', 'status' => 'private_qa_artifact_prepared_not_published', 'path' => $relative, 'archive' => $relative.'.zip', 'archive_sha256' => hash_file('sha256', $archive), 'canonical_fingerprint' => $fingerprint, 'files' => $hashes, 'host_schema' => 'database/qa-migrations/2026_11_22_000004_create_budget_distributions.php', 'host_schema_sha256' => hash_file('sha256', $root.'/database/qa-migrations/2026_11_22_000004_create_budget_distributions.php'), 'installed_financial_packages_changed' => false, 'pilot_or_sgf_activation' => false]; file_put_contents($root.'/docs/proofs/rq01-distribution-artifact.json', json_encode($proof, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR).PHP_EOL); echo json_encode(['private_artifact_prepared' => true, 'files' => count($files), 'archive_sha256' => $proof['archive_sha256'], 'path' => $relative], JSON_THROW_ON_ERROR).PHP_EOL;