Align tests with gm-first context projection and retry snapshot semantics.
History synthesis expects world-simulator slot; retryStuckRun compares artifact count against checkpoint baseline. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -88,27 +88,29 @@ describe("flat context order", () => {
|
||||
const doc = synthesizeContextOrderFromWorkers(
|
||||
[
|
||||
{
|
||||
ref: "narrator",
|
||||
name: "叙事转述",
|
||||
ref: "world-simulator",
|
||||
name: "主世界层",
|
||||
context: {
|
||||
static: ["设计.叙事指南"],
|
||||
dynamic: ["运行.本轮.裁决", "用户.最新输入"],
|
||||
dynamic: ["用户.最新输入"],
|
||||
},
|
||||
},
|
||||
],
|
||||
{ gm: true, narrator: true, perspective: false },
|
||||
)!;
|
||||
expect(doc.slots[0]!.inserts.some((i) => i.ref === "对话.历史")).toBe(true);
|
||||
const gmSlot = doc.slots.find((s) => s.ref === "world-simulator")!;
|
||||
expect(gmSlot.inserts.some((i) => i.ref === "对话.历史")).toBe(true);
|
||||
|
||||
const histIdx = doc.slots[0]!.inserts.findIndex((i) => i.ref === "对话.历史");
|
||||
const histIdx = gmSlot.inserts.findIndex((i) => i.ref === "对话.历史");
|
||||
const moved = applyContextOrderEdit(doc, {
|
||||
action: "set_anchor",
|
||||
slotRef: "narrator",
|
||||
index: doc.slots[0]!.inserts.length - 1,
|
||||
slotRef: "world-simulator",
|
||||
index: gmSlot.inserts.length - 1,
|
||||
anchor: "pre_history",
|
||||
});
|
||||
const newHist = moved.slots[0]!.inserts.findIndex((i) => i.ref === "对话.历史");
|
||||
const lastUser = moved.slots[0]!.inserts.findIndex(
|
||||
const movedGm = moved.slots.find((s) => s.ref === "world-simulator")!;
|
||||
const newHist = movedGm.inserts.findIndex((i) => i.ref === "对话.历史");
|
||||
const lastUser = movedGm.inserts.findIndex(
|
||||
(i) => i.ref === "用户.最新输入",
|
||||
);
|
||||
expect(lastUser).toBeLessThan(newHist);
|
||||
|
||||
@@ -108,7 +108,7 @@ describe("phase runtime", () => {
|
||||
);
|
||||
const snap = runtime.getLastWorkerRunSnapshot();
|
||||
expect(snap?.workerId).toBe("design-flow");
|
||||
const artifactsBefore = runtime.getSession().artifacts.length;
|
||||
const artifactsAtSnapshot = snap!.runtimeSession.artifacts.length;
|
||||
|
||||
const session = runtime.getSession();
|
||||
session.phase = "running";
|
||||
@@ -116,10 +116,12 @@ describe("phase runtime", () => {
|
||||
session.currentWorkerId = "design-flow";
|
||||
|
||||
await runtime.retryStuckRun();
|
||||
expect(runtime.getSession().artifacts.length).toBeGreaterThan(artifactsBefore);
|
||||
expect(runtime.getSession().artifacts.length).toBeGreaterThan(
|
||||
artifactsAtSnapshot,
|
||||
);
|
||||
expect(
|
||||
runtime.getSession().artifacts.filter((a) => a.workerId === "design-flow").length,
|
||||
).toBeGreaterThanOrEqual(2);
|
||||
).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
|
||||
it("retryStuckRun throws when nothing is running", async () => {
|
||||
|
||||
Reference in New Issue
Block a user