feat(offload): finalize GCE-only architecture and secure fleet management

This commit is contained in:
mkorwel
2026-03-14 00:43:53 -07:00
parent 45902f5e8a
commit 1f14f609ee
8 changed files with 328 additions and 354 deletions
+21 -12
View File
@@ -13,12 +13,12 @@ describe('Offload Tooling Matrix', () => {
const mockSettings = {
maintainer: {
deepReview: {
remoteHost: 'test-host',
remoteWorkDir: '~/test-dir',
projectId: 'test-project',
zone: 'us-west1-a',
terminalType: 'none',
syncAuth: false,
geminiSetup: 'preexisting',
ghSetup: 'preexisting'
geminiSetup: 'isolated',
ghSetup: 'isolated'
}
}
};
@@ -33,8 +33,19 @@ describe('Offload Tooling Matrix', () => {
vi.spyOn(process, 'chdir').mockImplementation(() => {});
vi.mocked(spawnSync).mockImplementation((cmd: any, args: any) => {
if (cmd === 'ssh' && args?.[1]?.includes('command -v')) return { status: 0 } as any;
return { status: 0, stdout: Buffer.from('test-meta\n'), stderr: Buffer.from('') } as any;
const callStr = JSON.stringify({ cmd, args });
// 1. Mock GCloud Instance List
if (callStr.includes('gcloud') && callStr.includes('instances') && callStr.includes('list')) {
return { status: 0, stdout: Buffer.from(JSON.stringify([{ name: 'gcli-offload-test-worker' }])), stderr: Buffer.from('') } as any;
}
// 2. Mock GH Metadata Fetching (local or remote)
if (callStr.includes('gh') && callStr.includes('view')) {
return { status: 0, stdout: Buffer.from('test-meta\n'), stderr: Buffer.from('') } as any;
}
return { status: 0, stdout: Buffer.from(''), stderr: Buffer.from('') } as any;
});
vi.mocked(spawn).mockImplementation(() => {
@@ -53,14 +64,14 @@ describe('Offload Tooling Matrix', () => {
const spawnCalls = vi.mocked(spawnSync).mock.calls;
const ghCall = spawnCalls.find(call => {
const cmdStr = JSON.stringify(call);
return cmdStr.includes('issue') && cmdStr.includes('view') && cmdStr.includes('456');
const s = JSON.stringify(call);
return s.includes('gh') && s.includes('issue') && s.includes('view') && s.includes('456');
});
expect(ghCall).toBeDefined();
const sshCall = spawnCalls.find(call => {
const cmdStr = JSON.stringify(call);
return cmdStr.includes('implement') && cmdStr.includes('offload-456-impl-456');
const s = JSON.stringify(call);
return s.includes('gcloud') && s.includes('ssh') && s.includes('offload-456-implement');
});
expect(sshCall).toBeDefined();
});
@@ -69,9 +80,7 @@ describe('Offload Tooling Matrix', () => {
describe('Fix Playbook', () => {
it('should launch the agentic fix-pr skill', async () => {
vi.mocked(fs.existsSync).mockReturnValue(true);
await runWorker(['123', 'test-branch', '/path/policy', 'fix']);
const spawnSyncCalls = vi.mocked(spawnSync).mock.calls;
const fixCall = spawnSyncCalls.find(call =>
JSON.stringify(call).includes("activate the 'fix-pr' skill")