|
5 | 5 | EventId, |
6 | 6 | MessageId, |
7 | 7 | NodeId, |
| 8 | + OrchestrationV2ThreadArtifactId, |
8 | 9 | type OrchestrationV2AppThread, |
9 | 10 | type OrchestrationV2Run, |
10 | 11 | ProjectId, |
@@ -1408,3 +1409,37 @@ it.effect("startup ends the provider turn of a native child root it cancels", () |
1408 | 1409 | ); |
1409 | 1410 | }).pipe(Effect.provide(layerRecoveryTest)), |
1410 | 1411 | ); |
| 1412 | + |
| 1413 | +it.effect("marks threads with corrupt artifact payloads unreadable", () => |
| 1414 | + Effect.gen(function* () { |
| 1415 | + const projections = yield* ProjectionStore.ProjectionStoreV2; |
| 1416 | + const sql = yield* SqlClient.SqlClient; |
| 1417 | + const now = yield* DateTime.now; |
| 1418 | + const threadId = yield* createThread("artifact-corrupt"); |
| 1419 | + |
| 1420 | + yield* projections.apply({ |
| 1421 | + id: EventId.make("event:artifact-corrupt:updated"), |
| 1422 | + type: "artifact.updated", |
| 1423 | + threadId, |
| 1424 | + occurredAt: now, |
| 1425 | + payload: { |
| 1426 | + id: OrchestrationV2ThreadArtifactId.make("artifact:recovery:1"), |
| 1427 | + kind: "file", |
| 1428 | + title: "Artifact", |
| 1429 | + description: null, |
| 1430 | + payload: { path: "/tmp/out.txt" }, |
| 1431 | + runId: null, |
| 1432 | + messageId: null, |
| 1433 | + createdAt: now, |
| 1434 | + updatedAt: now, |
| 1435 | + }, |
| 1436 | + }); |
| 1437 | + |
| 1438 | + assert.deepEqual(yield* projections.getUnreadableThreadIds(), []); |
| 1439 | + yield* sql` |
| 1440 | + UPDATE orchestration_v2_projection_artifacts SET payload_json = '{}' |
| 1441 | + WHERE artifact_id = ${"artifact:recovery:1"} |
| 1442 | + `; |
| 1443 | + assert.deepEqual(yield* projections.getUnreadableThreadIds(), [threadId]); |
| 1444 | + }).pipe(Effect.provide(layerTest)), |
| 1445 | +); |
0 commit comments