const fs=require('node:fs'),path=require('node:path'),assert=require('node:assert/strict'); 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 plan=JSON.parse(fs.readFileSync(path.join(DIR,'portal-stability-latest.json'))); (async()=>{const browser=await chromium.launch({headless:true,executablePath:'C:/Users/macbook/AppData/Local/ms-playwright/chromium-1243/chrome-win64/chrome.exe',args:['--host-resolver-rules=MAP portal-investidor.test 127.0.0.1','--no-proxy-server']}); const proof={at:new Date().toISOString(),active_writes:0,checks:[],errors:[]}; try{for(const e of [plan.qa_environment,plan.consumer_environment]){const context=await browser.newContext({ignoreHTTPSErrors:false});const page=await context.newPage(); const r=await page.goto(e.base+'/_qa/runtime');assert.equal(r.status(),200);const data=JSON.parse(await page.locator('body').innerText()); assert.deepEqual(data.target,{database:e.target.database,port:'55441'});assert.equal(data.php,'8.5.11');assert.equal(data.sapi,'apache2handler'); for(const ext of ['curl','openssl','pdo_pgsql','pgsql','mbstring','fileinfo','gd','intl','zip'])assert(data.extensions.includes(ext),ext); assert(data.curl);assert.equal(data.session.driver,'database');assert(data.session.secure);assert.equal(data.cipher,'AES-256-CBC'); assert(await page.evaluate(()=>isSecureContext&&typeof crypto.subtle==='object')); proof.checks.push({origin:e.base,runtime:data,certificate_without_bypass:true,tls:await r.securityDetails()});await context.close();} proof.result='passed';}catch(e){proof.result='failed';proof.failure=e.message.split('\nCall log:')[0];process.exitCode=1;}finally{fs.writeFileSync(path.join(DIR,'portal-stability-runtime-probe.json'),JSON.stringify(proof,null,2));await browser.close();console.log(JSON.stringify(proof));}})();