This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
// Read-only against the active database. Evidence is written only to private files.
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
$app = require __DIR__.'/../bootstrap/app.php';
|
||||
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
$directory = storage_path('app/private/partnership-exchange');
|
||||
$tests = json_decode(ltrim(file_get_contents($directory.'/qa-tests.json'), "\xEF\xBB\xBF"), true, 512, JSON_THROW_ON_ERROR);
|
||||
$checks = json_decode(ltrim(file_get_contents($directory.'/qa-checks.json'), "\xEF\xBB\xBF"), true, 512, JSON_THROW_ON_ERROR);
|
||||
$browser = json_decode(file_get_contents(base_path('docs/investmoz/partnerships/browser-qa.json')), true, 512, JSON_THROW_ON_ERROR);
|
||||
if (($tests['result'] ?? '') !== 'passed' || ($tests['passed'] ?? 0) < 46 || ! ($browser['passed'] ?? false)
|
||||
|| ($browser['target'] ?? '') !== 'anchor_restore_20261007_test:55441' || ! ($checks['typescript'] ?? false) || ! ($checks['build'] ?? false)) {
|
||||
throw new RuntimeException('QA evidence is incomplete.');
|
||||
}
|
||||
$installer = app(App\Services\PartnershipInstallation::class);
|
||||
$proof = json_decode(file_get_contents($directory.'/backup-proof.json'), true, 512, JSON_THROW_ON_ERROR);
|
||||
if (! ($proof['restore_verified'] ?? false) || hash_file('sha256', $proof['dump_path']) !== $proof['sha256']) {
|
||||
throw new RuntimeException('Verified restore proof or dump unavailable.');
|
||||
}
|
||||
$evidence = ['passed' => true, 'code_hash' => $installer->fingerprint(), 'database' => 'anchor_restore_20261007_test', 'port' => 55441,
|
||||
'tests' => $tests, 'checks' => $checks, 'browser' => $browser, 'generated_at' => now()->toIso8601String()];
|
||||
file_put_contents($directory.'/qa-evidence.json', json_encode($evidence, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR));
|
||||
$preview = $installer->preview();
|
||||
echo json_encode(['target' => $preview['target'], 'installed' => $preview['installed'], 'preserved_records' => count($preview['records']),
|
||||
'backupVerified' => $preview['backupVerified'], 'qaVerified' => $preview['qaVerified'], 'code_hash' => $evidence['code_hash']], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR).PHP_EOL;
|
||||
Reference in New Issue
Block a user