Keep invalid container states from dropping host heartbeats

This commit is contained in:
2026-10-05 16:15:15 -04:00
parent 87c5cf4b4b
commit ad63b3957d
6 changed files with 36 additions and 18 deletions
+13
View File
@@ -15,6 +15,19 @@ async function enrolled() {
}
describe('native host enrollment and scoped authentication', () => {
it('keeps the host online and delivers work when individual state observations are invalid', async () => {
const api = await enrolled();
const good = { instanceId: 'healthy-server', generation: 1, state: 'running', healthy: true, observedAt: new Date().toISOString() };
const operation = api.queueHostOperation(api.host.id, 'host.inspect', {});
const host = api.heartbeat(api.host.id, { ...inventory, instanceStates: [good,
{ ...good, instanceId: 'crashing', state: 'restarting' },
{ ...good, instanceId: 'paused', state: 'paused' }, null,
{ ...good, generation: 0 }, { ...good, observedAt: 'invalid' }] });
expect(host.inventory.instanceStates).toEqual([good]);
expect(host.readiness).toBe('ready');
expect(api.pendingHostOperations(api.host.id).map(row => row.id)).toContain(operation.id);
});
it('queues serialized launch files and processes receipts without hydrating plugin payloads', async () => {
const api = await enrolled();
const { db } = await import('../../src/lib/server/db/index.js');