test(qa): package exact active-pointer fix and verify real Windows restart

This commit is contained in:
binaricat committed 2026-11-22 01:28:37 +00:00
1 parent 73473986a0
commit dfb3e2a3a1
6 files changed
+253 -2

No files matched your search

+98
View File
@@ -65,3 +65,101 @@ jobs:
path: '${{ env.QA_ROOT }}\evidence\'
retention-days: 3
if-no-files-found: warn
fixed-windows-package:
name: Build exact 4516d3a Windows QA NSIS (unsigned, never publish)
if: >-
github.repository == 'binaricat/Netcatty' &&
github.event.pull_request.head.repo.full_name == 'binaricat/Netcatty' &&
github.event.pull_request.head.ref == 'qa/official-linux-a23868e' &&
github.event.pull_request.draft == true
runs-on: windows-2022
timeout-minutes: 35
env:
QA_FIX_SOURCE: '${{ github.workspace }}\fixed-source'
QA_BUILD_OUTPUT: '${{ github.workspace }}\qa-fixed-package'
QA_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
outputs:
installer_sha: ${{ steps.build.outputs.installer_sha }}
artifact_id: ${{ steps.package.outputs.artifact-id }}
artifact_digest: ${{ steps.package.outputs.artifact-digest }}
steps:
- name: Checkout authorized QA harness without saved credentials
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Separate exact trusted same-repository fix checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: binaricat/Netcatty
ref: 4516d3aed7cb54862dabd53abb56a7f90fba3212
path: fixed-source
persist-credentials: false
- name: Node 22 for repository Windows packaging conventions
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22.21.1'
- name: Build real NSIS with stock MSVC and existing pack:win-x64
id: build
run: node scripts/qa-official-windows/build-fixed.cjs
- name: Retain exact QA installer, build provenance and reviewed logs (3 days)
id: package
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: qa-fixed-windows-4516d3a-${{ github.run_id }}
path: '${{ env.QA_BUILD_OUTPUT }}\'
retention-days: 3
if-no-files-found: warn
fixed-installed-windows-history:
name: Test real installed exact 4516d3a fix and positive pointer restart
needs: fixed-windows-package
if: >-
github.repository == 'binaricat/Netcatty' &&
github.event.pull_request.head.repo.full_name == 'binaricat/Netcatty' &&
github.event.pull_request.head.ref == 'qa/official-linux-a23868e' &&
github.event.pull_request.draft == true
runs-on: windows-2022
timeout-minutes: 15
env:
QA_ROOT: '${{ github.workspace }}\.qa-fixed-win-runtime'
QA_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
QA_MODE: nsis
QA_CANDIDATE: fixed-candidate.json
QA_FIXED_ARTIFACT: '${{ github.workspace }}\qa-fixed-input'
QA_EXPECTED_INSTALLER_SHA: ${{ needs.fixed-windows-package.outputs.installer_sha }}
QA_BUILD_ARTIFACT_ID: ${{ needs.fixed-windows-package.outputs.artifact_id }}
QA_BUILD_ARTIFACT_DIGEST: ${{ needs.fixed-windows-package.outputs.artifact_digest }}
steps:
- name: Checkout same QA harness without persisted credentials
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Node for actual native application harness
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '24.11.1'
- name: Retrieve only this run's exact SHA QA package
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: qa-fixed-windows-4516d3a-${{ github.run_id }}
path: '${{ env.QA_FIXED_ARTIFACT }}'
- name: Install QA dependencies without scripts or browsers
run: npm ci --prefix scripts/qa-official-windows --ignore-scripts --no-audit --no-fund
- name: Verify same-run package SHA and official v1.1.90 baseline
env:
GH_TOKEN: ${{ github.token }}
run: node scripts/qa-official-windows/provenance-fixed.cjs
- name: Real normal NSIS replacement, UI history, appended reply and strict restart
run: node scripts/qa-official-windows/desktop.cjs
- name: Retain exact fix assertions and actual native PNGs (3 days)
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: qa-fixed-nsis-history-4516d3a-${{ github.event.pull_request.head.sha }}
path: '${{ env.QA_ROOT }}\evidence\'
retention-days: 3
if-no-files-found: warn
+19
View File
@@ -17,6 +17,25 @@ 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 separate exact-fix jobs pin same-repository PR #4302 commit
`4516d3aed7cb54862dabd53abb56a7f90fba3212`, based on frozen main 9d4e90b.
If no exact standard package exists, a separate checkout on standard
windows-2022 runs the existing Node 22/MSVC/npm ci/pack:win-x64 conventions.
Only the normal non-release version metadata is set. Application source is not
patched while packaging. The build child receives a Windows environment
allowlist with no Actions credentials; signing/distribution credentials are not
supplied and publishing is disabled. The resulting NSIS is explicitly
CI QA-built, unsigned and unreleased. Its exact SHA-256, source SHA and QA run
are verified in a separate fresh desktop job before normal installation.
The fix acceptance uses the same real released v1.1.90 GUI baseline and native
NSIS/history harness. A positive candidate-created Beta pointer in IndexedDB is
a mandatory precondition before normal quit. That exact pointer must survive
complete restart before panel interaction, alongside both original chats,
saved host and new reply. Panel display intent remains memory-only: manual
history opening after restart is not claimed as automatic conversation reopen.
The old official 9d4e90b control and its original retained failure are separate.
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,
@@ -0,0 +1,77 @@
// Trusted exact-SHA source build only. No Actions credentials reach npm/build.
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const crypto = require('node:crypto');
const { spawn, execFileSync } = require('node:child_process');
const pinned = require('./fixed-candidate.json');
const source = path.resolve(process.env.QA_FIX_SOURCE);
const output = path.resolve(process.env.QA_BUILD_OUTPUT);
const report = { ...pinned, origin: 'CI QA-built from exact trusted same-repository fix; unsigned, unreleased, no automatic updater certification', run: process.env.GITHUB_RUN_ID, qaHead: process.env.QA_HEAD_SHA, node: process.version, platform: process.platform, arch: process.arch, steps: [] };
const logs = [];
function environment() {
const allowed = ['PATH', 'SystemRoot', 'SystemDrive', 'WINDIR', 'ComSpec', 'PATHEXT', 'ProgramFiles', 'ProgramFiles(x86)', 'ProgramW6432', 'CommonProgramFiles', 'CommonProgramFiles(x86)', 'CommonProgramW6432', 'ProgramData', 'ALLUSERSPROFILE', 'PUBLIC', 'OS', 'PROCESSOR_ARCHITECTURE', 'NUMBER_OF_PROCESSORS', 'USERNAME', 'USERDOMAIN', 'USERDNSDOMAIN', 'COMPUTERNAME', 'SESSIONNAME', 'PSModulePath', 'PSHOME', 'USERPROFILE', 'HOME', 'APPDATA', 'LOCALAPPDATA', 'HOMEDRIVE', 'HOMEPATH', 'TEMP', 'TMP'];
const env = {};
for (const key of allowed) if (process.env[key]) env[key] = process.env[key];
return { ...env, CI: 'true', BUNDLE_MOSH: 'false', BUNDLE_ET: 'false', ELECTRON_BUILDER_PUBLISH: 'never', CSC_IDENTITY_AUTO_DISCOVERY: 'false', NPM_CONFIG_FETCH_RETRIES: '4', NPM_CONFIG_FETCH_RETRY_FACTOR: '2', NPM_CONFIG_FETCH_RETRY_MINTIMEOUT: '1000', NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT: '10000' };
}
const safe = environment();
function git(...args) { return execFileSync('git', args, { cwd: source, env: safe, encoding: 'utf8', timeout: 30000 }).trim(); }
async function digest(file) { const hash = crypto.createHash('sha256'); for await (const part of fs.createReadStream(file)) hash.update(part); return hash.digest('hex'); }
async function main() {
assert.equal(process.platform, 'win32'); assert.equal(process.arch, 'x64');
fs.mkdirSync(output, { recursive: true });
assert.equal(git('rev-parse', 'HEAD'), pinned.sha);
assert.equal(git('config', '--get', 'remote.origin.url').replace(/\.git$/, ''), `https://github.com/${pinned.repository}`);
assert.equal(git('status', '--porcelain'), '', 'Exact source checkout must begin clean');
const originalSourceHash = await digest(path.join(source, 'application/state/useAIState.ts'));
const vswhere = path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio/Installer/vswhere.exe');
const installation = execFileSync(vswhere, ['-latest', '-products', '*', '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', '-property', 'installationPath'], { env: safe, encoding: 'utf8', timeout: 30000 }).trim();
assert(installation, 'Stock Windows hosted MSVC installation required');
const vsScript = path.join(installation, 'Common7/Tools/Launch-VsDevShell.ps1');
assert(fs.existsSync(vsScript));
const script = `$ErrorActionPreference = 'Stop'
& $env:QA_VS_SCRIPT -Arch amd64 -HostArch amd64 -SkipAutomaticLocation
if (-not $?) { throw 'MSVC developer shell failed' }
Set-Location -LiteralPath $env:QA_FIX_SOURCE
Write-Output 'QA_BUILD_STEP npm ci'
& npm.cmd ci
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Output 'QA_BUILD_STEP repository non-release version metadata'
& npm.cmd pkg set "version=$env:QA_FIX_VERSION"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Output 'QA_BUILD_STEP npm run pack:win-x64 -- publish never'
& npm.cmd run pack:win-x64
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Output 'QA_BUILD_STEP packaged SSH cipher verification'
& node scripts/test-packaged-ssh-ciphers.cjs
exit $LASTEXITCODE`;
const child = spawn('pwsh.exe', ['-NoProfile', '-NonInteractive', '-Command', script], { cwd: source, env: { ...safe, QA_FIX_SOURCE: source, QA_FIX_VERSION: pinned.version, QA_VS_SCRIPT: vsScript }, windowsHide: false, stdio: ['ignore', 'pipe', 'pipe'] });
child.on('error', error => logs.push(error.stack));
for (const stream of [child.stdout, child.stderr]) stream.on('data', part => { const text = String(part); logs.push(text); process.stdout.write(text); });
const code = await new Promise(resolve => child.once('close', resolve));
report.buildExit = code;
assert.equal(code, 0, 'Repository Windows packaging failed');
assert.equal(await digest(path.join(source, 'application/state/useAIState.ts')), originalSourceHash, 'Do not modify application source to package it');
assert.equal(git('rev-parse', 'HEAD'), pinned.sha);
const installer = path.join(source, 'release', pinned.installer);
assert(fs.existsSync(installer), 'Exact NSIS installer must be produced');
report.installerSha256 = await digest(installer);
report.installerBytes = fs.statSync(installer).size;
report.sourceFileSha256 = originalSourceHash;
report.versionMetadata = JSON.parse(fs.readFileSync(path.join(source, 'package.json'))).version;
assert.equal(report.versionMetadata, pinned.version);
fs.copyFileSync(installer, path.join(output, pinned.installer));
fs.appendFileSync(process.env.GITHUB_OUTPUT, `installer_sha=${report.installerSha256}\n`);
report.status = 'passed';
}
main().catch(error => { report.status = 'failed'; report.error = error.stack; process.exitCode = 1; }).finally(() => {
fs.mkdirSync(output, { recursive: true });
const log = logs.join('');
const sensitive = /(?:gh[opsu]_[A-Za-z0-9_]{20,}|github_pat_[A-Za-z0-9_]{20,}|-----BEGIN (?:RSA |OPENSSH )?PRIVATE KEY-----|Authorization:\s*Bearer\s+\S+)/i.test(log);
report.logReview = sensitive ? 'blocked' : 'passed: no credentials supplied to build process; output pattern scan passed';
if (!sensitive) fs.writeFileSync(path.join(output, 'build.log'), log);
else { process.exitCode = 1; fs.rmSync(path.join(output, pinned.installer), { force: true }); }
fs.writeFileSync(path.join(output, 'build-provenance.json'), JSON.stringify(report, null, 2));
console.log(JSON.stringify(report, null, 2));
});
+8 -2
View File
@@ -10,7 +10,7 @@ const vm = require('node:vm');
const crypto = require('node:crypto');
const { spawn, execFileSync } = require('node:child_process');
const { chromium } = require('playwright-core');
const pinned = require('./candidate.json');
const pinned = require(path.resolve(__dirname, process.env.QA_CANDIDATE || 'candidate.json'));
const portable = process.env.QA_MODE === 'portable';
const root = path.resolve(process.env.QA_ROOT);
const evidence = path.join(root, 'evidence');
@@ -22,6 +22,7 @@ let executable = path.join(installDir, 'Netcatty.exe');
const hostLabel = 'QA Windows Loopback';
const report = {
candidate: pinned.sha, qaHead: process.env.QA_HEAD_SHA, mode: portable ? 'portable ZIP' : 'NSIS installed',
testPackageOrigin: pinned.qaBuilt ? 'Exact trusted fix SHA, CI QA-built NSIS; unsigned/unreleased, not released automatic updater acceptance' : 'Pinned official package',
baselineInstall: 'not_run', baselineGuiSeed: 'not_run', installerReplacement: 'not_run',
candidateInstall: 'not_run', aiHistoryMigration: 'not_run', restartPersistence: 'not_run',
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.',
@@ -448,7 +449,11 @@ async function main() {
await chooseChat(panel, 'QA_BETA_USER_ONE');
report.aiHistoryMigration = `original records/full turns/scope/host PASSED; active pointer ${report.migratedChats.activePointer}`;
await send(panel, 'QA_BETA_AFTER_UPGRADE'); await screenshot('05-candidate-appended');
const beforeRestart = await snapshot();
const beforeRestart = pinned.requirePositiveCandidatePointer ? await until('patched candidate persists a positive Beta pointer before quit', async () => {
const value = await snapshot(), beta = sessionWith(value, 'QA_BETA_USER_ONE');
const map = value.idb?.meta.find(m => m.key === 'activeSessionMap')?.value;
return beta && map?.[`${beta.scope.type}:${beta.scope.targetId ?? ''}`] === beta.id && value;
}, 5000) : await snapshot();
fs.writeFileSync(path.join(evidence, 'candidate-before-quit-storage.json'), JSON.stringify(beforeRestart, null, 2));
report.beforeRestartPointer = { idbMap: beforeRestart.idb?.meta.find(m => m.key === 'activeSessionMap')?.value, legacyMap: beforeRestart.activeMap };
await quit(); await launch('candidate-restarted', pinned.version);
@@ -466,6 +471,7 @@ async function main() {
await panel.getByText('QA_BETA_REPLY_AFTER_UPGRADE', { exact: true }).waitFor();
await screenshot('06-candidate-restarted');
report.restartPersistence = `original and appended turns/scope/host PASSED; active pointer ${report.restartedChats.activePointer}`;
report.targetedCandidateRestartRegression = report.restartedChats.activePointer === 'passed' ? 'passed: positive candidate-created IDB Beta pointer and full new/original contents survived complete restart' : 'failed or untested: read activePointerChecks';
report.overall = report.validationFailures?.length ? 'failed: read individual validation failures' : report.coverageGaps?.length ? 'partial: independent data assertions passed; positive legacy pointer not available' : 'passed';
await quit(); event('Windows installed real GUI acceptance completed');
}
@@ -0,0 +1,18 @@
{
"repository": "binaricat/Netcatty",
"repositoryId": 1111357457,
"sha": "4516d3aed7cb54862dabd53abb56a7f90fba3212",
"base": "9d4e90b3aa8fe0a52d1a58e8ea8e61bdd3865e28",
"sourcePr": 4302,
"qaBuilt": true,
"requirePositiveCandidatePointer": true,
"version": "0.0.0-sha-4516d3a",
"installer": "Netcatty-0.0.0-sha-4516d3a-win-x64.exe",
"baseline": {
"tag": "v1.1.90",
"asset": 677167660,
"installer": "Netcatty-1.1.90-win-x64.exe",
"sha256": "cf6a028a0286264fd1e315025b1f78e8c96c468d6a22d5058b64319410debdc9",
"url": "https://github.com/binaricat/Netcatty/releases/download/v1.1.90/Netcatty-1.1.90-win-x64.exe"
}
}
@@ -0,0 +1,33 @@
// Token is scoped to public release metadata/download in this step only.
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const crypto = require('node:crypto');
const { Readable } = require('node:stream');
const { pipeline } = require('node:stream/promises');
const pinned = require('./fixed-candidate.json');
const root = path.resolve(process.env.QA_ROOT);
const artifact = path.resolve(process.env.QA_FIXED_ARTIFACT);
async function digest(file) { const hash = crypto.createHash('sha256'); for await (const part of fs.createReadStream(file)) hash.update(part); return hash.digest('hex'); }
async function main() {
fs.mkdirSync(path.join(root, 'evidence'), { recursive: true });
const build = JSON.parse(fs.readFileSync(path.join(artifact, 'build-provenance.json')));
assert.equal(build.repository, pinned.repository); assert.equal(build.sha, pinned.sha);
assert.equal(build.status, 'passed'); assert.equal(build.logReview.startsWith('passed'), true);
assert.equal(build.run, process.env.GITHUB_RUN_ID); assert.equal(build.qaHead, process.env.QA_HEAD_SHA);
assert.equal(build.versionMetadata, pinned.version);
assert.equal(build.installerSha256, process.env.QA_EXPECTED_INSTALLER_SHA);
assert.equal(await digest(path.join(artifact, pinned.installer)), process.env.QA_EXPECTED_INSTALLER_SHA);
fs.copyFileSync(path.join(artifact, pinned.installer), path.join(root, pinned.installer));
const response = await fetch(`https://api.github.com/repos/${pinned.repository}/releases/tags/${pinned.baseline.tag}`, { headers: { Authorization: `Bearer ${process.env.GH_TOKEN}`, Accept: 'application/vnd.github+json' }, signal: AbortSignal.timeout(30000) });
assert(response.ok);
const release = await response.json(), asset = release.assets.find(a => a.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);
const baseline = await fetch(pinned.baseline.url, { signal: AbortSignal.timeout(120000) });
assert(baseline.ok);
await pipeline(Readable.fromWeb(baseline.body), fs.createWriteStream(path.join(root, pinned.baseline.installer)));
assert.equal(await digest(path.join(root, pinned.baseline.installer)), pinned.baseline.sha256);
fs.writeFileSync(path.join(root, 'evidence/provenance.json'), JSON.stringify({ ...pinned, build, buildArtifactId: process.env.QA_BUILD_ARTIFACT_ID, buildArtifactDigest: process.env.QA_BUILD_ARTIFACT_DIGEST, baselineVerifiedSha256: pinned.baseline.sha256, testPackageOrigin: 'Exact trusted patch SHA, CI QA-built NSIS; unsigned/unreleased, not official release/updater acceptance' }, null, 2));
console.log(JSON.stringify({ fixedSha: pinned.sha, installerSha256: build.installerSha256, baselineSha256: pinned.baseline.sha256, buildArtifact: process.env.QA_BUILD_ARTIFACT_ID }, null, 2));
}
main().catch(error => { console.error(error.stack); process.exitCode = 1; });