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
+27
View File
@@ -57,6 +57,10 @@ test('orchestrator HTTP API exposes health and authenticated run endpoints', asy
body: JSON.stringify(spec()),
});
assert.equal(unauthorized.status, 401);
const unauthorizedExecutorJob = await fetch(
`${server.baseUrl}/v1/executor-jobs/http-shadow-1%3Aexecutor-preview`,
);
assert.equal(unauthorizedExecutorJob.status, 401);
const created = await fetch(`${server.baseUrl}/v1/runs`, {
method: 'POST',
@@ -75,6 +79,26 @@ test('orchestrator HTTP API exposes health and authenticated run endpoints', asy
const eventBody = await events.json();
assert.equal(events.status, 200);
assert.deepEqual(eventBody.events.map((event) => event.sequence), [2, 3]);
const jobId = 'http-shadow-1:executor-preview';
const executorJob = await fetch(
`${server.baseUrl}/v1/executor-jobs/${encodeURIComponent(jobId)}`,
{ headers: { authorization: 'Bearer test-service-token' } },
);
assert.equal(executorJob.status, 200);
assert.equal((await executorJob.json()).status, 'blocked');
const executorEvents = await fetch(
`${server.baseUrl}/v1/executor-jobs/${encodeURIComponent(jobId)}/events?after=0`,
{ headers: { authorization: 'Bearer test-service-token' } },
);
const executorEventBody = await executorEvents.json();
assert.equal(executorEvents.status, 200);
assert.deepEqual(
executorEventBody.events.map((event) => event.type),
['executor_job_blocked'],
);
assert.equal(executorEventBody.nextCursor, 1);
});
test('orchestrator HTTP API reports missing runs and observe-only violations', async (t) => {
@@ -86,6 +110,9 @@ test('orchestrator HTTP API reports missing runs and observe-only violations', a
const missing = await fetch(`${server.baseUrl}/v1/runs/missing`);
assert.equal(missing.status, 404);
const missingExecutorJob = await fetch(`${server.baseUrl}/v1/executor-jobs/missing`);
assert.equal(missingExecutorJob.status, 404);
assert.equal((await missingExecutorJob.json()).error.code, 'EXECUTOR_JOB_NOT_FOUND');
const activeSpec = spec();
activeSpec.runId = 'http-active-1';