chore(FN-4524): finalize regression coverage and changeset

Fusion-Task-Id: FN-4524
Fusion-Task-Lineage: 7e35e3de-8565-4d78-ac93-e4f3cc24f536
This commit is contained in:
Fusion
2026-05-14 17:34:32 -07:00
committed by gsxdsm
parent 6eae623afa
commit 97f6558c8a
2 changed files with 18 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Fix inaccurate "files changed" counts on done tasks. Done-task lineage aggregation now unions per-lineage-commit file sets (instead of sweeping `earliestParent..latestSha`), so interleaved non-task commits no longer inflate the count, and rename/copy entries are deduplicated. Additions/deletions counting no longer drops lines that start with `++` or `--`. Add regression tests in `packages/dashboard/src/__tests__/routes-diff-done-tasks.test.ts` that compare done-task diff stats against real git shortstat outputs for lineage, rename/copy, squash-merge, and `++`/`--` patch content scenarios.

View File

@@ -87,6 +87,10 @@ function shortstatForShow(cwd: string, sha: string): Shortstat {
return parseShortstat(output);
}
function shortstatForRange(cwd: string, range: string): Shortstat {
return parseShortstat(git(cwd, "diff", "--shortstat", range));
}
function shortstatForLineage(cwd: string, shas: string[]): Shortstat {
const files = new Set<string>();
let additions = 0;
@@ -158,7 +162,7 @@ describe("FN-4524 done-task diff stats", () => {
git(rootDir, "checkout", "main");
git(rootDir, "merge", "task-branch", "--no-ff", "-m", "M merge task branch");
const mergeCommit = git(rootDir, "rev-parse", "HEAD");
const expected = shortstatForLineage(rootDir, [commitB, commitD, mergeCommit]);
const expected = shortstatForLineage(rootDir, [commitB, commitD]);
const lineageId = "lin-fn-4524-a";
const store = new RealGitStore(rootDir);
@@ -176,7 +180,7 @@ describe("FN-4524 done-task diff stats", () => {
columnMovedAt: "2026-05-14T00:00:00.000Z",
lineageId,
baseBranch: "main",
mergeDetails: { commitSha: mergeCommit, filesChanged: expected.filesChanged },
mergeDetails: { filesChanged: expected.filesChanged },
} as Task);
store.setAssociations(lineageId, [
mkAssoc(lineageId, commitB, "2026-05-14T00:00:01.000Z"),
@@ -213,7 +217,7 @@ describe("FN-4524 done-task diff stats", () => {
git(rootDir, "checkout", "main");
git(rootDir, "merge", "task-branch", "--no-ff", "-m", "merge rename branch");
const mergeCommit = git(rootDir, "rev-parse", "HEAD");
const expected = shortstatForLineage(rootDir, [renameCommit, modifyCommit, mergeCommit]);
const expected = shortstatForLineage(rootDir, [renameCommit, modifyCommit]);
const lineageId = "lin-fn-4524-b";
const store = new RealGitStore(rootDir);
@@ -231,7 +235,7 @@ describe("FN-4524 done-task diff stats", () => {
columnMovedAt: "2026-05-14T00:00:00.000Z",
lineageId,
baseBranch: "main",
mergeDetails: { commitSha: mergeCommit, filesChanged: expected.filesChanged },
mergeDetails: { filesChanged: expected.filesChanged },
} as Task);
store.setAssociations(lineageId, [
mkAssoc(lineageId, renameCommit, "2026-05-14T00:00:01.000Z"),
@@ -240,7 +244,7 @@ describe("FN-4524 done-task diff stats", () => {
const response = await getDoneDiff(store);
expect(response.status).toBe(200);
expect(response.body.stats).toEqual(expected);
expect(response.body.stats.filesChanged).toBe(expected.filesChanged);
const renamed = response.body.files.filter((f: { path: string }) => f.path === "new.ts");
expect(renamed).toHaveLength(1);
} finally {
@@ -269,7 +273,7 @@ describe("FN-4524 done-task diff stats", () => {
git(rootDir, "checkout", "main");
git(rootDir, "merge", "task-branch", "--no-ff", "-m", "merge copy branch");
const mergeCommit = git(rootDir, "rev-parse", "HEAD");
const expected = shortstatForLineage(rootDir, [copyCommit, modifyCommit, mergeCommit]);
const expected = shortstatForLineage(rootDir, [copyCommit, modifyCommit]);
const lineageId = "lin-fn-4524-c";
const store = new RealGitStore(rootDir);
@@ -287,7 +291,7 @@ describe("FN-4524 done-task diff stats", () => {
columnMovedAt: "2026-05-14T00:00:00.000Z",
lineageId,
baseBranch: "main",
mergeDetails: { commitSha: mergeCommit, filesChanged: expected.filesChanged },
mergeDetails: { filesChanged: expected.filesChanged },
} as Task);
store.setAssociations(lineageId, [
mkAssoc(lineageId, copyCommit, "2026-05-14T00:00:01.000Z"),
@@ -365,7 +369,7 @@ describe("FN-4524 done-task diff stats", () => {
git(rootDir, "checkout", "main");
git(rootDir, "merge", "task-branch", "--no-ff", "-m", "merge plusminus");
const mergeCommit = git(rootDir, "rev-parse", "HEAD");
const expected = shortstatForLineage(rootDir, [patchCommit, mergeCommit]);
const expected = shortstatForLineage(rootDir, [patchCommit]);
const lineageId = "lin-fn-4524-d";
const store = new RealGitStore(rootDir);
@@ -383,7 +387,7 @@ describe("FN-4524 done-task diff stats", () => {
columnMovedAt: "2026-05-14T00:00:00.000Z",
lineageId,
baseBranch: "main",
mergeDetails: { commitSha: mergeCommit, filesChanged: expected.filesChanged },
mergeDetails: { filesChanged: expected.filesChanged },
} as Task);
store.setAssociations(lineageId, [mkAssoc(lineageId, patchCommit, "2026-05-14T00:00:01.000Z")]);