fix(fleet): align migration SSH parity docs
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -352,6 +352,41 @@ describe('v1-to-v2 migration preview', (): void => {
|
||||
},
|
||||
);
|
||||
|
||||
it('matches production v1 locality for a remote agent with a bare-host SSH target', async () => {
|
||||
const source = v1Source.replace('ssh: operator@build.example.test', 'ssh: build.example.test');
|
||||
const rosterPath = join(
|
||||
await mkdtemp(join(tmpdir(), 'v1-bare-host-ssh-parity-')),
|
||||
'roster.yaml',
|
||||
);
|
||||
temporaryDirectories.push(dirname(rosterPath));
|
||||
await writeFile(rosterPath, source);
|
||||
|
||||
await expect(loadFleetRoster(rosterPath)).resolves.toMatchObject({
|
||||
agents: [
|
||||
expect.any(Object),
|
||||
expect.objectContaining({ host: 'build.example.test', ssh: 'build.example.test' }),
|
||||
],
|
||||
});
|
||||
|
||||
const preview = await previewV1ToV2Migration({
|
||||
source,
|
||||
decisions: decisions(),
|
||||
observations: observations(),
|
||||
personaDirs: await semanticDirs(),
|
||||
});
|
||||
|
||||
expect(preview.status).toBe('ready');
|
||||
expect(preview.blockers).toEqual([]);
|
||||
expect(preview.inventoryOnlyAgents).toEqual([
|
||||
{
|
||||
name: 'remote0',
|
||||
fields: ['host', 'socket', 'ssh'],
|
||||
disposition: 'inventory-only',
|
||||
},
|
||||
]);
|
||||
expect(preview.canonicalRoster?.agents.map(({ name }) => name)).toEqual(['coder0']);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['socket_name', " socket_name: ''\n holder_session: _holder"],
|
||||
['socketName', " socketName: ''\n holder_session: _holder"],
|
||||
|
||||
@@ -778,8 +778,8 @@ function classifyAgentLocality(
|
||||
if (hasSsh) {
|
||||
if (!ssh) return 'ambiguous';
|
||||
const separator = ssh.lastIndexOf('@');
|
||||
const sshHost = separator >= 0 ? ssh.slice(separator + 1) : undefined;
|
||||
if (!sshHost || sshHost !== host) return 'ambiguous';
|
||||
const sshHost = separator >= 0 ? ssh.slice(separator + 1) : ssh;
|
||||
if (sshHost !== host) return 'ambiguous';
|
||||
}
|
||||
return host === fleetHost ? 'local' : 'remote';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user