exec($sql); } $source = new WarehouseHttpSource('http://127.0.0.1:8005', $input['tenant_id'], fn () => $input['cookie'], allowLoopbackHttp: true); $inbox = new WarehouseInbox($db, 'synthetic-qa-8005', $input['tenant_id'], 99, 'disposable-evaluation'); $result = (new WarehousePull($inbox))->run($source, maxPages: 1, pageSize: 1); $checkpoint = $inbox->checkpoint(); $next = $source($checkpoint['cursor'], 1); if ($next['schema'] !== 'sgc.warehouse.fulfilment-feed.v1') { throw new RuntimeException('Contrato de avaliação inesperado.'); } $anonymousDenied = false; try { $anonymous = new WarehouseHttpSource('http://127.0.0.1:8005', $input['tenant_id'], fn () => 'SGC_TEST_SESSION=not-authenticated', allowLoopbackHttp: true); $anonymous(null, 1); } catch (WarehouseTransportFailure $e) { $anonymousDenied = $e->category === 'authentication'; } if (! $anonymousDenied) { throw new RuntimeException('Acesso anónimo não recusado como esperado.'); } echo json_encode(['result' => 'passed', 'transport' => 'native PHP cURL to existing QA session', 'pages' => $result['pages'], 'received_facts' => $result['inserted'], 'receiver_checkpoint_version' => $checkpoint['version'], 'cursor_roundtrip' => true, 'unauthenticated_read_denied' => true, 'receiver' => 'disposable SQLite memory', 'persistent_business_commands' => false, 'persistent_accounts_or_grants_changed' => false, 'sgf_installation_changed' => false], JSON_THROW_ON_ERROR); } catch (Throwable) { fwrite(STDERR, 'A avaliação HTTP do conector não foi aprovada. Nenhuma credencial é apresentada.'.PHP_EOL); exit(1); }