feat(FN-3280): harden reviewState persistence, API, and PR feedback sync

Merges reviewState hardening (FN-3280 steps 2-3: hardened persistence, API fixes, and PR feedback sync), stepIndex reconciliation for task updates (FN-3757), roadmap route context extraction into the fusion-plugin-roadmap plugin (FN-3160), and shared state snapshots for mesh sync with autostash hard

Fusion-Task-Id: FN-3280
This commit is contained in:
Fusion
2026-05-08 16:23:10 -07:00
committed by gsxdsm
parent d487eeaf36
commit 60962765bf
17 changed files with 136 additions and 47 deletions

View File

@@ -213,6 +213,12 @@ describe("PrCommentHandler", () => {
expect.objectContaining({ source: "github-pr", status: "queued" }),
]),
}),
reviewState: expect.objectContaining({
source: "pull-request",
items: expect.arrayContaining([
expect.objectContaining({ source: "github-pr", body: "Please add tests" }),
]),
}),
}),
);
expect(mockStore.moveTask).toHaveBeenCalledWith("FN-001", "in-progress");

View File

@@ -281,6 +281,29 @@ Please review the PR comments and address any remaining issues.`;
nextItems.push(nextItem);
}
const currentReviewState = task.reviewState ?? {
source: "pull-request" as const,
items: [],
addressing: [],
};
const existingReviewStateIndex = currentReviewState.items.findIndex((item) => item.id === itemId);
const nextReviewStateItem = {
id: itemId,
githubCommentId: comment.id,
body: comment.body,
author: { login: comment.user.login },
createdAt: comment.created_at,
updatedAt: now,
htmlUrl: comment.html_url,
source: "github-pr" as const,
};
const nextReviewStateItems = [...currentReviewState.items];
if (existingReviewStateIndex >= 0) {
nextReviewStateItems[existingReviewStateIndex] = { ...nextReviewStateItems[existingReviewStateIndex], ...nextReviewStateItem };
} else {
nextReviewStateItems.push(nextReviewStateItem);
}
await this.store.updateTask(taskId, {
review: {
...current,
@@ -290,6 +313,12 @@ Please review the PR comments and address any remaining issues.`;
latestRefreshAt: now,
items: nextItems,
},
reviewState: {
...currentReviewState,
source: "pull-request",
summary: currentReviewState.summary,
items: nextReviewStateItems,
},
});
}
}