test: detect compiled binaries and large files tracked by git

Two new tests in skill-validation:
- No Mach-O or ELF binaries tracked (catches accidental git add of compiled output)
- No files over 2MB tracked (catches bloated binaries sneaking in)

Both print the exact git rm --cached command to fix the issue.
This commit is contained in:
Garry Tan
2026-04-05 09:51:31 -07:00
parent bcff4da398
commit 842f3b8def
+20
View File
@@ -1522,6 +1522,26 @@ describe('Test failure triage in ship skill', () => {
});
});
describe('no compiled binaries in git', () => {
test('git tracks no Mach-O or ELF binaries', () => {
const result = require('child_process').execSync(
'git ls-files -z | xargs -0 file --mime-type 2>/dev/null | grep -E "application/(x-mach-binary|x-executable|x-pie-executable|x-sharedlib)" || true',
{ cwd: ROOT, encoding: 'utf-8' }
).trim();
const files = result ? result.split('\n').map((l: string) => l.split(':')[0].trim()) : [];
expect(files).toEqual([]);
});
test('git tracks no files larger than 2MB', () => {
const result = require('child_process').execSync(
'git ls-files -z | xargs -0 -I{} sh -c \'size=$(wc -c < "{}" 2>/dev/null | tr -d " "); [ "$size" -gt 2097152 ] 2>/dev/null && echo "{}:${size}"\' || true',
{ cwd: ROOT, encoding: 'utf-8' }
).trim();
const files = result ? result.split('\n').filter(Boolean) : [];
expect(files).toEqual([]);
});
});
describe('sidebar agent (#584)', () => {
// #584 — Sidebar Write: sidebar-agent.ts allowedTools includes Write
test('sidebar-agent.ts allowedTools includes Write', () => {