refactor(app): introduce attachment storage layer and draft lifecycle management
Replace inline data-URL image handling with a persistent attachment storage service, add draft lifecycle states (active/abandoned/sent) with generation tracking, and update fetchAgent to return project placement alongside agent snapshots.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildDraftStoreKey } from "./draft-keys";
|
||||
|
||||
describe("buildDraftStoreKey", () => {
|
||||
it("isolates agent drafts by server and agent ids", () => {
|
||||
const keyA = buildDraftStoreKey({
|
||||
serverId: "server-a",
|
||||
agentId: "agent-1",
|
||||
});
|
||||
const keyB = buildDraftStoreKey({
|
||||
serverId: "server-b",
|
||||
agentId: "agent-1",
|
||||
});
|
||||
const keyC = buildDraftStoreKey({
|
||||
serverId: "server-a",
|
||||
agentId: "agent-2",
|
||||
});
|
||||
|
||||
expect(keyA).not.toBe(keyB);
|
||||
expect(keyA).not.toBe(keyC);
|
||||
expect(keyB).not.toBe(keyC);
|
||||
});
|
||||
|
||||
it("uses draftId keyspace for create flow drafts", () => {
|
||||
const key = buildDraftStoreKey({
|
||||
serverId: "server-a",
|
||||
agentId: "__new_agent__",
|
||||
draftId: "draft-123",
|
||||
});
|
||||
|
||||
expect(key).toBe("draft:server-a:draft-123");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user