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(); }