document($enter('prepare'),$g['local_source_id']);unset($doc['local_id']);$doc['document']=270002;$doc['number']='QA-SECOND-FOCUS-60';$payload=Payables::canonical($doc); $local=DB::table('pa_imported_sources')->insertGetId($scope+['payload'=>$payload,'receipt_hash'=>hash('sha256',$payload)]); $p=app(SupplierPayables::class)->engine($enter('prepare'))->command('prepare',$local,'Explicit second synthetic source for focus isolation.',(string)Str::uuid()); $o=app(SupplierPayables::class)->engine($enter('validate'))->command('validate',$p['proposal_id'],'Independent second synthetic recognition.',(string)Str::uuid()); $p=$command('prepare','prepare',array_replace($g['body'],['obligation_id'=>$o['obligation_id']])); $command('validate','validate',['proposal_id'=>$p['proposal_id'],'revision'=>$p['revision'],'decision'=>'approved','reason'=>'Independent review of second focus source.']); $j=$command('prepare','post',['proposal_id'=>$p['proposal_id'],'revision'=>$p['revision'],'reason'=>'Second isolated journal for read focus only.']); $all=$ledger->listing($enter('read')); $check(count($all['journals'])===2&&$all['totals']['debit_minor']===12000&&count($all['events'])===6,'Unfiltered view includes both effects'); foreach([$http['obligation_id']=>$http['journal_id'],$o['obligation_id']=>$j['journal_id']] as $obligation=>$journal){ $data=$ledger->listing($enter('read'),['obligation_id'=>$obligation]); $check(count($data['journals'])===1&&$data['journals'][0]->id===$journal&&count($data['lines'])===2,'Only focused journal and lines'); $check(count($data['proposals'])===1&&$data['proposals'][0]->obligation_id===$obligation&&count($data['reviews'])===1,'Only focused preparation and independent review'); $check(count($data['events'])===3&&$data['totals']['debit_minor']===6000&&$data['totals']['credit_minor']===6000,'All three focused event kinds and scoped totals'); $check(count($ledger->listing($enter('read'),['obligation_id'=>$obligation,'page'=>2])['journals'])===0,'Empty focused second page does not repeat first'); } $flow=$ledger->flow($enter('read'),$g['local_source_id']);$check($flow['journal']->id===$http['journal_id'],'Original source flow excludes second journal'); }finally{DB::rollBack();} $check($financialFingerprint()===$before&&DB::table('gl_journals')->count()===1&&DB::table('gl_events')->count()===3,'Second full effect rolled back without resetting original'); file_put_contents($output,json_encode(['passed'=>true,'checks'=>$checks,'two_independent_effects_tested'=>true,'all_evidence_kinds_scoped'=>true,'empty_page_tested'=>true,'second_effect_rolled_back'=>true],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo "Focused evidence isolated across two complete effects: $checks checks.\n";