feat: expose executor job observability

This commit is contained in:
john
2026-07-24 23:31:29 +08:00
parent bbb43f97a3
commit 396bb78200
18 changed files with 733 additions and 68 deletions
+16 -1
View File
@@ -60,7 +60,9 @@ test('remote workflow engine speaks only the versioned orchestrator HTTP contrac
return {
ok: true,
async json() {
return url.endsWith('/events') ? { events: [{ type: 'run.succeeded' }] } : { ok: true };
return url.includes('/events')
? { events: [{ type: 'run.succeeded' }] }
: { ok: true };
},
};
},
@@ -71,6 +73,13 @@ test('remote workflow engine speaks only the versioned orchestrator HTTP contrac
await engine.getState('run-1');
const events = [];
for await (const event of engine.streamEvents('run-1')) events.push(event);
await engine.getExecutorJob('run-1:executor-preview');
const executorEvents = [];
for await (
const event of engine.streamExecutorJobEvents('run-1:executor-preview', 2)
) {
executorEvents.push(event);
}
assert.deepEqual(calls.map((call) => [call.init?.method ?? 'GET', call.url]), [
['POST', 'http://orchestrator.internal/v1/runs'],
@@ -78,6 +87,12 @@ test('remote workflow engine speaks only the versioned orchestrator HTTP contrac
['POST', 'http://orchestrator.internal/v1/runs/run-1/cancel'],
['GET', 'http://orchestrator.internal/v1/runs/run-1'],
['GET', 'http://orchestrator.internal/v1/runs/run-1/events'],
['GET', 'http://orchestrator.internal/v1/executor-jobs/run-1%3Aexecutor-preview'],
[
'GET',
'http://orchestrator.internal/v1/executor-jobs/run-1%3Aexecutor-preview/events?after=2',
],
]);
assert.deepEqual(events, [{ type: 'run.succeeded' }]);
assert.deepEqual(executorEvents, [{ type: 'run.succeeded' }]);
});