make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();$queries=0;DB::listen(function()use(&$queries){$queries++;});$checks=[]; $nav=new App\Modules\Purchasing\WorkspaceNavigation; config(['receipt_qa.enabled'=>false]);if($nav->links()!==[])throw new RuntimeException('Disabled links');$checks[]='disabled composition exposes no navigation'; try{$nav->screen(new Illuminate\Http\Request,new App\Modules\Purchasing\ReceiptRuntime);throw new RuntimeException('Disabled hub accepted');}catch(Symfony\Component\HttpKernel\Exception\HttpException $e){if($e->getStatusCode()!==404)throw $e;}$checks[]='disabled hub returns404 before any database read'; config(['receipt_qa.enabled'=>true]);$app->instance('env','production');if($nav->links()!==[])throw new RuntimeException('Production links');$checks[]='production cannot discover synthetic navigation'; try{$nav->screen(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 hub refuses without SQL'; if($queries!==0||App\Shared\Context\ModuleNavigation::owner('purchasing/workspace')!=='purchasing')throw new RuntimeException('Guard isolation');$checks[]='hub belongs to purchasing and guard probes issue zero SQL'; file_put_contents($out,json_encode(['passed'=>true,'checks'=>$checks,'database_queries'=>$queries],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo count($checks)." navigation guard checks passed.\n";