The platform for continuously improving AI agents.
// covers: console-logic
import { expect, it } from "vitest";
import type { EditorBlock } from "./canvas-document";
import type { NodeReceipt } from "./document";
import { nodeSummary } from "./node-summary";
const block: EditorBlock = {
arguments: "{}",
id: "train",
kind: "train",
notes: "",
parameters: "{}",
position: { x: 0, y: 0 },
title: "Adapt the model",
tool: "training",
};
const receipt: NodeReceipt = {
action: "action",
arguments: {},
completed_at: null,
current: true,
identity: "identity",
node: "train",
outputs: {},
result: { accuracy: 0.99 },
revision: 1,
started_at: null,
state: "completed",
tool: "training",
};
it("reports a retained checkpoint without treating execution as model quality", () => {
expect(nodeSummary(block, receipt)).toBe("Model training");
expect(
nodeSummary(block, {
...receipt,
outputs: { model: { checkpoint: { step: 40 }, kind: "model", model: "Qwen/Qwen3" } },
})
).toBe("Qwen/Qwen3 · checkpoint 40");
});
it("does not present an outdated artifact as the current result", () => {
expect(
nodeSummary(
{ ...block, kind: "predict" },
{
...receipt,
current: false,
outputs: { predictions: { artifact: "old", kind: "predictions" } },
}
)
).toBe("Model predictions");
});
it("reports emitted partition roles and sealed final data only when observed", () => {
expect(
nodeSummary(
{ ...block, kind: "split" },
{ ...receipt, outputs: { final: { kind: "data", sealed: true }, train: { kind: "data" } } }
)
).toBe("train / final · sealed");
});