fix: preserve staged and unstaged changes per file (#3104)

This commit is contained in:
José Almeida
2026-08-30 13:26:18 +00:00
committed by GitHub
parent c946140812
commit cc2ee0b43d
48 changed files with 2075 additions and 112 deletions
@@ -2,6 +2,7 @@ import { describe, it, expect } from "vitest";
import {
buildPrByRepoMap,
computeReviewProgress,
mapToChangedFiles,
mapPRFilesToChangedFiles,
selectPRFilesForReviewProgress,
type ReviewProgressPRFile,
@@ -12,6 +13,27 @@ import type { PRDiffFile } from "@/lib/types/github";
const PRIMARY_PR_ID = "primary-pr";
const RENAMED_PATH = "src/renamed.ts";
describe("mapToChangedFiles", () => {
it("preserves a projected mixed-change layer", () => {
expect(
mapToChangedFiles([
{
path: "src/mixed.ts",
status: "modified",
staged: true,
change_layer: "staged",
},
]),
).toEqual([
expect.objectContaining({
path: "src/mixed.ts",
staged: true,
changeLayer: "staged",
}),
]);
});
});
function diffFile(overrides: Partial<PRDiffFile>): PRDiffFile {
return {
filename: "src/app.ts",