Files
Investidor-V2/outputs/investmoz-audit-current-20261012/verify-case32-review-evidence-readonly-20261014.php
T
nala 5738418838
tests / ci (push) Canceled after 0s
oportunidades 9
2026-10-14 16:57:56 +02:00

43 lines
2.9 KiB
PHP

<?php
ini_set('zend.exception_ignore_args', '1');
putenv('STABILITY_QA_MODE=consumers');
$taskRoot = dirname(__DIR__, 2);
$taskQA = $taskRoot.'/storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742';
$proofPath = __DIR__.'/case32-review-evidence-readonly-20261014.json';
if (is_file($proofPath)) { throw new RuntimeException('Preservar prova anterior.'); }
$app = require $taskQA.'/tools/portal-stability-runtime.php';
$db = Illuminate\Support\Facades\DB::connection();
$target = (array) $db->selectOne('SELECT current_database() AS database, inet_server_port() AS port');
if ($target !== ['database'=>'stability_consumers_20261011_084534_test','port'=>55441]) { throw new RuntimeException('QA isolada obrigatória.'); }
$db->beginTransaction(); $db->statement('SET TRANSACTION READ ONLY');
try {
$record = App\Models\Opportunity::findOrFail(32);
$context = $record->workflow_context ?? [];
$documents = $context['submission']['resources']['documents'] ?? [];
$selected = app(App\Services\OpportunityManagement::class)->values($record)['canonical']['documents'] ?? [];
$options = app(App\Services\OpportunityCanonicalContract::class)->options(App\Models\User::findOrFail(24), $record);
$rows = [];
foreach ($options['resources']['documents'] ?? [] as $document) {
$file = $document->file;
$filename = $file->file_name ?? '';
$synthetic = preg_match('/^(synthetic-qa-proof|functional-land-synthetic-|qa-B8-land-)/', $filename) === 1;
$title = $document->payload['title'] ?? $filename;
$rows[] = ['id'=>$document->id, 'synthetic_filename'=>$synthetic ? $filename : null,
'UI_title_equals_filename'=>$title === $filename,
'synthetic_UI_title'=>$synthetic ? $title : null,
'selected_in_canonical'=>in_array($document->id, $selected, true),
'present_in_submission'=>array_key_exists($document->id, $documents),
'snapshot_hash_matches'=>isset($documents[$document->id]) && ($documents[$document->id]['sha256']??null) === ($file->sha256??null),
'scan_status'=>$file->malware_scan_status??null];
}
$proof = ['at'=>gmdate('c'), 'base_review'=>'396c691930bc', 'target'=>$target, 'SQL_read_only'=>true,
'case'=>32, 'QA_actor'=>24, 'management_version'=>(int)$record->management_version,
'review_cycle'=>$context['review_cycle'], 'documents'=>$rows,
'review_requires_explicit_evidence_selection'=>true,
'submission_attachment_does_not_auto_select_reviewer_evidence'=>true,
'only_synthetic_names_exported'=>true, 'document_contents_not_exported'=>true,
'QA_database_changes'=>0, 'active_changes'=>0];
file_put_contents($proofPath, json_encode($proof, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR).PHP_EOL);
echo json_encode($proof, JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR).PHP_EOL;
} finally { $db->rollBack(); }