Skip to content

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

Python

test(native): cover retained worktree path wrapping

yxlyxdca88f19673b
diff --git a/apps/native/app/visual-tests/overflow/overflow-fixture.tsx b/apps/native/app/visual-tests/overflow/overflow-fixture.tsx
index d2a0e6ed..ab2faca0 100644
--- a/apps/native/app/visual-tests/overflow/overflow-fixture.tsx
+++ b/apps/native/app/visual-tests/overflow/overflow-fixture.tsx
@@ -11,6 +11,7 @@ const cases = ["all", "url", "prose", "inline-path", "nested", "table", "fence",
type Case = typeof cases[number];
const token = "UnbrokenDiagnosticPayload".repeat(32);
const path = `fixtures/${"deeply-nested-module/".repeat(18)}${"long-component-name-".repeat(12)}fixture.tsx:128-256`;
+const worktreePath = `/Users/example/codegraff/.worktrees/${"agent-overflow-regression-".repeat(14)}checkout`;
const url = `https://example.com/artifacts/overflow-fixture/builds/${"release-candidate-".repeat(20)}report?filter=${"diagnostic%2F".repeat(35)}&view=expanded#final-result`;
const codeLine = `const diagnostic = "${token}"; // FENCE_END`;
const openFence = `## CASE: stream\n\nAn incomplete fence grows in explicit steps.\n\n\`\`\`typescript\nconst streamed = "`;
@@ -32,7 +33,7 @@ function makeTurn(name: Exclude<Case, "all" | "user">, step: number): AssistantT
turn.text = `## CASE: prose\n\n${token}\n\nPROSE_END`;
break;
case "inline-path":
- turn.text = `## CASE: inline-path\n\nOpen \`${path}\` and inspect the entire path.\n\nAlso non-path inline code: \`${token}\`.\n\nPATH_END`;
+ turn.text = `## CASE: inline-path\n\nOpen \`${path}\` and inspect the entire path.\n\nWorktree kept: ${worktreePath} WORKTREE_PATH_END\n\nAlso non-path inline code: \`${token}\`.\n\nPATH_END`;
break;
case "nested":
turn.text = `## CASE: nested\n\n1. Outer ordered item\n - Inner bullet ${token}\n - Deep link [${url}](${url})\n\n> A quoted diagnostic\n>\n> - Nested quoted item \`${path}\`\n> - ${token}\n\nNESTED_END`;
diff --git a/apps/native/electron/chat-overflow-edge-visual.cjs b/apps/native/electron/chat-overflow-edge-visual.cjs
index bf6c4b48..a585b663 100644
--- a/apps/native/electron/chat-overflow-edge-visual.cjs
+++ b/apps/native/electron/chat-overflow-edge-visual.cjs
@@ -49,6 +49,14 @@ async function runOverflowEdges({ win, origin }) {
if (name === 'inline-path') {
await js(`document.querySelector('[data-overflow-scroller="left"] code[title]').click()`);
assert.equal(await js(`document.querySelector('[data-overflow-path-opened="left"]').textContent`), 'Path clicked');
+ const worktreeWrapped = await js(`Array.from(document.querySelectorAll('[data-chat-transcript]'), e => {
+ const paragraph = Array.from(e.querySelectorAll('p')).find(p => p.textContent.includes('WORKTREE_PATH_END'));
+ if (!paragraph) return false;
+ const range = document.createRange(); range.selectNodeContents(paragraph);
+ const bounds = e.getBoundingClientRect(), rects = Array.from(range.getClientRects()).filter(r => r.width);
+ return rects.length > 1 && rects.every(r => r.left >= bounds.left - 1 && r.right <= bounds.right + 1);
+ })`);
+ assert.deepEqual(worktreeWrapped, [true, true], `${width}px/inline-path: long .worktrees path wraps inside each transcript`);
}
if (name === 'table' || name === 'fence') {
const local = await js(`Array.from(document.querySelectorAll('[data-chat-transcript]'), e => {