// Public active runtime inspection. No credentials, no POST and no authentication bypass. const fs = require('node:fs'), path = require('node:path'), crypto = require('node:crypto'); const { chromium } = require('C:/Users/macbook/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright'); const ROOT = path.resolve(__dirname, '..'), DIR = path.join(ROOT, 'storage/app/private/investmoz-v2/portal-audit'); const expected = JSON.parse(fs.readFileSync(path.join(ROOT, 'outputs/investmoz-country02-candidate-20261011/manifesto-candidata.json'))); (async () => { const browser = await chromium.launch({headless:true, executablePath:'C:/Users/macbook/AppData/Local/ms-playwright/chromium-1243/chrome-win64/chrome.exe'}); const context = await browser.newContext({viewport:{width:1280,height:900}}), page = await context.newPage(); const events = [], errors = [], assetChecks = {}, pending = []; page.on('pageerror', e => errors.push(e.message)); page.on('response', r => { const u = new URL(r.url()); if (u.origin !== 'http://portal-investidor.test') return; if (r.request().isNavigationRequest()) events.push({method:r.request().method(), path:u.pathname,status:r.status()}); if (u.pathname.startsWith('/build/')) pending.push((async()=>{ const relative = decodeURIComponent(u.pathname.slice('/build/'.length)); const expectedHash = expected.production.files[relative]; const bytes = await r.body(); assetChecks[relative] = {status:r.status(),matches:!!expectedHash && crypto.createHash('sha256').update(bytes).digest('hex')===expectedHash}; })().catch(()=>{assetChecks[u.pathname]={unavailable:true};})); }); await page.goto('http://portal-investidor.test/management/opportunity-resources-install/organization-country',{waitUntil:'networkidle'}); const runtime = await page.evaluate(()=>({origin:location.origin, path:location.pathname, secureContext:window.isSecureContext, randomUUID:typeof crypto.randomUUID, getRandomValues:typeof crypto.getRandomValues, formLabels:[...document.querySelectorAll('label')].map(l=>l.textContent.trim())})); const buildManifest = JSON.parse(fs.readFileSync(path.join(ROOT,'public/build/manifest.json'))); const entry = '/build/'+buildManifest['resources/js/pages/management/opportunity-install.tsx'].file; const constructorCheck = await page.evaluate(async entry=>{ // Pure component initialization; sample props, not an authenticated server preview. // Argument evaluation throws before useForm or Management runs; no submit/cookies inspected. const module = await import(entry); try { module.default({installed:false,ready:true,target:{database:'investemoz',port:5432},hash:'0'.repeat(64),changes:[],migration:'2026_10_10_050000_extend_organization_country',backupDate:null,rollback:'',extension:true}); return {failed:false}; } catch(e) { return {failed:true,name:e.name,message:e.message}; } },entry); await Promise.all(pending); const result = {at:new Date().toISOString(), origin:'http://portal-investidor.test', code_hash:expected.code_hash, production_manifest_sha256:expected.production.manifest_sha256, authenticated:false, public_runtime:runtime, installer_constructor:constructorCheck, component_probe:'Compiled component initialization with sample props; not an authenticated preview or access bypass.', navigation:events, javascript_errors:errors, assets:assetChecks, methods:'GET only; normal guest session, no account mutation, no POST', authenticated_preview_obtained:false, installer_applied:false, country_flag_enabled:false}; fs.writeFileSync(path.join(DIR,'country-active-public-runtime-20261011.json'),JSON.stringify(result,null,2)); console.log(JSON.stringify(result)); await context.close(); await browser.close(); })().catch(()=>{console.error('Public runtime inspection failed; no POST issued.');process.exitCode=1;});