From 197c00a2f0047490fd86591e2d9474469e4438da Mon Sep 17 00:00:00 2001 From: binaricat <16399091+binaricat@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:02:33 +0000 Subject: [PATCH] test(qa): preserve normal macOS home for native launch control --- scripts/qa-official-macos/README.md | 3 ++- scripts/qa-official-macos/desktop.cjs | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/qa-official-macos/README.md b/scripts/qa-official-macos/README.md index 2916651ff..6076ce7d8 100644 --- a/scripts/qa-official-macos/README.md +++ b/scripts/qa-official-macos/README.md @@ -16,7 +16,8 @@ presented as APP notarization. No OS/security/xattr/quarantine/privacy settings are modified; an assessment preventing launch stops the GUI step. The unmodified installed app executable launches its real native GUI with a -fresh synthetic profile and an allowlisted process environment. Actual app +fresh synthetic profile and an allowlisted process environment retaining the +ephemeral VM's standard HOME/TMPDIR for ordinary macOS services. Actual app version/path/origin/profile/architecture and stock web preferences are recorded. Renderer automation and screenshots use loopback CDP/native capture, without accessibility or screen-recording permission grants. No browser/UI fixture or diff --git a/scripts/qa-official-macos/desktop.cjs b/scripts/qa-official-macos/desktop.cjs index a3b1037ab..8785a2c96 100644 --- a/scripts/qa-official-macos/desktop.cjs +++ b/scripts/qa-official-macos/desktop.cjs @@ -32,9 +32,11 @@ async function until(label, check, timeout = 20000) { async function freePort() { const s = net.createServer(); await new Promise(r => s.listen(0, '127.0.0.1', r)); const p = s.address().port; await new Promise(r => s.close(r)); return p; } function environment() { const env = {}; - for (const key of ['PATH', 'USER', 'LOGNAME', 'SHELL', '__CF_USER_TEXT_ENCODING', 'XPC_FLAGS', 'XPC_SERVICE_NAME', 'COMMAND_MODE']) if (process.env[key]) env[key] = process.env[key]; - Object.assign(env, { HOME: path.join(root, 'home'), TMPDIR: path.join(root, 'tmp') + '/', LANG: 'en_US.UTF-8', LC_ALL: 'en_US.UTF-8' }); - fs.mkdirSync(env.HOME, { recursive: true }); fs.mkdirSync(env.TMPDIR, { recursive: true }); + for (const key of ['PATH', 'HOME', 'TMPDIR', 'USER', 'LOGNAME', 'SHELL', '__CF_USER_TEXT_ENCODING', 'XPC_FLAGS', 'XPC_SERVICE_NAME', 'COMMAND_MODE']) if (process.env[key]) env[key] = process.env[key]; + Object.assign(env, { LANG: 'en_US.UTF-8', LC_ALL: 'en_US.UTF-8' }); + // Preserve the ephemeral VM's normal OS home/bootstrap and temporary paths. + // Only app userData is isolated; never substitute/disable the OS keychain. + report.environment = { home: env.HOME, tmpdir: env.TMPDIR, isolatedAppProfile: profile, inheritedKeys: Object.keys(env) }; return env; } class Inspector { @@ -123,6 +125,7 @@ async function launch() { return (await (await fetch(`http://127.0.0.1:${inspectPort}/json/list`, { signal: AbortSignal.timeout(1000) })).json())[0]; }, 45000); inspector = new Inspector(target.webSocketDebuggerUrl); await inspector.connect(); + report.nativeInspectorPreflight = await inspector.eval('({pid:process.pid, platform:process.platform, arch:process.arch})'); stage('native inspector connected; await real GUI'); await until('actual native renderer DOM ready', () => inspector.eval(async () => { const e = process.mainModule.require('electron'), w = e.BrowserWindow.getAllWindows().find(w => w.webContents.getURL().startsWith('app://netcatty/index.html'));