mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-25 18:16:32 +00:00
test(qa): wait for native Chromium and isolate portable migration
This commit is contained in:
1 parent
afef08c28d
commit
20ae299359
5 files changed
+84
-19
No files matched your search
@@ -24,10 +24,15 @@ jobs:
|
||||
github.event.pull_request.head.ref == 'qa/official-linux-a23868e' &&
|
||||
github.event.pull_request.draft == true
|
||||
runs-on: windows-2022
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
mode: [nsis, portable]
|
||||
timeout-minutes: 18
|
||||
env:
|
||||
QA_ROOT: '${{ github.workspace }}\.qa-win-runtime'
|
||||
QA_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
QA_MODE: ${{ matrix.mode }}
|
||||
steps:
|
||||
- name: Checkout only the authorized QA head without saved credentials
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
@@ -56,7 +61,7 @@ jobs:
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: qa-windows-9d4e90b-${{ github.event.pull_request.head.sha }}
|
||||
name: qa-windows-${{ matrix.mode }}-9d4e90b-${{ github.event.pull_request.head.sha }}
|
||||
path: '${{ env.QA_ROOT }}\evidence\'
|
||||
retention-days: 3
|
||||
if-no-files-found: warn
|
||||
@@ -9,6 +9,14 @@ does not modify the product, release packages, main, or the earlier Linux job.
|
||||
build job, artifact metadata and archive SHA-256 before extracting the one named
|
||||
NSIS installer. The Actions read token exists only in this downloader step.
|
||||
|
||||
An independent `portable` matrix job verifies the public v1.1.90 Windows ZIP
|
||||
SHA-256 `df057f03d122fb541168868d2d203c3723b8b731a663dbdaa5bc38390a742b88`
|
||||
and extracts the exact candidate Windows ZIP entry from the same verified
|
||||
official artifact. It runs the identical actual-GUI migration assertions on an
|
||||
explicit disposable profile, even if NSIS fails. ZIP extraction does not certify
|
||||
installation, overinstallation, NSIS portable launchers or automatic updates.
|
||||
The two modes use fresh independent VMs and separately named evidence artifacts.
|
||||
|
||||
The installed real v1.1.90 GUI configures a deterministic loopback-only OpenAI
|
||||
provider, saves one synthetic loopback host, and creates two distinct chats with
|
||||
two complete user/assistant turns each. Beta remains active. No localStorage,
|
||||
@@ -19,6 +27,9 @@ the exact active pointer, saved host and the IndexedDB migration marker. The
|
||||
candidate sends another normal GUI message, quits normally and restarts to
|
||||
verify the appended turn and original chats persist.
|
||||
|
||||
Both candidate snapshots must have IndexedDB `meta.activeSessionMap` directly;
|
||||
legacy localStorage is not accepted as a substitute for migration evidence.
|
||||
|
||||
Both installers use normal silent per-user NSIS arguments. The candidate version
|
||||
`0.0.0-sha-9d4e90b` is below 1.1.90, so this is **not** released automatic updater
|
||||
acceptance. A blocked replacement is recorded separately. A normal uninstall
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
"zipSha256": "3a197f7b2510e34547168b066a470e70c454610500639670e356a8a24da1e502",
|
||||
"installer": "Netcatty-0.0.0-sha-9d4e90b-win-x64.exe",
|
||||
"version": "0.0.0-sha-9d4e90b",
|
||||
"portableZip": "Netcatty-0.0.0-sha-9d4e90b-win-x64.zip",
|
||||
"portableBaseline": {
|
||||
"tag": "v1.1.90",
|
||||
"asset": 677167676,
|
||||
"installer": "Netcatty-1.1.90-win-x64.zip",
|
||||
"sha256": "df057f03d122fb541168868d2d203c3723b8b731a663dbdaa5bc38390a742b88",
|
||||
"url": "https://github.com/binaricat/Netcatty/releases/download/v1.1.90/Netcatty-1.1.90-win-x64.zip"
|
||||
},
|
||||
"baseline": {
|
||||
"tag": "v1.1.90",
|
||||
"asset": 677167660,
|
||||
|
||||
@@ -9,19 +9,20 @@ const net = require('node:net');
|
||||
const { spawn, execFileSync } = require('node:child_process');
|
||||
const { chromium } = require('playwright-core');
|
||||
const pinned = require('./candidate.json');
|
||||
const portable = process.env.QA_MODE === 'portable';
|
||||
const root = path.resolve(process.env.QA_ROOT);
|
||||
const evidence = path.join(root, 'evidence');
|
||||
const staging = path.join(root, 'unreviewed');
|
||||
const home = path.join(root, 'user');
|
||||
const profile = path.join(root, 'profile');
|
||||
const installDir = path.join(root, 'app');
|
||||
const executable = path.join(installDir, 'Netcatty.exe');
|
||||
let executable = path.join(installDir, 'Netcatty.exe');
|
||||
const hostLabel = 'QA Windows Loopback';
|
||||
const report = {
|
||||
candidate: pinned.sha, qaHead: process.env.QA_HEAD_SHA,
|
||||
candidate: pinned.sha, qaHead: process.env.QA_HEAD_SHA, mode: portable ? 'portable ZIP' : 'NSIS installed',
|
||||
baselineInstall: 'not_run', baselineGuiSeed: 'not_run', installerReplacement: 'not_run',
|
||||
candidateInstall: 'not_run', aiHistoryMigration: 'not_run', restartPersistence: 'not_run',
|
||||
scope: 'Real per-user NSIS and installed native Electron renderer on ephemeral windows-2022; CDP PNGs are actual renderer captures, not OS desktop captures. Synthetic data only.',
|
||||
scope: portable ? 'Independent official Windows ZIP extraction and real native Electron GUI migration; no installation, replacement or updater coverage. CDP PNGs are actual renderer captures. Synthetic data only.' : 'Real per-user NSIS and installed native Electron renderer on ephemeral windows-2022; CDP PNGs are actual renderer captures, not OS desktop captures. Synthetic data only.',
|
||||
updater: 'not_covered: CI candidate 0.0.0-sha version is not a released automatic updater test',
|
||||
security: 'Stock application sandbox settings; no disabling flags, privilege or system security changes',
|
||||
events: [], installers: [], launches: [],
|
||||
@@ -199,6 +200,11 @@ async function launch(label, expectedVersion) {
|
||||
return (await response.json())[0];
|
||||
}, 45000);
|
||||
inspector = new Inspector(info.webSocketDebuggerUrl); await inspector.connect();
|
||||
await until(`${label} Chromium debugger ready`, async () => {
|
||||
assert.equal(app.exitCode, null, 'Real app exited before Chromium debugger');
|
||||
const response = await fetch(`http://127.0.0.1:${port}/json/version`, { signal: AbortSignal.timeout(1000) });
|
||||
return (await response.json()).webSocketDebuggerUrl;
|
||||
}, 45000);
|
||||
browser = await chromium.connectOverCDP(`http://127.0.0.1:${port}`, { timeout: 30000 });
|
||||
browser.contexts()[0].setDefaultTimeout(12000);
|
||||
page = await until(`${label} actual app page`, () => browser.contexts()[0].pages().find(p => p.url().startsWith('app://netcatty/index.html') && !p.url().includes('settings')));
|
||||
@@ -215,7 +221,7 @@ async function launch(label, expectedVersion) {
|
||||
assert.equal(native.packaged, true);
|
||||
assert.equal(path.resolve(native.profile).toLowerCase(), profile.toLowerCase());
|
||||
assert.equal(path.resolve(native.executable).toLowerCase(), executable.toLowerCase());
|
||||
assert(native.appPath.toLowerCase().startsWith(installDir.toLowerCase()));
|
||||
assert(native.appPath.toLowerCase().startsWith(path.dirname(executable).toLowerCase()));
|
||||
assert.equal(native.noSandbox, false); assert.equal(native.disableSetuidSandbox, false);
|
||||
report.launches.push({ label, ...native }); event(`launched ${label}`, { version: native.version, origin: native.origin });
|
||||
await screenshot(`launch-${label}`);
|
||||
@@ -316,7 +322,10 @@ async function assertChats(baseline, current, afterAppend = false) {
|
||||
assert.equal(messages(b).length, afterAppend ? 6 : 4);
|
||||
if (afterAppend) assert.deepEqual(messages(b).slice(-2).map(m => [m.role, m.content]), [['user', 'QA_BETA_AFTER_UPGRADE'], ['assistant', 'QA_BETA_REPLY_AFTER_UPGRADE']]);
|
||||
assert(current.hosts.some(h => h.id === baseline.hosts.find(h => h.label === hostLabel).id && h.label === hostLabel));
|
||||
const active = current.idb?.meta.find(m => m.key === 'activeSessionMap')?.value || current.activeMap;
|
||||
assert(current.idb, 'Candidate must use the real AI IndexedDB');
|
||||
assert(current.idb.meta.some(m => m.key === 'migrationCompleted' && m.value?.migrationCompleted === true));
|
||||
const active = current.idb.meta.find(m => m.key === 'activeSessionMap')?.value;
|
||||
assert(active && typeof active === 'object', 'IndexedDB meta.activeSessionMap must exist directly; no legacy fallback');
|
||||
assert(Object.values(active || {}).includes(b.id), 'Active conversation Beta must persist');
|
||||
const activeKey = Object.keys(baseline.activeMap || {}).find(key => baseline.activeMap[key] === oldB.id);
|
||||
assert(activeKey, 'Baseline has an explicit active Beta pointer');
|
||||
@@ -334,7 +343,14 @@ async function main() {
|
||||
event('Windows process preflight passed');
|
||||
watchdog = setTimeout(() => { report.error = 'Harness global timeout'; finish().finally(() => process.exit(1)); }, 11 * 60 * 1000);
|
||||
fixture = await startModel();
|
||||
assert(await install(path.join(root, pinned.baseline.installer), 'baseline v1.1.90'), 'Baseline NSIS failed'); report.baselineInstall = 'passed';
|
||||
if (portable) {
|
||||
executable = path.join(root, 'baseline-portable', 'Netcatty.exe');
|
||||
report.baselineInstall = 'not_covered: official ZIP extraction';
|
||||
report.installerReplacement = 'not_covered: separate portable migration job';
|
||||
report.candidateInstall = 'not_covered: official ZIP extraction';
|
||||
} else {
|
||||
assert(await install(path.join(root, pinned.baseline.installer), 'baseline v1.1.90'), 'Baseline NSIS failed'); report.baselineInstall = 'passed';
|
||||
}
|
||||
await launch('baseline', '1.1.90');
|
||||
await configureProvider(); await saveHost();
|
||||
let panel = await aiPanel();
|
||||
@@ -349,6 +365,8 @@ async function main() {
|
||||
assert.equal(messages(sessionWith(baseline, 'QA_BETA_USER_ONE')).length, 4);
|
||||
fs.writeFileSync(path.join(evidence, 'baseline-storage.json'), JSON.stringify(baseline, null, 2));
|
||||
report.baselineGuiSeed = 'passed'; await quit();
|
||||
if (portable) executable = path.join(root, 'candidate-portable', 'Netcatty.exe');
|
||||
else {
|
||||
const replaced = await install(path.join(root, pinned.installer), 'candidate replacement');
|
||||
if (!replaced) {
|
||||
report.installerReplacement = 'blocked_or_failed: see installer exit/output; CI version is older than 1.1.90';
|
||||
@@ -360,6 +378,7 @@ async function main() {
|
||||
assert(await install(path.join(root, pinned.installer), 'candidate fresh install preserving QA profile'), 'Candidate fresh NSIS failed');
|
||||
report.candidateInstall = 'passed: fresh install after normal baseline uninstall; migration uses original profile';
|
||||
} else { report.installerReplacement = 'passed: normal per-user NSIS replacement'; report.candidateInstall = 'passed'; }
|
||||
}
|
||||
await launch('candidate-after-install', pinned.version);
|
||||
panel = await aiPanel(true);
|
||||
await panel.getByText('QA_BETA_REPLY_TWO', { exact: true }).waitFor({ timeout: 30000 });
|
||||
@@ -395,6 +414,7 @@ async function finish() {
|
||||
try { fs.writeFileSync(path.join(evidence, `failure-${index}-visible-ui.txt`), await target.locator('body').innerText({ timeout: 3000 })); } catch {}
|
||||
}
|
||||
}
|
||||
if (report.error && app && !browser) report.nativeFailureDiagnostic = installerDiagnostic('application-launch-failure', app.pid);
|
||||
try { await quit(); } catch (error) { report.cleanupError = error.message; app?.kill(); }
|
||||
if (fixture) { fixture.server.closeAllConnections(); fixture.server.close(); report.modelCalls = fixture.calls; }
|
||||
const stderr = logs.join('\n');
|
||||
@@ -403,6 +423,7 @@ async function finish() {
|
||||
report.evidenceReview = secretPattern.test(stderr) ? 'failed: raw app logs and PNGs withheld' : 'passed: app logs checked for credential patterns; only known synthetic GUI data';
|
||||
if (!secretPattern.test(stderr)) {
|
||||
fs.writeFileSync(path.join(evidence, 'app-output.log'), stderr);
|
||||
console.log('Reviewed actual application output:\n' + stderr);
|
||||
for (const file of fs.readdirSync(staging)) fs.copyFileSync(path.join(staging, file), path.join(evidence, file));
|
||||
} else { report.error ||= 'Evidence sensitive-data review failed'; process.exitCode = 1; }
|
||||
fs.writeFileSync(path.join(evidence, 'assertions.json'), JSON.stringify(report, null, 2));
|
||||
|
||||
@@ -7,6 +7,9 @@ const { Readable } = require('node:stream');
|
||||
const { pipeline } = require('node:stream/promises');
|
||||
const { execFileSync } = require('node:child_process');
|
||||
const pinned = require('./candidate.json');
|
||||
const portable = process.env.QA_MODE === 'portable';
|
||||
const baseline = portable ? pinned.portableBaseline : pinned.baseline;
|
||||
const entry = portable ? pinned.portableZip : pinned.installer;
|
||||
const root = path.resolve(process.env.QA_ROOT);
|
||||
const evidence = path.join(root, 'evidence');
|
||||
const digest = async file => {
|
||||
@@ -46,13 +49,13 @@ async function main() {
|
||||
assert.equal(artifact.workflow_run.head_sha, pinned.sha);
|
||||
assert.equal(artifact.workflow_run.head_repository_id, pinned.repositoryId);
|
||||
assert.equal(artifact.digest, `sha256:${pinned.zipSha256}`);
|
||||
const release = await api(`/releases/tags/${pinned.baseline.tag}`);
|
||||
const asset = release.assets.find(item => item.id === pinned.baseline.asset);
|
||||
assert.equal(asset?.name, pinned.baseline.installer);
|
||||
assert.equal(asset.digest, `sha256:${pinned.baseline.sha256}`);
|
||||
assert.equal(asset.browser_download_url, pinned.baseline.url);
|
||||
await download(await fetch(pinned.baseline.url, { signal: AbortSignal.timeout(120000) }), path.join(root, pinned.baseline.installer));
|
||||
assert.equal(await digest(path.join(root, pinned.baseline.installer)), pinned.baseline.sha256);
|
||||
const release = await api(`/releases/tags/${baseline.tag}`);
|
||||
const asset = release.assets.find(item => item.id === baseline.asset);
|
||||
assert.equal(asset?.name, baseline.installer);
|
||||
assert.equal(asset.digest, `sha256:${baseline.sha256}`);
|
||||
assert.equal(asset.browser_download_url, baseline.url);
|
||||
await download(await fetch(baseline.url, { signal: AbortSignal.timeout(120000) }), path.join(root, baseline.installer));
|
||||
assert.equal(await digest(path.join(root, baseline.installer)), baseline.sha256);
|
||||
const response = await fetch(`${base}/actions/artifacts/${pinned.artifact}/zip`, { headers, redirect: 'manual', signal: AbortSignal.timeout(30000) });
|
||||
assert.equal(response.status, 302);
|
||||
const location = new URL(response.headers.get('location'));
|
||||
@@ -69,13 +72,30 @@ async function main() {
|
||||
[IO.Compression.ZipFileExtensions]::ExtractToFile($entries[0], $env:QA_OUTPUT, $false)
|
||||
} finally { $z.Dispose() }`;
|
||||
execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', extract], {
|
||||
env: { ...process.env, GH_TOKEN: '', QA_ZIP: zip, QA_INSTALLER: pinned.installer, QA_OUTPUT: path.join(root, pinned.installer) }, timeout: 30000,
|
||||
env: { ...process.env, GH_TOKEN: '', QA_ZIP: zip, QA_INSTALLER: entry, QA_OUTPUT: path.join(root, entry) }, timeout: 30000,
|
||||
});
|
||||
if (portable) {
|
||||
const unpack = `Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
$destination = [IO.Path]::GetFullPath($env:QA_DEST) + [IO.Path]::DirectorySeparatorChar
|
||||
$z = [IO.Compression.ZipFile]::OpenRead($env:QA_ARCHIVE)
|
||||
try { foreach ($e in $z.Entries) {
|
||||
$target = [IO.Path]::GetFullPath([IO.Path]::Combine($destination,$e.FullName))
|
||||
if (-not $target.StartsWith($destination,[StringComparison]::OrdinalIgnoreCase)) { throw 'ZIP path outside isolated root' }
|
||||
if ($e.Name -eq '') { [void][IO.Directory]::CreateDirectory($target) }
|
||||
else { [void][IO.Directory]::CreateDirectory([IO.Path]::GetDirectoryName($target)); [IO.Compression.ZipFileExtensions]::ExtractToFile($e,$target,$false) }
|
||||
}} finally { $z.Dispose() }`;
|
||||
for (const [archive, dest] of [[baseline.installer, 'baseline-portable'], [entry, 'candidate-portable']]) {
|
||||
execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', unpack], { env: { ...process.env, GH_TOKEN: '', QA_ARCHIVE: path.join(root, archive), QA_DEST: path.join(root, dest) }, timeout: 60000 });
|
||||
assert(fs.existsSync(path.join(root, dest, 'Netcatty.exe')));
|
||||
}
|
||||
}
|
||||
const provenance = {
|
||||
...pinned, officialWindowsJob: job.id, verifiedAt: new Date().toISOString(),
|
||||
candidateInstallerSha256: await digest(path.join(root, pinned.installer)),
|
||||
candidateInstallerDigestSource: 'Computed from exact entry in verified official artifact ZIP',
|
||||
baselineMode: 'Public released NSIS installer', candidateMode: 'Official CI NSIS installer; prerelease version, not released updater acceptance',
|
||||
...pinned, mode: process.env.QA_MODE || 'nsis', testedBaseline: baseline,
|
||||
officialWindowsJob: job.id, verifiedAt: new Date().toISOString(),
|
||||
candidateEntry: entry, candidateEntrySha256: await digest(path.join(root, entry)),
|
||||
candidateEntryDigestSource: 'Computed from exact entry in verified official artifact ZIP',
|
||||
baselineMode: portable ? 'Public released Windows ZIP, extraction only' : 'Public released NSIS installer',
|
||||
candidateMode: portable ? 'Official CI Windows ZIP, extraction only; no installer/updater coverage' : 'Official CI NSIS installer; prerelease version, not released updater acceptance',
|
||||
};
|
||||
fs.writeFileSync(path.join(evidence, 'provenance.json'), JSON.stringify(provenance, null, 2));
|
||||
console.log(JSON.stringify(provenance, null, 2));
|
||||
|
||||
Reference in new issue
Block a user