Implement retry semantics: requestIdToNodeKey reverse map, setRequestId method, full-history getEvents

This commit is contained in:
2026-05-21 22:10:31 +00:00
parent 3b52998f20
commit d63a301cea
2 changed files with 52 additions and 31 deletions

View File

@@ -159,7 +159,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -177,7 +177,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -201,7 +201,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -225,7 +225,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -265,7 +265,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
const respondedEvent: CallEventMapValue = {
type: "call.responded",
@@ -304,7 +304,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -353,7 +353,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -380,7 +380,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -408,7 +408,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -434,7 +434,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -452,7 +452,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-2");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -466,6 +466,7 @@ describe("WorkflowReactiveRoot", () => {
error: { code: "ERR", message: "first attempt failed" },
timestamp: "2026-01-01T00:00:01Z",
});
root.setRequestId("a", "req-2");
root.append({
type: "call.requested",
requestId: "req-2",
@@ -503,7 +504,7 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-1");
root.setRequestId("a", "req-1");
root.append({
type: "call.requested",
requestId: "req-1",
@@ -840,9 +841,9 @@ describe("WorkflowReactiveRoot", () => {
const graph = makeSimpleGraph();
const root = new WorkflowReactiveRoot(graph);
root.nodeKeyToRequestId.set("a", "req-a");
root.nodeKeyToRequestId.set("b", "req-b");
root.nodeKeyToRequestId.set("c", "req-c");
root.setRequestId("a", "req-a");
root.setRequestId("b", "req-b");
root.setRequestId("c", "req-c");
expect(root.getStatus("a")).toBe("idle");
expect(root.getStatus("b")).toBe("idle");