commit melhorias compras4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-22 16:28:03 +02:00
parent efd97e265b
commit 36dcfdf00c
118 changed files with 6042 additions and 92 deletions
@@ -0,0 +1,61 @@
<?php
// Frozen private QA export of the authorised canonical source; never updates installed packages.
$root = dirname(__DIR__);
$source = realpath('C:/laragon/www/sgf-tempo/packages/budget-control');
if ($source === false || str_replace('\\', '/', $source) !== 'C:/laragon/www/sgf-tempo/packages/budget-control') {
throw new LogicException('Canonical common source mismatch.');
}
$files = ['bootstrap.php', 'src/BudgetContext.php', 'src/BudgetFailure.php', 'src/BudgetControl.php', 'src/BudgetDistributionPlan.php', 'src/BudgetDistributions.php', 'README.md'];
$hashes = [];
foreach ($files as $file) {
$hashes[$file] = hash_file('sha256', $source.'/'.$file);
}
$fingerprint = hash('sha256', json_encode($hashes, JSON_THROW_ON_ERROR));
$relative = 'storage/framework/testing/budget-distribution-qa-'.substr($fingerprint, 0, 16);
$target = $root.'/'.$relative;
if (! is_dir($target.'/src') && ! mkdir($target.'/src', 0700, true)) {
throw new RuntimeException('Unable to create the private artifact directory.');
}
foreach ($files as $file) {
if (is_file($target.'/'.$file) && hash_file('sha256', $target.'/'.$file) !== $hashes[$file]) {
throw new RuntimeException('An existing frozen artifact differs; it was not overwritten.');
}
if (! is_file($target.'/'.$file)) {
copy($source.'/'.$file, $target.'/'.$file);
}
if (hash_file('sha256', $target.'/'.$file) !== $hashes[$file]) {
throw new RuntimeException('Artifact byte verification failed.');
}
}
$archive = $target.'.zip';
if (! is_file($archive)) {
if (! class_exists(ZipArchive::class)) {
throw new RuntimeException('Native ZipArchive is unavailable; verified directory preserved.');
}
$zip = new ZipArchive;
if ($zip->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;