fix: reconcile terminal Git evidence and finalize delivery reports

This commit is contained in:
Agent Workbench Dev
2026-11-06 14:42:21 +08:00
parent e32996799b
commit 1763d90db7
15 changed files with 983 additions and 15 deletions
+9 -5
View File
@@ -4,7 +4,11 @@ import { randomUUID, createHash } from 'node:crypto';
import { spawnSync, execFileSync } from 'node:child_process';
import { build } from 'esbuild';
const output = path.resolve('.qa/engineering-repairs-ah-' + randomUUID()); fs.mkdirSync(output);
const withTerminal = process.argv.includes('--with-terminal');
const tests = ['tests/python-selection.test.mjs', ...(withTerminal ? ['tests/terminal-delivery.test.mjs'] : []),
...(process.argv.includes('--with-runtime') ? ['tests/runtime.test.mjs'] : [])];
const label = withTerminal ? 'engineering' : 'python';
const output = path.resolve('.qa/engineering-repairs-' + (withTerminal ? 'ai-' : 'ah-') + randomUUID()); fs.mkdirSync(output);
const appRoot = path.join(output, 'app'); fs.mkdirSync(path.join(appRoot, 'dist-server'), { recursive: true });
fs.mkdirSync(path.join(appRoot, 'scripts'));
fs.copyFileSync('scripts/python-check-runner.py', path.join(appRoot, 'scripts/python-check-runner.py'));
@@ -21,7 +25,7 @@ function walk(directory) {
}
}
for (const directory of ['src/server', 'src/core', 'src/shared']) walk(directory);
inputs.push(...['scripts/python-check-runner.py', 'tests/python-selection.test.mjs'].map(name => ({ path: name, sha256: sha(fs.readFileSync(name)) })));
inputs.push(...['scripts/python-check-runner.py', 'tests/helpers.mjs', 'tests/fixtures/delivery-project.mjs', ...tests].map(name => ({ path: name, sha256: sha(fs.readFileSync(name)) })));
fs.writeFileSync(path.join(output, 'inputs.json'), JSON.stringify(inputs, null, 2));
console.log(JSON.stringify({ output, building: 'isolated backend only', sharedBuildsModified: false }));
await build({ entryPoints: ['src/server/index.mjs'], outfile: path.join(appRoot, 'dist-server/server.mjs'), bundle: true, platform: 'node', target: 'node24', format: 'esm',
@@ -30,10 +34,10 @@ for (const [entry, name] of [['src/server/hot-upgrade.mjs', 'hot-upgrade'], ['sr
await build({ entryPoints: [entry], outfile: path.join(appRoot, 'dist-server/' + name + '.mjs'), bundle: true, platform: 'node', target: 'node24', format: 'esm',
sourcemap: false, legalComments: 'eof', banner: { js: "import { createRequire as __awbCreateRequire } from 'node:module'; const require = __awbCreateRequire(import.meta.url);" } });
}
const args = ['--test', 'tests/python-selection.test.mjs'];
const result = spawnSync(process.execPath, args, { encoding: 'utf8', windowsHide: true, timeout: 120000, maxBuffer: 32 * 1024 * 1024,
const args = ['--test', '--test-concurrency=1', ...tests];
const result = spawnSync(process.execPath, args, { encoding: 'utf8', windowsHide: true, timeout: withTerminal ? 240000 : 120000, maxBuffer: 32 * 1024 * 1024,
env: { ...process.env, AGENT_WORKBENCH_TEST_APP_ROOT: appRoot, AGENT_WORKBENCH_TEST_PYTHON: process.env.AGENT_WORKBENCH_TEST_PYTHON ?? path.resolve('.qa/reliability-1.25.2/python-env/Scripts/python.exe') } });
fs.writeFileSync(path.join(output, 'python.stdout.txt'), result.stdout ?? ''); fs.writeFileSync(path.join(output, 'python.stderr.txt'), result.stderr ?? '');
fs.writeFileSync(path.join(output, label + '.stdout.txt'), result.stdout ?? ''); fs.writeFileSync(path.join(output, label + '.stderr.txt'), result.stderr ?? '');
const sourceUnchanged = inputs.every(row => sha(fs.readFileSync(row.path)) === row.sha256);
const receipt = { success: result.status === 0 && sourceUnchanged, status: result.status, signal: result.signal, error: result.error?.message ?? null,
args, sourceUnchanged, serverSha256: sha(fs.readFileSync(path.join(appRoot, 'dist-server/server.mjs'))),