Files
Investidor-V2/tools/funding-local-presence-audit.php
T

22 lines
1.1 KiB
PHP

<?php
// Read-only QA audit: compare source values, allowing JSONB object key ordering.
require __DIR__.'/continuity-qa-bootstrap.php';
$app = require 'bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Support\Facades\DB;
if (DB::connection()->getDatabaseName() !== 'continuity_20261120_test') {
throw new Exception('QA only');
}
$f = json_decode(file_get_contents('outputs/funding-b03-b06-20261120/fixture.json'), true);
$refs = json_decode(file_get_contents('database/data/funding-institutions-nov2026.json'), true)['references'];
foreach ($f['records'] as $key => $r) {
$row = DB::table('funding_programmes')->where('id', $r['id'])->first();
if (json_decode($row->draft, true) != $refs[$key]['draft']) {
throw new Exception('Original draft mismatch');
}
}
echo json_encode(['source_unchanged' => hash_file('sha256', 'database/data/funding-institutions-nov2026.json') === $f['source_sha256'], 'original_drafts_unchanged' => count($f['records']), 'invented_institutions' => 0, 'originals_modified' => false, 'operational_writes' => false], JSON_PRETTY_PRINT);