feat(ci): verify clean source builds and pinned official contracts

This commit is contained in:
Agent Workbench Dev
2026-11-07 21:53:43 +08:00
parent a43262c112
commit af42b949ef
20 changed files with 4376 additions and 7 deletions
+5 -1
View File
@@ -31,9 +31,11 @@ test('source ZIP exports committed program bytes without runtime, user data, dir
const git = args => execFileSync('git', args, { cwd: root, windowsHide: true, encoding: 'utf8' }).trim();
git(['init']);
write('package.json', JSON.stringify({ name: 'owned-source', version: '1.25.6' })); write('package-lock.json', '{}\n');
write('.gitattributes', '*.cmd text eol=crlf\n'); write('Start-Workbench.cmd', '@echo off\necho owned\n');
write('.gitattributes', '*.cmd text eol=crlf\n.gitea/workflows/*.yml text eol=lf\n'); write('Start-Workbench.cmd', '@echo off\necho owned\n');
const original = Buffer.from('\ufeff// 中文原字节\r\nexport const value = 42;\r\n'); write('src/中文.mjs', original);
for (const name of ['scripts/build.mjs', 'tests/owned.test.mjs', 'docs/PACKAGING.md', 'docs/research/NOTES.md']) write(name, 'Committed guide or code\n');
write('.gitea/workflows/ci.yml', 'name: Owned committed CI\non: [push]\n');
write('.gitea/private-setting.json', 'OWNED-EXCLUDED-CANARY');
for (const name of ['data/workbench.sqlite', '.data/session.json', '.env', 'dist-client/index.html', 'runtime/node.exe', 'docs/historical-evidence/raw.json']) write(name, 'OWNED-EXCLUDED-CANARY');
git(['add', '--all']); git(['-c', 'user.name=Source QA', '-c', 'user.email=source-qa@local.invalid', 'commit', '-m', 'Owned source fixture']);
const commit = git(['rev-parse', 'HEAD']);
@@ -49,6 +51,8 @@ test('source ZIP exports committed program bytes without runtime, user data, dir
assert.equal(row.sha256, createHash('sha256').update(archived).digest('hex'));
}
assert.ok(entries.has(prefix + 'package-lock.json')); assert.ok(entries.has(prefix + 'docs/PACKAGING.md'));
assert.equal(entries.get(prefix + '.gitea/workflows/ci.yml').toString(), 'name: Owned committed CI\non: [push]\n');
assert.equal(entries.has(prefix + '.gitea/private-setting.json'), false);
assert.equal([...entries.keys()].some(name => /(?:sqlite|session\.json|\.env|dist-client|runtime|historical-evidence|untracked)/.test(name)), false);
for (const value of entries.values()) assert.equal(value.includes('OWNED-EXCLUDED-CANARY'), false);
assert.equal(fs.readFileSync(path.join(root, 'src/中文.mjs'), 'utf8'), 'Uncommitted changed code');