make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();$queries=0;DB::listen(function()use(&$queries){$queries++;});$checks=[]; config(['receipt_qa.sourcing_enabled'=>false]);try{(new App\Modules\Purchasing\SourcingController)->suppliers(1,new Illuminate\Http\Request,new App\Modules\Purchasing\ReceiptRuntime);throw new RuntimeException('Disabled lookup accepted');}catch(Symfony\Component\HttpKernel\Exception\HttpException $e){if($e->getStatusCode()!==404)throw $e;}$checks[]='disabled supplier lookup refuses before SQL'; config(['receipt_qa.sourcing_enabled'=>true]);$app->instance('env','production');try{(new App\Modules\Purchasing\SourcingController)->suppliers(1,new Illuminate\Http\Request,new App\Modules\Purchasing\ReceiptRuntime);throw new RuntimeException('Production accepted');}catch(Symfony\Component\HttpKernel\Exception\HttpException $e){if($e->getStatusCode()!==403)throw $e;}$checks[]='production refuses synthetic selector before SQL'; if($queries!==0||App\Shared\Context\ModuleNavigation::owner('api/purchasing-sourcing/requests/1/suppliers')!=='purchasing')throw new RuntimeException('Guard boundary');$checks[]='lookup belongs to purchasing and guard probes issue zero SQL';file_put_contents($out,json_encode(['passed'=>true,'checks'=>$checks,'database_queries'=>0],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo count($checks)." supplier lookup guards passed.\n";