'pilot-readonly', 'APP_DEBUG' => 'false', 'DB_CONNECTION' => 'pgsql', 'DB_URL' => '', 'PGOPTIONS' => '-c default_transaction_read_only=on', 'CACHE_STORE' => 'array', 'SESSION_DRIVER' => 'array', 'QUEUE_CONNECTION' => 'null', 'MAIL_MAILER' => 'array', 'LOG_CHANNEL' => 'stderr', 'COMPRAS_ORDER_CANCELLATION_ENABLED' => 'true', 'COMPRAS_ORDER_CANCELLATION_ROOT' => $installed ? $plan['target_root'] : $root.'/'.$plan['candidate_root'], 'APP_CONFIG_CACHE' => $root.'/storage/framework/absent-cancellation-readonly-config.php']; foreach ($environment as $key => $value) { putenv($key.'='.$value); $_ENV[$key] = $_SERVER[$key] = $value; } $app = require $root.'/bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); if (DB::selectOne('SHOW default_transaction_read_only')->default_transaction_read_only !== 'on') { throw new LogicException('Enforced read-only database required.'); } app(OrderCancellationRuntime::class)->assertReady(); app(OrderCancellationRuntime::class)->load(0); // Byte-checked class loading only, no reversal command. if (! hash_equals(hash('sha256', $before), hash_file('sha256', $sourcePath))) { throw new LogicException('Concurrent cancellation configuration edit.'); } $result = ['date' => gmdate('c'), 'state' => 'passed', 'installed' => $installed, 'database_enforced_read_only' => true, 'manifest_sha256' => OrderCancellationRuntime::MANIFEST_SHA256, 'existing_cancellation_records' => DB::table('order_cancellations')->count(), 'existing_approved_policies' => DB::table('order_cancellation_policies')->where('status', 'approved')->count(), 'new_policies_grants_business_commands_or_settings_changes' => false]; file_put_contents($root.'/docs/proofs/order-cancellation-pilot-'.($installed ? 'postcheck' : 'preflight').'.json', json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR).PHP_EOL); echo json_encode($result, JSON_THROW_ON_ERROR).PHP_EOL;