Simplify instance details and clarify diagnostics

This commit is contained in:
2026-10-06 17:42:05 -04:00
parent f4094b7f5d
commit b8cccc5a98
15 changed files with 329 additions and 323 deletions
+25
View File
@@ -184,3 +184,28 @@ describe('log refresh controls', () => {
expect(onLoading).not.toHaveBeenCalled();
});
});
it('keeps the last tail on a non-JSON gateway failure and can recover with a retry', async () => {
const { fetcher, onData, onError } = setup();
fetcher.mockResolvedValueOnce(response('saved'))
.mockResolvedValueOnce(new Response('<html>Bad Gateway</html>', { status: 502 }))
.mockResolvedValueOnce(response('recovered'));
controller.configure(target, false, 5000);
await controller.refresh();
await controller.refresh();
expect(onError).toHaveBeenLastCalledWith('HTTP 502: Expected a JSON log response.');
expect(onData).toHaveBeenCalledTimes(1);
expect(onData).toHaveBeenLastCalledWith('console', expect.objectContaining({ lines: ['saved'] }));
await controller.refresh();
expect(onError).toHaveBeenLastCalledWith('');
expect(onData).toHaveBeenLastCalledWith('console', expect.objectContaining({ lines: ['recovered'] }));
});
it('rejects malformed successful log payloads before they reach the renderer', async () => {
const { fetcher, onData, onError } = setup();
fetcher.mockResolvedValue(new Response(JSON.stringify({ ok: true, lines: [42] })));
controller.configure(target, false, 5000);
await controller.refresh();
expect(onData).not.toHaveBeenCalled();
expect(onError).toHaveBeenLastCalledWith('Invalid log response: expected an array of lines.');
});