Files
Investidor-V2/outputs/investmoz-audit-current-20261012/diagnose-line07-triage-readonly-20261015.php
T
nala c13f250b87
tests / ci (push) Canceled after 0s
versao compilada
2026-10-15 17:37:00 +02:00

36 lines
2.6 KiB
PHP

<?php
ini_set('zend.exception_ignore_args', '1');
putenv('STABILITY_QA_MODE=consumers');
$root = dirname(__DIR__, 2);
$app = require $root.'/storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742/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 isolation required'); }
$db->beginTransaction();
$db->statement('SET TRANSACTION READ ONLY');
try {
$b = app(App\Services\Mne\BusinessRepository::class)->find('172aa874-98fc-4bf6-b78f-d2e9a386d345');
$a = app(App\Services\PortalProfileAccess::class);
$actors = [];
foreach ([21,24,25] as $id) {
$u = App\Models\User::findOrFail($id);
$actors[] = ['QA_account'=>$id, 'owns'=>(int)$b->owner_user_id === $id,
'email_verified'=>$u->hasVerifiedEmail(), 'MFA_enrolled'=>$u->two_factor_confirmed_at !== null,
'operational_validate'=>$a->operational($u, 'validate'),
'roles'=>array_map(fn($g)=>['role'=>$g->role,'organization_scope_is_global'=>$g->organization_id===null,
'includes_business_sale'=>in_array('business_sale',json_decode($g->opportunity_types,true),true)],$a->grants($u))];
}
$proof = ['at'=>gmdate('c'),'target'=>$target,'SQL_read_only'=>true,'business_id'=>$b->id,
'status'=>$b->status,'version'=>$b->version_no,'modality'=>$b->modality,'actors'=>$actors,
'transitions'=>$db->table('business_workflow_transitions')->where('existing_business_id',$b->id)->orderBy('created_at')->get(['from_status','to_status','actor_id','created_at']),
'per_record_assignment_required'=>false,'policy_scope'=>'active global validator grant including business_sale, operational access and actual recent MFA session',
'CLI_MFA_not_simulated'=>true,'previous_CLI_denial_is_not_browser_authorization_result'=>true,
'UI_disabled_guard'=>'busy || note.trim().length < 10',
'server_note_rule'=>'required|string|min:10|max:2000',
'QA_database_changes'=>0,'active_changes'=>0];
$path=__DIR__.'/'.(($argv[1] ?? '') === 'after' ? 'line07-triage-after-readonly-20261015.json' : 'line07-triage-readonly-20261015.json');
if(is_file($path)) throw new RuntimeException('Preserve evidence');
file_put_contents($path,json_encode($proof,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES).PHP_EOL);
echo json_encode($proof,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
} finally { $db->rollBack(); }