stage-harness: fix a broken string literal in the import check; node --check / bash -n / py compile of every build script in the host tests

This commit is contained in:
Niko1221 committed 2026-10-17 20:26:24 +02:00
1 parent 1b856af242
commit e77e5550df
2 files changed
+41 -3

No files matched your search

+1 -3
View File
@@ -164,9 +164,7 @@ if (keepIgnore) writeFileSync(join(out, '.gitignore'), keepIgnore);
// --- proof 1: nothing the Harness imports by name was pruned ------------------------------------------------------------
// (2026-10-17: the other-OS rule once removed @deepseek-ai/dsh-win32-process, which every platform imports; Linux/Mac agent chats died.)
const lost = missingHarnessImports(out);
if (lost.length) { console.error('staged Harness is missing imported packages:
' + lost.map(l => ` ${l.from} -> ${l.missing}`).join('
')); process.exit(1); }
if (lost.length) { console.error(['staged Harness is missing imported packages:', ...lost.map(l => ` ${l.from} -> ${l.missing}`)].join(String.fromCharCode(10))); process.exit(1); }
console.log('import check: every @deepseek-ai package the Harness imports is staged');
// --- proof 2: the staged copy answers --version and boots the web profile once ----------------------------------------
@@ -0,0 +1,40 @@
/**
* Every build and staging script must at least parse. A string literal broken over two lines in stage-harness.mjs (2026-10-17) made
* every Harness staging fail with a SyntaxError, on every operating system, and nothing noticed until a build was started.
*/
import test from 'node:test';
import assert from 'node:assert/strict';
import { readdirSync } from 'node:fs';
import { spawnSync } from 'node:child_process';
import { join, resolve } from 'node:path';
const scripts = resolve(import.meta.dirname, '..', '..', 'desktop', 'scripts');
const packaging = resolve(import.meta.dirname, '..', '..', '..', 'packaging');
for (const file of readdirSync(scripts).filter(f => f.endsWith('.mjs'))) {
test(`node --check ${file}`, () => {
const r = spawnSync(process.execPath, ['--check', join(scripts, file)], { encoding: 'utf8' });
assert.equal(r.status, 0, r.stderr);
});
}
for (const file of readdirSync(scripts).filter(f => f.endsWith('.sh'))) {
test(`bash -n ${file}`, t => {
const probe = spawnSync('bash', ['--version'], { encoding: 'utf8' });
if (probe.error || probe.status !== 0) { t.skip('no bash here'); return; }
const r = spawnSync('bash', ['-n', join(scripts, file)], { encoding: 'utf8' });
assert.equal(r.status, 0, r.stderr);
});
}
for (const dir of [scripts, packaging]) {
for (const file of readdirSync(dir).filter(f => f.endsWith('.py'))) {
test(`python compile ${file}`, t => {
const python = process.platform === 'win32' ? 'python' : 'python3';
const probe = spawnSync(python, ['--version'], { encoding: 'utf8' });
if (probe.error || probe.status !== 0) { t.skip('no python here'); return; }
const r = spawnSync(python, ['-c', 'import ast,sys; ast.parse(open(sys.argv[1], encoding="utf-8").read())', join(dir, file)], { encoding: 'utf8' });
assert.equal(r.status, 0, r.stderr);
});
}
}