16 lines
1.8 KiB
PHP
16 lines
1.8 KiB
PHP
<?php
|
|
ini_set('zend.exception_ignore_args','1');
|
|
require __DIR__.'/boot-QA.php';
|
|
Illuminate\Support\Facades\Auth::setUser(App\Models\User::findOrFail(24));
|
|
request()->setUserResolver(fn () => App\Models\User::findOrFail(24));
|
|
$o=App\Models\Opportunity::findOrFail(16);if($o->status!=='draft')throw new RuntimeException('Existing isolated draft required');
|
|
$contract=app(App\Services\OpportunityCanonicalContract::class);
|
|
try{$snapshot=$contract->validateSubmission($o);$contract->validatePublication($snapshot);}catch(Illuminate\Validation\ValidationException $e){echo json_encode(['validation_errors'=>$e->errors()],JSON_UNESCAPED_UNICODE);exit(1);}
|
|
$ctx=$o->workflow_context??[];$ctx['submission']=$snapshot;$gates=[];
|
|
foreach($contract->gates($o)as$gate)$gates[$gate]=['decision'=>'approved','hash'=>$snapshot['hash'],'actor_id'=>24,'at'=>now()->toIso8601String(),'reason'=>'Synthetic QA precondition, not a replay or acceptance of approval workflow.'];
|
|
$ctx['approval']=['hash'=>$snapshot['hash'],'actor_id'=>24,'gates'=>$gates,'at'=>now()->toIso8601String()];$ctx['working_state']='approved';
|
|
$ctx['economic_reference_QA_fixture']=['scope'=>'Publication preconditions only in isolated clone; reviews/approval are fixtures, not observed workflow decisions.','original_status'=>'draft'];
|
|
$o->workflow_context=$ctx;$o->save();
|
|
file_put_contents(__DIR__.'/CANONICAL-PUBLICATION-PRECONDITIONS.json',json_encode(['id'=>16,'scope'=>'Synthetic approval preconditions; only classification confirmation and explicit publisher action are observed in this increment.','snapshot_hash'=>$snapshot['hash'],'gates'=>array_keys($gates),'active_changes'=>0],JSON_PRETTY_PRINT));
|
|
echo json_encode(['synthetic_preconditions_ready'=>true,'hash'=>$snapshot['hash'],'etag'=>app(App\Services\OpportunityManagement::class)->etag($o)]);
|