setUserResolver(fn()=>$user);Illuminate\Support\Facades\Auth::setUser($user); app()->instance('session',app('session')->driver()); $manifest=app(App\Services\EconomicReferenceCatalog::class)->manifest();$id=$manifest['chains'][0]['id']; DB::beginTransaction();try{ DB::table('value_chains')->where('id',$id)->update(['name'=>'Conflito sintético transacional QA']); $plan=app(App\Services\EconomicReferenceInstallation::class)->preview($user); $found=collect($plan['rows'])->firstWhere('id',$id); if($found['status']!=='conflict'||$plan['operations']['import']['ready']||!$plan['common_reasons'])throw new RuntimeException('Conflict not refused'); file_put_contents(__DIR__.'/REFERENCE-CONFLICT-QA.json',json_encode(['transaction_rolled_back'=>true,'identity_conflict_detected'=>true,'operation_disabled'=>true,'visible_reasons'=>$plan['common_reasons'],'active_changes'=>0],JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE)); }finally{DB::rollBack();} echo 'Reference conflict detected without persisting any change.';