graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Pin worktree isolation defaults and keep non-git tests off the repo
Cursor Agent6c2d12f5349b
diff --git a/src/acp_engine.zig b/src/acp_engine.zigindex 48687f25..f931e38c 100644--- a/src/acp_engine.zig+++ b/src/acp_engine.zig@@ -235,7 +235,7 @@ test "in-process handleLine speaks the same initialize / new / prompt envelopes"test "session/new reports an isolated checkout when Dispatch.cwd is set" {var state = std.heap.ArenaAllocator.init(std.testing.allocator);defer state.deinit();- var buf: [2048]u8 = undefined;+ var buf: [16384]u8 = undefined;var w: Io.Writer = .fixed(&buf);var d: Dispatch = .{ .turn = echoTurn, .ctx = undefined, .seed = 0x11, .cwd = "/repo/.graff/worktrees/session-1" };try handleLine(&d, state.allocator(), &w, "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"session/new\"}");diff --git a/src/schema.zig b/src/schema.zigindex 7bb75486..27c74696 100644--- a/src/schema.zig+++ b/src/schema.zig@@ -557,3 +557,10 @@ test "subagent_spec: run_in_background is a boolean, optional (not in required),const required = parsed.value.object.get("required").?.array.items;for (required) |r| try std.testing.expect(!std.mem.eql(u8, r.string, "run_in_background"));}++test "subagent_spec: independent fan-out defaults to worktree, not shared_cwd" {+ try std.testing.expect(std.mem.indexOf(u8, subagent_spec.schema, "default to \"worktree\"") != null);+ try std.testing.expect(std.mem.indexOf(u8, subagent_spec.schema, "Default shared_cwd") == null);+ try std.testing.expect(std.mem.indexOf(u8, workflow_spec.schema, "fan-out tasks default to \"worktree\"") != null);+ try std.testing.expect(std.mem.indexOf(u8, workflow_spec.schema, "pipeline stages default to \"shared_cwd\"") != null);+}diff --git a/src/shapes.zig b/src/shapes.zigindex 306e358a..778c221f 100644--- a/src/shapes.zig+++ b/src/shapes.zig@@ -276,15 +276,11 @@ test "#382: shape F carries the contract that separates a concept fleet from a r}test "shape catalog never tells a dependent chain to isolate into worktrees" {- // Regression guard for the worst bug the catalog's own first review found.- // It used to say "give file-editing tasks isolation:worktree so they cannot- // collide". Every task gets its OWN worktree branched from HEAD, so on a- // dependent chain (transform -> verify, implement -> review) the later stage- // read the ORIGINAL file: a workflow could report a successful implement +- // review while the edits never reached the caller's tree at all.- try std.testing.expect(std.mem.indexOf(u8, shape_catalog_note, "IN PARALLEL") != null);- try std.testing.expect(std.mem.indexOf(u8, shape_catalog_note, "Never set it on a dependent chain") != null);- // The old unconditional phrasing must not come back.+ // Fan-out defaults to worktree. Same-branch / pipeline stages must stay+ // on shared_cwd so later stages see earlier edits (#295).+ try std.testing.expect(std.mem.indexOf(u8, shape_catalog_note, "default to isolation:\"worktree\"") != null);+ try std.testing.expect(std.mem.indexOf(u8, shape_catalog_note, "shared_cwd\" only for same-branch") != null);+ try std.testing.expect(std.mem.indexOf(u8, shape_catalog_note, "pipeline stages") != null);try std.testing.expect(std.mem.indexOf(u8, shape_catalog_note, "Give file-editing tasks isolation") == null);}diff --git a/src/task_workspace.zig b/src/task_workspace.zigindex 51d9ea10..9d7cacf7 100644--- a/src/task_workspace.zig+++ b/src/task_workspace.zig@@ -441,13 +441,14 @@ test "create: non-git folder is not a task workspace" {if (builtin.os.tag == .windows) return error.SkipZigTest;const a = std.testing.allocator;const io = std.testing.io;- var tmp = std.testing.tmpDir(.{});- defer tmp.cleanup();- const tmp_root = try tmp.dir.realPathFileAlloc(io, ".", a);- defer a.free(tmp_root);+ // std.testing.tmpDir lives inside this repo's cache, so git walks up to it.+ const root = try std.fmt.allocPrint(a, "/tmp/graff-nongit-{d}", .{std.time.milliTimestamp()});+ defer a.free(root);+ try Io.Dir.cwd().createDirPath(io, root);+ defer Io.Dir.cwd().deleteTree(io, root) catch {};var arena = std.heap.ArenaAllocator.init(a);defer arena.deinit();- try std.testing.expectError(error.NotAGitRepo, create(a, io, arena.allocator(), .{ .slug = "x", .cwd = tmp_root }));+ try std.testing.expectError(error.NotAGitRepo, create(a, io, arena.allocator(), .{ .slug = "x", .cwd = root }));try std.testing.expect(std.mem.indexOf(u8, createFailureText(error.NotAGitRepo), "plain folder") != null);}