Skip to content

Commit 73f885a

Browse files
ThomasK33claude
andcommitted
test(inspect): cover DEREM-24 branch where cliVersion is absent
DEREM-50: new test 'surfaces host.rpcSocketPath even when cliVersion is unavailable' exercises the DEREM-24 fix (host gated only on rpcSocketPath). Asserts host.cliVersion === undefined, host.rpcSocketPath populates, and the 'RPC Socket:' line appears while 'Host CLI Version:' does not. If a future change re-couples the two fields, this test breaks. Change-Id: I760f5f69766e6b6f382bc85cd0af4d6cdded1642 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 9edf484 commit 73f885a

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

test/unit/commands/inspect.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,44 @@ describe('inspect command', () => {
566566
);
567567
});
568568

569+
it('surfaces host.rpcSocketPath even when cliVersion is unavailable', async () => {
570+
// Exercises the DEREM-24 fix: when `loadPackageMetadata` fails on the
571+
// host, `cliVersion` is omitted from the RPC response but
572+
// `rpcSocketPath` is still populated. The CLI must surface the socket
573+
// path instead of dropping the entire `host` block.
574+
const liveSession = createSessionRecord('running');
575+
mocks.sendRpc.mockResolvedValue({
576+
session: liveSession,
577+
rpcSocketPath: '/tmp/agent-tty/sessions/session-01/rpc.sock',
578+
rendererBooted: false,
579+
rendererBootInFlight: false,
580+
});
581+
582+
await runInspectCommand({
583+
context: TEST_CONTEXT,
584+
json: true,
585+
sessionId: 'session-01',
586+
});
587+
588+
const emitted = getLastEmitSuccessPayload() as {
589+
result: {
590+
host?: { cliVersion?: string; rpcSocketPath: string };
591+
};
592+
lines: string[];
593+
};
594+
595+
expect(emitted.result.host).toEqual({
596+
rpcSocketPath: '/tmp/agent-tty/sessions/session-01/rpc.sock',
597+
});
598+
expect(emitted.result.host?.cliVersion).toBeUndefined();
599+
expect(emitted.lines).toContain(
600+
'RPC Socket: /tmp/agent-tty/sessions/session-01/rpc.sock',
601+
);
602+
expect(emitted.lines).not.toEqual(
603+
expect.arrayContaining([expect.stringMatching(/^Host CLI Version:/)]),
604+
);
605+
});
606+
569607
it('omits host info and renderer extensions in offline-replay mode', async () => {
570608
const reconciledSession = createSessionRecord('exited');
571609
mocks.sendRpc.mockRejectedValue(

0 commit comments

Comments
 (0)