Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Keep cwd "." on the pre-1092 relative claim ledger

justrach4a501aa177d9
diff --git a/src/artifact_claim.zig b/src/artifact_claim.zig
index 868db919..c43dc1c9 100644
--- a/src/artifact_claim.zig
+++ b/src/artifact_claim.zig
@@ -283,6 +283,7 @@ pub fn handleToolIn(arena: Allocator, io: Io, action: []const u8, kind_s: []cons
fn persistPath(io: Io, arena: Allocator, cwd: []const u8) ?[]const u8 {
if (g_persist_path) |p| return p;
if (builtin.is_test and !g_test_resolve_cwd) return null;
+ if (cwd.len == 0 or std.mem.eql(u8, cwd, ".")) return persist_rel;
if (claim_path.canonicalFile(arena, io, cwd)) |p| return p;
if (builtin.is_test) return null;
return persist_rel;
@@ -316,7 +317,7 @@ fn mergeLegacyFile(io: Io, arena: Allocator, ledger: *Ledger, path: []const u8)
fn loadTransaction(io: Io, tx: @import("repo_transaction.zig").Transaction, ledger: *Ledger, cwd: []const u8) !void {
if (try tx.read()) |text| try loadJson(tx.arena, ledger, text);
if (builtin.is_test and !g_test_resolve_cwd) return;
- if (cwd.len == 0) return;
+ if (cwd.len == 0 or std.mem.eql(u8, cwd, ".")) return;
const legacy = claim_path.legacyFile(tx.arena, cwd) orelse return;
if (!claim_path.samePath(legacy, tx.path)) mergeLegacyFile(io, tx.arena, ledger, legacy);
}
diff --git a/src/artifact_claim_path.zig b/src/artifact_claim_path.zig
index c4ceb5a4..24318d32 100644
--- a/src/artifact_claim_path.zig
+++ b/src/artifact_claim_path.zig
@@ -89,7 +89,7 @@ test "canonicalFile is identical across linked worktrees of one repo" {
const pa = canonicalFile(ar, io, root) orelse return error.TestUnexpectedResult;
const pb = canonicalFile(ar, io, other) orelse return error.TestUnexpectedResult;
try std.testing.expectEqualStrings(pa, pb);
- try std.testing.expect(std.mem.endsWith(u8, pa, "artifact-claims.json"));
+ try std.testing.expect(std.mem.endsWith(u8, pa, persist_rel));
const other_repo = try std.fmt.allocPrint(a, "{s}/other", .{tmp_root});
defer a.free(other_repo);
try Io.Dir.cwd().createDirPath(io, other_repo);