@devries-cameron20 / t3code Mirror · read-only / commits / 70a7cfe5a2
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 09:45 UTC

fix(azure-devops): deleted files appear in the pull request Code tab (#37745)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Alex Vallone committed Nov 16, 2026 at 12:32 UTC 70a7cfe5a20f6ea82f5a5b89fe08da13c468d80f
2 files changed +31 -9
packages/source-control-azure-devops/src/server/azureDevOpsPullRequestJson.test.ts
+22 -4
@@ -317,15 +317,33 @@ describe("decodeIterationChangesJson", () => {
317 item: { path: "/README.md", objectId: "8f80", originalObjectId: "0ca4" },
318 },
319 { changeType: "delete", item: { path: "/OLD.md", originalObjectId: "1111" } },
320 + // Azure names a deleted file only where it came from.
321 + {
322 + changeType: "delete",
323 + originalPath: "/GONE.md",
324 + item: { path: null, objectId: "2222", originalObjectId: "2222" },
325 + },
326 + { changeType: "delete", sourceServerItem: "/src/gone.ts", item: { objectId: null } },
327 + { changeType: "delete", item: { originalObjectId: "3333" } },
328 + { changeType: "edit", originalPath: "/LOST.md", item: { objectId: "4444" } },
329 ],
330 }),
331 ),
332 );
333
325 - expect(page.changes.map((change) => [change.path, change.changeKind])).toEqual([
326 - ["DEMO.md", "new"],
327 - ["README.md", "change"],
328 - ["OLD.md", "deleted"],
334 + expect(
335 + page.changes.map((change) => [
336 + change.path,
337 + change.oldPath,
338 + change.changeKind,
339 + change.objectId,
340 + ]),
341 + ).toEqual([
342 + ["DEMO.md", "DEMO.md", "new", "ec00"],
343 + ["README.md", "README.md", "change", "8f80"],
344 + ["OLD.md", "OLD.md", "deleted", null],
345 + ["GONE.md", "GONE.md", "deleted", null],
346 + ["src/gone.ts", "src/gone.ts", "deleted", null],
347 ]);
348 });
349
packages/source-control-azure-devops/src/server/azureDevOpsPullRequestJson.ts
+9 -5
@@ -579,18 +579,22 @@ export function decodeIterationChangesJson(
579 const decodedChange = decodeChangeEntry(entry);
580 if (Exit.isFailure(decodedChange)) continue;
581 const change = decodedChange.value;
582 - const path = toRepositoryPath(change.item?.path);
582 + // Azure uses either field for renames, depending on route/version.
583 + const sourcePath =
584 + toRepositoryPath(change.sourceServerItem) ?? toRepositoryPath(change.originalPath);
585 + const deleted = toChangeKind(change.changeType, false) === "deleted";
586 + // A deleted file has no `item.path`; only the source fields name it.
587 + const path = toRepositoryPath(change.item?.path) ?? (deleted ? sourcePath : null);
588 if (path === null) continue;
589 if (change.item?.isFolder === true) continue;
590 if ((change.item?.gitObjectType ?? "blob").toLowerCase() !== "blob") continue;
586 - // Azure uses either field for renames, depending on route/version.
587 - const oldPath =
588 - toRepositoryPath(change.sourceServerItem) ?? toRepositoryPath(change.originalPath) ?? path;
591 + const oldPath = sourcePath ?? path;
592 changes.push({
593 path,
594 oldPath,
595 changeKind: toChangeKind(change.changeType, oldPath !== path),
593 - objectId: trimmed(change.item?.objectId),
596 + // Viewed marks read a deleted file at the empty revision, not a blob id.
597 + objectId: deleted ? null : trimmed(change.item?.objectId),
598 originalObjectId: trimmed(change.item?.originalObjectId),
599 });
600 }