graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Encode composer scope keys without collisions
yxlyx70d2ef65068a
diff --git a/gui/src/app/sessionSnapshot.test.ts b/gui/src/app/sessionSnapshot.test.tsindex 2a3adeb5..0772eeaa 100644--- a/gui/src/app/sessionSnapshot.test.ts+++ b/gui/src/app/sessionSnapshot.test.ts@@ -7,8 +7,15 @@ test("conversation draft keys are scoped by workspace and conversation", () => {const second = getPromptDraftKey("/workspace/second", "shared-id");expect(first).not.toBe(second);- expect(first).toBe("conversation:/workspace/first::shared-id");- expect(second).toBe("conversation:/workspace/second::shared-id");+ expect(first).toBe('conversation:["/workspace/first","shared-id"]');+ expect(second).toBe('conversation:["/workspace/second","shared-id"]');+});++test("conversation draft keys cannot collide through delimiter-like values", () => {+ const first = getPromptDraftKey("/workspace/a::chat", "b");+ const second = getPromptDraftKey("/workspace/a", "chat::b");++ expect(first).not.toBe(second);});test("workspace-only drafts retain their workspace scope", () => {diff --git a/gui/src/app/sessionSnapshot.ts b/gui/src/app/sessionSnapshot.tsindex 1402e1a1..dfc0e6e3 100644--- a/gui/src/app/sessionSnapshot.ts+++ b/gui/src/app/sessionSnapshot.ts@@ -10,7 +10,7 @@ function getConversationDraftKey(workspacePath: string | null | undefined,conversationId: string,): string {- return `conversation:${workspacePath ?? ""}::${conversationId}`+ return `conversation:${JSON.stringify([workspacePath ?? null, conversationId])}`}export function getWorkspaceDraftKey(workspacePath: string): string {diff --git a/gui/src/components/PromptInputCard.navigation.test.tsx b/gui/src/components/PromptInputCard.navigation.test.tsxindex a81cdd2c..bb43166b 100644--- a/gui/src/components/PromptInputCard.navigation.test.tsx+++ b/gui/src/components/PromptInputCard.navigation.test.tsx@@ -274,18 +274,18 @@ test("scope round trips cannot revive an earlier cursor or attachment snapshot",}});-test("same conversation ids keep attachments isolated across workspaces", () => {+test("delimiter-like scope values keep attachments isolated", () => {const firstAttachment = image("/images/workspace-first.png");const secondAttachment = image("/images/workspace-second.png");const composer = mountComposer({bindings: {first: {- conversationId: "shared-conversation",- workspacePath: "/workspace/first",+ conversationId: "b",+ workspacePath: "/workspace/a::chat",},second: {- conversationId: "shared-conversation",- workspacePath: "/workspace/second",+ conversationId: "chat::b",+ workspacePath: "/workspace/a",},},histories: { first: [], second: [] },