bootstrap($app); (new Illuminate\Foundation\Bootstrap\LoadConfiguration)->bootstrap($app); $c = config('database.connections.'.config('database.default')); if ($c['driver'] !== 'pgsql' || (int)$c['port'] !== 55441 || $c['database'] !== 'onboarding_internal_20261011_191450_test' || !empty($c['url']) || !in_array($c['host'], ['127.0.0.1','localhost'], true)) throw new RuntimeException('QA target refused'); $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); if ((int)Illuminate\Support\Facades\DB::selectOne('SELECT inet_server_port() AS port')->port !== 55441) throw new RuntimeException('Actual server refused'); $file = $qa.'/storage/app/private/c130-http-fixture-local.json'; $mode = $argv[1] ?? 'prepare'; if ($mode === 'prepare') { if (is_file($file)) { $fixture = json_decode(file_get_contents($file), true, 512, JSON_THROW_ON_ERROR); $actor = App\Models\User::findOrFail($fixture['id']); if ($actor->email !== 'c130-governance-probe@example.invalid' || !Illuminate\Support\Facades\Hash::check($fixture['password'], $actor->password)) throw new RuntimeException('Fixture mismatch'); } else { $password = 'QA-'.bin2hex(random_bytes(24)); $actor = App\Models\User::factory()->create(['name' => 'Synthetic C130 HTTP governance probe QA', 'email' => 'c130-governance-probe@example.invalid', 'password' => $password]); app(Laravel\Fortify\Actions\EnableTwoFactorAuthentication::class)($actor); $actor->refresh(); $secret = Laravel\Fortify\Fortify::currentEncrypter()->decrypt($actor->two_factor_secret); app(Laravel\Fortify\Actions\ConfirmTwoFactorAuthentication::class)($actor, app(PragmaRX\Google2FA\Google2FA::class)->getCurrentOtp($secret)); $fixture = ['id' => $actor->id, 'email' => $actor->email, 'password' => $password]; file_put_contents($file, json_encode($fixture, JSON_THROW_ON_ERROR)); unset($secret,$password); } $actor->forceFill(['portal_access_revision' => 2])->save(); echo json_encode(['prepared' => true, 'synthetic_account_id' => $actor->id, 'target' => $c['database'].':55441', 'active_writes' => 0, 'real_user_sessions_changed' => 0]); } elseif (in_array($mode, ['otp', 'advance-revision'], true)) { $fixture = json_decode(file_get_contents($file), true, 512, JSON_THROW_ON_ERROR); $actor = App\Models\User::findOrFail($fixture['id']); if ($actor->email !== 'c130-governance-probe@example.invalid') throw new RuntimeException('Fixture identity mismatch'); if ($mode === 'otp') { // Consumed by the local test process in memory; never printed in evidence. echo app(PragmaRX\Google2FA\Google2FA::class)->getCurrentOtp(Laravel\Fortify\Fortify::currentEncrypter()->decrypt($actor->two_factor_secret)); } else { $actor->increment('portal_access_revision'); echo json_encode(['synthetic_revision_advanced' => true, 'active_writes' => 0]); } } else throw new RuntimeException('Unsupported fixture mode'); } catch (Throwable $e) { echo json_encode(['result' => 'stopped', 'type' => $e::class, 'line' => $e->getLine()]); exit(1); }