test(qa): verify native terminal output and compare pinned official candidates

This commit is contained in:
binaricat committed 2026-11-21 12:41:27 +00:00
1 parent e5cc0127e7
commit 6dec3ecab6
5 files changed
+142 -62

No files matched your search

+16 -4
View File
@@ -23,10 +23,19 @@ jobs:
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
strategy:
fail-fast: false
matrix:
include:
- candidate: a23868e
config: candidate.json
- candidate: 9d4e90b
config: candidate-9d4e90b.json
runs-on: ubuntu-22.04
timeout-minutes: 12
env:
QA_ROOT: /tmp/netcatty-official-qa
QA_ROOT: /tmp/netcatty-official-qa-${{ matrix.candidate }}
QA_CANDIDATE: ${{ matrix.config }}
steps:
- name: Checkout QA harness without persisted credentials
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -60,16 +69,19 @@ jobs:
id: sftp
if: always() && steps.provenance.outcome == 'success'
run: xvfb-run -a -s '-screen 0 1440x1000x24 -nolisten tcp' node scripts/qa-official-linux/desktop.cjs sftp
- name: Independent new host filter compatibility and boundary checks
if: always() && steps.provenance.outcome == 'success' && matrix.candidate == '9d4e90b'
run: xvfb-run -a -s '-screen 0 1440x1000x24 -nolisten tcp' node scripts/qa-official-linux/desktop.cjs host-filter
- name: Record explicit scope
if: always()
run: |
echo 'Official a23868ee88603d0182c5370fca851cb9d05d7f8f / run 44901156879 / artifact 14706239224' >> "$GITHUB_STEP_SUMMARY"
echo 'Candidate ${{ matrix.candidate }}; exact official SHA/run/artifact/digests are recorded in provenance.json' >> "$GITHUB_STEP_SUMMARY"
echo 'Read independent persistence, ssh and sftp assertions.json reports and real screenshots; a failure in one scenario does not skip the others. Stock sandbox launch failures are failures, never feature passes. This is extracted-package execution, not system-install acceptance.' >> "$GITHUB_STEP_SUMMARY"
- name: Upload reviewed QA evidence (3 days)
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: official-linux-a23868e-probe-${{ github.run_id }}
path: /tmp/netcatty-official-qa/evidence/
name: official-linux-${{ matrix.candidate }}-qa-${{ github.run_id }}
path: /tmp/netcatty-official-qa-${{ matrix.candidate }}/evidence/
retention-days: 3
if-no-files-found: warn
+53 -41
View File
@@ -1,48 +1,60 @@
# Official Linux candidate QA (incremental probe)
# Official Linux package QA
Temporary, same-repository **Draft** PR only. Do not merge or publish this branch.
The workflow uses the standard GitHub-hosted Ubuntu 22.04 runner and read-only
contents/actions permissions. No release workflow is dispatched.
Temporary same-repository **Draft** PR only. Do not merge or publish this branch.
The workflow uses standard GitHub-hosted Ubuntu 22.04, read-only contents/actions
permissions, pinned official actions and checkout without persisted credentials.
No release workflow is dispatched.
Pinned candidate: `a23868ee88603d0182c5370fca851cb9d05d7f8f`, official main build
`44901156879`, Linux x64 artifact `14706239224`. The downloader verifies GitHub
repository/run/job/artifact metadata, the immutable archive digest, and the deb
digest recorded by that official Linux build. No older fallback is selected.
All candidate identifiers and digests live in `candidate.json`; change them
together only after read-only verification of the new official metadata. Each
assertion report records its own candidate SHA. Do not mix candidate results.
Candidate metadata is explicit JSON. `candidate.json` pins a23868e, official run
44901156879 / artifact 14706239224. `candidate-9d4e90b.json` pins the independently
verified 9d4e90b run 44903060405 / artifact 14707251480. No floating latest or older
fallback is used. Each report records its full candidate SHA; never mix results.
The downloader checks repository/run/job/artifact metadata, archive SHA-256, deb
SHA-256 from the official build log, and amd64 architecture before extraction.
The official deb is extracted as the non-root runner. Its installer scripts are
never executed: those scripts alter SUID/AppArmor. This is **extracted-package
execution**, not a system-install test. The application archive is never patched.
No `--no-sandbox`, sysctl, AppArmor, SUID, or system security changes are used.
Failure to launch with normal sandbox support fails the job with actual stderr.
The app's own renderer preference is `sandbox:false`; the harness reports this
stock setting and does not claim to prove full renderer sandboxing.
The official deb is extracted as the non-root runner. Installer scripts are
never executed because those scripts change SUID/AppArmor. This is extracted
package execution, not system-install acceptance. The application archive is
never patched. No --no-sandbox, sysctl, AppArmor, SUID or system security changes
are used. A normal launch failure is a failure with actual reviewed stderr.
The stock renderer preference is sandbox:false; the report states this honestly
and does not certify full renderer sandboxing.
Only the downloader step receives the GitHub token. Electron gets an explicit
environment allowlist, isolated HOME/XDG/temp/profile directories, no model
credentials and no business data. The SSH2 server and DevTools bind loopback.
The SSH password and host key are generated per run. No production account is used.
Only the downloader receives the GitHub token. Electron gets an explicit
environment allowlist with fresh scenario-specific HOME/XDG/temp/profile paths.
Xvfb's temporary XAUTHORITY is passed through for the isolated display. No model
credentials, business data or production account is used. SSH/SFTP and DevTools
listen only on loopback. SSH credentials and host keys are generated per run.
Implemented assertions:
Independent scenarios prevent one functional assertion from skipping another:
- Launch the real packaged Electron executable and verify `app.isPackaged`,
`resources/app.asar`, the isolated profile, non-root UID and launch switches.
- Seed a synthetic saved host in real Chromium storage; verify it in the real
vault before and after graceful quit and full process restart with that profile.
- Connect through the real UI to an actual loopback SSH2 server, send a command,
destroy the server-side transport, use the disconnected tab's reconnect action,
verify a second shell connection, another command and an unchanged tab ID.
- `persistence`: real packaged launch, synthetic saved host visible in the vault,
graceful full process quit, restart with the same profile, same data visible.
- `ssh`: actual encrypted SSH2 loopback transport through the production UI.
Explicitly focus xterm's real input element, use native renderer input events,
assert server receive and real terminal echo, destroy the server connection,
reconnect the original tab, assert a second shell and stable tab ID. Receive
hex, focus and echo diagnostics distinguish harness input failures from an
established product regression.
- `sftp`: establish a separate real SSH connection and SFTP subsystem, then invoke
the production preload transfer API into the actual packaged native runtime.
This covers real transport/control behavior, not a certification of UI button
gestures. Capture transfer-center screenshots; pause mid-file; drain pending
reads; sample actual server bytes and native progress five times over 2.5 s;
assert both are unchanged; resume and assert both grow; finish and compare
file length and SHA-256 to a deterministic 32 MiB payload. No component fixture,
injected transfer implementation, or checkout-sourced bridge substitutes for
the official package's transfer code.
- `host-filter` (9d4e90b only): seed synthetic vault hosts and call the actual
packaged public/vault/hosts/list dispatcher and renderer bridge. Independently
check no-filter compatibility, empty/non-string filters, multiword keyword
matching, group path boundaries, case sensitivity and combined filters.
**Not yet covered:** SFTP pause with stable progress, resume, completion and file
SHA-256. No component fixture substitutes for these missing assertions. A green
probe is not full three-scenario acceptance. Password persistence, system install,
and external hosts are also outside this incremental probe.
Evidence is an assertion JSON, official provenance, real application screenshots
and combined stdout/stderr. Before persisting logs or screenshots, the harness
checks output for its ephemeral password, private keys, GitHub credentials and
bearer headers; a match withholds those files and fails. Raw profiles are not
uploaded. Artifacts expire after three days. Environment failures must be reported
as failures, never as functional passes.
Evidence lives under scenario directories: `assertions.json`, reviewed
`electron-output.log`, and real application screenshots named for each scene.
`provenance.json` at the artifact root identifies the official package. Raw
profiles and payloads are never uploaded. Logs and assertion diagnostics are
checked for the ephemeral password, private keys, GitHub credentials and bearer
headers before logs/screenshots are published; matches withhold those files and
fail. Artifacts expire after three days. Read each assertion report: environment
and harness failures never count as feature passes.
@@ -0,0 +1,11 @@
{
"repository": "binaricat/Netcatty",
"repositoryId": 1111357457,
"sha": "9d4e90b3aa8fe0a52d1a58e8ea8e61bdd3865e28",
"run": 44903060405,
"artifact": 14707251480,
"name": "netcatty-linux-x64",
"zipSha256": "26c11c14501f58616600dc648a61dc36c256c558b86cc8fcff62bd0f38a9ade7",
"deb": "Netcatty-0.0.0-sha-9d4e90b-linux-amd64.deb",
"debSha256": "45781c366dcf9715eb681293e58e2ed47eba3cc9872a52cd2e1b8f3cf3de6ae0"
}
+61 -16
View File
@@ -258,19 +258,21 @@ async function capture(name) {
screenshots.set(name, bytes);
}
async function assertEcho(expected) {
// xterm renders to canvas. Read its actual selection through the production
// Select All / Copy menu and native clipboard, not document.body.innerText.
async function menu(label) {
await clickElement(cdp, '.xterm', 0, 'right');
const point = await until(`terminal menu ${label}`, () => cdp.eval(`(() => { const e = [...document.querySelectorAll('[role="menuitem"]')].find(e => e.textContent.trim().startsWith(${JSON.stringify(label)})); if (!e) return null; const r=e.getBoundingClientRect(); return {x:r.x+r.width/2,y:r.y+r.height/2}; })()`));
await clickPoint(cdp, point);
const sessionId = await cdp.eval(`document.querySelector('[data-tab-type="session"]').getAttribute('data-tab-id')`);
const params = {sessionId, scopedSessionIds: [sessionId], range: 'tail', maxLines: 80};
await until('server echo in production xterm reader', async () => {
const result = await mainCdp.eval(`process.mainModule.require(process.mainModule.require('electron').app.getAppPath() + '/electron/bridges/mcpServerBridge.cjs').dispatchBuiltinRpc('netcatty/readContext', ${JSON.stringify(params)})`);
report.terminalRead = result;
return result.ok === true && result.content.includes(expected);
}, 10000);
}
function disconnectFixtureClients() {
for (const client of fixture?.clients || []) {
// ssh2 Server.Connection exposes end(), not Client.destroy(). A socket
// destruction here is an actual transport loss, not a renderer status edit.
client._sock?.destroy();
client.end();
}
await pause(500);
await menu('Select All');
await menu('Copy');
const text = await mainCdp.eval(`process.mainModule.require('electron').clipboard.readText()`);
assert(text.includes(expected), 'Expected server echo absent from real xterm buffer');
await key(mainCdp, 'Escape'); await key(mainCdp, 'Escape', 'keyUp');
}
async function quit() {
if (mainCdp) await mainCdp.eval(`process.mainModule.require('electron').app.quit()`).catch(() => {});
@@ -283,6 +285,7 @@ async function quit() {
async function verifySftp() {
report.sftpPauseResume = 'incomplete';
const sessionId = await cdp.eval(`document.querySelector('[data-tab-type="session"]').getAttribute('data-tab-id')`);
report.stage = 'SFTP open on existing production SSH session';
const sftpId = await cdp.eval(`window.netcatty.openSftpForSession(${JSON.stringify(sessionId)}, {reuseExactSessionOnly: true})`);
assert(sftpId, 'Real packaged app must open SFTP on the SSH transport');
const transferId = `qa-${crypto.randomUUID()}`;
@@ -291,10 +294,12 @@ async function verifySftp() {
const options = { transferId, sourcePath: '/qa-payload.bin', targetPath, sourceType: 'sftp', targetType: 'local', sourceSftpId: sftpId, totalBytes: fixture.payload.length, resumable: true };
await cdp.eval(`(() => { window.__qaTransfer = {events: [], done: false}; window.netcatty.onGlobalSftpTransferEvent(e => { if (e.transferId === ${JSON.stringify(transferId)}) window.__qaTransfer.events.push(e); }); window.netcatty.startStreamTransfer(${JSON.stringify(options)}).then(result => { window.__qaTransfer.result = result; window.__qaTransfer.done = true; }, error => { window.__qaTransfer.error = String(error); window.__qaTransfer.done = true; }); return true; })()`);
const progress = () => cdp.eval(`Math.max(0, ...window.__qaTransfer.events.map(e => e.transferred || 0))`);
report.stage = 'SFTP bytes and native progress';
await until('real SFTP bytes and native progress', async () => fixture.sftpStats.bytesSent > 262144 && await progress() > 131072, 30000);
await clickElement(cdp, 'button[aria-label="File Transfers"]');
await pause(200);
await capture('03-sftp-transferring.png');
report.stage = 'SFTP pause';
const paused = await cdp.eval(`window.netcatty.pauseTransfer(${JSON.stringify(transferId)})`);
assert.equal(paused.success, true, paused.reason);
await until('native paused lifecycle event', () => cdp.eval(`window.__qaTransfer.events.some(e => e.type === 'paused')`));
@@ -308,6 +313,7 @@ async function verifySftp() {
assert(samples.every(s => s.serverBytes === samples[0].serverBytes), 'Actual SFTP server bytes changed while paused');
assert(samples.every(s => s.progressBytes === samples[0].progressBytes), 'Native progress changed while paused');
await capture('04-sftp-paused.png');
report.stage = 'SFTP resume';
const resumed = await cdp.eval(`window.netcatty.resumeTransfer(${JSON.stringify(transferId)})`);
assert.equal(resumed.success, true, resumed.reason);
await until('server and progress resume', async () => fixture.sftpStats.bytesSent > samples[0].serverBytes && await progress() > samples[0].progressBytes, 15000);
@@ -322,12 +328,51 @@ async function verifySftp() {
report.sftp = { invocation: 'production preload API -> packaged native transfer runtime, actual loopback SSH2 SFTP; no substituted bridge', transferId, bytes: fixture.payload.length, paused, resumed, pauseSamples: samples, finalServer: fixture.sftpStats, expectedSha256, actualSha256, events: await cdp.eval(`window.__qaTransfer.events`) };
await capture('06-sftp-completed.png');
}
async function verifyHostFilters() {
report.hostFilters = {status: 'incomplete', cases: []};
const hosts = [
{id: 'web', label: 'QA WEB', hostname: '127.0.0.1', username: 'deploy', group: 'prod/web', tags: ['Nginx'], os: 'linux'},
{id: 'db', label: 'QA DB', hostname: '127.0.0.2', username: 'root', group: 'prod/db', tags: ['postgres'], os: 'linux'},
{id: 'old', label: 'QA OLD', hostname: '127.0.0.3', username: 'root', group: 'production-old', tags: [], os: 'linux'},
{id: 'prod-root', label: 'QA PROD ROOT', hostname: '127.0.0.4', username: 'ops', group: 'prod', tags: [], os: 'linux'},
{id: 'ungrouped', label: 'QA UNGROUPED', hostname: '127.0.0.5', username: 'ops', tags: [], os: 'linux'},
];
await cdp.eval(`localStorage.setItem('netcatty_hosts_v1', ${JSON.stringify(JSON.stringify(hosts))})`);
await cdp.send('Page.reload');
await until('synthetic filter host vault loaded', () => cdp.eval(`document.body.innerText.includes('QA UNGROUPED')`));
await capture('02-host-filter-vault.png');
const all = hosts.map(h => h.id).sort();
const cases = [
[{}, all],
[{query: ' ', group: ''}, all],
[{query: 123, group: null}, all],
[{query: 'WEB nginx'}, ['web']],
[{query: 'root DB'}, ['db']],
[{query: 'production'}, []],
[{group: 'prod'}, ['db', 'prod-root', 'web']],
[{group: 'prod/web'}, ['web']],
[{group: ' prod/ '}, ['db', 'prod-root', 'web']],
[{group: 'PROD'}, []],
[{group: 'prod', query: 'postgres'}, ['db']],
];
for (const [params, expected] of cases) {
const result = await mainCdp.eval(`process.mainModule.require(process.mainModule.require('electron').app.getAppPath() + '/electron/bridges/mcpServerBridge.cjs').dispatchBuiltinRpc('public/vault/hosts/list', ${JSON.stringify(params)})`);
assert.equal(result.ok, true, JSON.stringify(result));
const ids = result.hosts.map(h => h.id).sort();
report.hostFilters.cases.push({params, ids, expected});
assert.deepEqual(ids, expected);
assert(result.hosts.every(h => !('password' in h) && !('privateKey' in h)));
}
report.hostFilters.status = 'pass';
report.hostFilters.path = 'real packaged public/vault/hosts/list dispatcher -> production renderer vault bridge';
await capture('03-host-filter-cases-completed.png');
}
async function run() {
assert.notEqual(process.getuid(), 0, 'QA must run as a non-root user');
assert(fs.existsSync(executable), `Official executable missing: ${executable}`);
fs.mkdirSync(evidence, { recursive: true });
assert(!fs.existsSync(profile), 'QA profile must start clean');
watchdog = setTimeout(() => { child?.kill('SIGKILL'); process.exit(1); }, 180000);
watchdog = setTimeout(() => { fs.writeFileSync(path.join(evidence, 'watchdog.json'), JSON.stringify({candidate: pinned.sha, scenario, failure: 'Scenario exceeded 180 seconds', stage: report.stage || 'desktop'})); child?.kill('SIGKILL'); process.exit(1); }, 180000);
try {
await launch();
await capture('01-official-launch.png');
@@ -376,7 +421,7 @@ async function run() {
const originalTabs = await cdp.eval(`[...document.querySelectorAll('[data-tab-type="session"]')].map(e => e.getAttribute('data-tab-id'))`);
assert.equal(originalTabs.length, 1);
assert(originalTabs[0], 'Stable original tab ID required');
for (const client of fixture.clients) client.destroy();
disconnectFixtureClients();
await until('disconnect overlay', () => cdp.eval(`Boolean(document.querySelector('[data-terminal-disconnected-dialog="true"]'))`));
await capture('04-real-ssh-disconnected.png');
await key(mainCdp, 'Enter'); await key(mainCdp, 'Enter', 'keyUp');
@@ -398,7 +443,7 @@ async function run() {
} finally {
await quit();
if (fixture) {
for (const client of fixture.clients) client.destroy();
disconnectFixtureClients();
await new Promise(resolve => fixture.server.close(resolve));
}
clearTimeout(watchdog);
@@ -415,7 +460,7 @@ async function run() {
report.coverage = 'Independent scenario: only this report and candidate SHA count; other scenario reports must be evaluated separately';
fs.writeFileSync(path.join(evidence, 'assertions.json'), JSON.stringify(report, null, 2));
console.log(JSON.stringify(report, null, 2));
fs.rmSync(profile, { recursive: true, force: true });
try { fs.rmSync(profile, { recursive: true, force: true, maxRetries: 5, retryDelay: 300 }); } catch (error) { console.warn('Isolated profile cleanup warning: ' + error.code); }
}
}
run().catch(error => { console.error(error.message); process.exitCode = 1; });
+1 -1
View File
@@ -6,7 +6,7 @@ const crypto = require('node:crypto');
const { Readable } = require('node:stream');
const { pipeline } = require('node:stream/promises');
const { execFileSync } = require('node:child_process');
const pinned = require('./candidate.json');
const pinned = require(path.resolve(__dirname, process.env.QA_CANDIDATE || 'candidate.json'));
async function main() {
assert(process.env.GH_TOKEN, 'Downloader needs actions:read token');
const root = path.resolve(process.env.QA_ROOT);