FN-5644: default AI merge commit body to summarize changes

Fusion-Task-Id: FN-5644

Fusion-Task-Lineage: 5cf0133b-2a14-4bb4-a1c4-2d5bef5793bc
This commit is contained in:
gsxdsm
2026-05-28 23:45:40 -07:00
parent 6c44ed16e7
commit 230efa1cdc
7 changed files with 50 additions and 9 deletions

View File

@@ -8,6 +8,7 @@ import {
landSquash,
parseReviewVerdict,
buildMergeSystemPrompt,
buildMergePrompt,
buildReviewSystemPrompt,
REVIEW_VERDICT_MARKER,
AiMergeBlockedError,
@@ -116,9 +117,11 @@ describe("parseReviewVerdict", () => {
expect(buildMergeSystemPrompt().toLowerCase()).toContain("conflict");
});
it("merge system prompt enforces new-breakage verification + uses the editable merger prompt", () => {
it("merge system prompt enforces new-breakage verification + commit body summary guidance", () => {
expect(buildMergeSystemPrompt().toLowerCase()).toContain("type-check");
expect(buildMergeSystemPrompt()).toMatch(/new failure/i);
expect(buildMergeSystemPrompt()).toMatch(/bullet list of key changes/i);
expect(buildMergeSystemPrompt()).toMatch(/Files changed:/i);
// A custom 'merger' role prompt is incorporated as the base, while the hard
// rules (verification + trailers) are still appended.
const cfg = {
@@ -129,6 +132,23 @@ describe("parseReviewVerdict", () => {
expect(p).toContain("CUSTOM MERGER PERSONA");
expect(p).toContain("Verify before committing");
});
it("merge prompt requires subject, body summary, and diff-stat in commit message", () => {
const prompt = buildMergePrompt({
taskId: "FN-1",
branch: "fusion/fn-1",
integrationBranch: "main",
tipSha: "0123456789abcdef0123456789abcdef01234567",
taskTitle: "Do the thing",
includeTaskId: true,
trailers: ["Fusion-Task-Id: FN-1"],
});
expect(prompt).toMatch(/Build a merge body from the staged squash diff/i);
expect(prompt).toMatch(/bullet list of key changes/i);
expect(prompt).toMatch(/Files changed:/i);
expect(prompt).toMatch(/git diff --stat/i);
expect(prompt).toMatch(/git commit -m "FN-1: <concise imperative summary of the squashed changes>" -m/i);
});
});
describe("runAiMerge", () => {