feat(cron): post isolated summaries
This commit is contained in:
@@ -299,7 +299,6 @@ export const CronPayloadSchema = Type.Union([
|
||||
|
||||
export const CronIsolationSchema = Type.Object(
|
||||
{
|
||||
postToMain: Type.Optional(Type.Boolean()),
|
||||
postToMainPrefix: Type.Optional(Type.String()),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
@@ -411,6 +410,7 @@ export const CronRunLogEntrySchema = Type.Object(
|
||||
]),
|
||||
),
|
||||
error: Type.Optional(Type.String()),
|
||||
summary: Type.Optional(Type.String()),
|
||||
runAtMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
||||
durationMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
||||
nextRunAtMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
||||
|
||||
@@ -551,10 +551,12 @@ describe("gateway server", () => {
|
||||
jobId?: unknown;
|
||||
action?: unknown;
|
||||
status?: unknown;
|
||||
summary?: unknown;
|
||||
};
|
||||
expect(last.action).toBe("finished");
|
||||
expect(last.jobId).toBe(jobId);
|
||||
expect(last.status).toBe("ok");
|
||||
expect(last.summary).toBe("hello");
|
||||
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
@@ -573,6 +575,9 @@ describe("gateway server", () => {
|
||||
const entries = (runsRes.payload as { entries?: unknown } | null)?.entries;
|
||||
expect(Array.isArray(entries)).toBe(true);
|
||||
expect((entries as Array<{ jobId?: unknown }>).at(-1)?.jobId).toBe(jobId);
|
||||
expect((entries as Array<{ summary?: unknown }>).at(-1)?.summary).toBe(
|
||||
"hello",
|
||||
);
|
||||
|
||||
ws.close();
|
||||
await server.close();
|
||||
@@ -654,9 +659,11 @@ describe("gateway server", () => {
|
||||
const last = JSON.parse(line ?? "{}") as {
|
||||
jobId?: unknown;
|
||||
action?: unknown;
|
||||
summary?: unknown;
|
||||
};
|
||||
expect(last.action).toBe("finished");
|
||||
expect(last.jobId).toBe(jobId);
|
||||
expect(last.summary).toBe("hello");
|
||||
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
@@ -675,6 +682,9 @@ describe("gateway server", () => {
|
||||
const entries = (runsRes.payload as { entries?: unknown } | null)?.entries;
|
||||
expect(Array.isArray(entries)).toBe(true);
|
||||
expect((entries as Array<{ jobId?: unknown }>).at(-1)?.jobId).toBe(jobId);
|
||||
expect((entries as Array<{ summary?: unknown }>).at(-1)?.summary).toBe(
|
||||
"hello",
|
||||
);
|
||||
|
||||
ws.close();
|
||||
await server.close();
|
||||
|
||||
@@ -418,6 +418,7 @@ export async function startGatewayServer(
|
||||
action: "finished",
|
||||
status: evt.status,
|
||||
error: evt.error,
|
||||
summary: evt.summary,
|
||||
runAtMs: evt.runAtMs,
|
||||
durationMs: evt.durationMs,
|
||||
nextRunAtMs: evt.nextRunAtMs,
|
||||
|
||||
Reference in New Issue
Block a user