feat(FN-2915): merge fusion/fn-2915
- feat(FN-2915): include github issue refs in commit workflows - refactor(dashboard): simplify setup wizard manual step - fix(engine): prevent phantom merges when verification fix runs without a commit Fusion-Task-Id: FN-2915
This commit is contained in:
@@ -2417,6 +2417,28 @@ describe("buildExecutionPrompt", () => {
|
||||
expect(result).toContain("do not defer them to a separate task");
|
||||
});
|
||||
|
||||
it("includes source issue reference in commit instruction when task has github sourceIssue", () => {
|
||||
const task = createMockTaskDetail({
|
||||
sourceIssue: {
|
||||
provider: "github",
|
||||
repository: "runfusion/fusion",
|
||||
externalIssueId: "2915",
|
||||
issueNumber: 2915,
|
||||
},
|
||||
} as any);
|
||||
|
||||
const result = buildExecutionPrompt(task, "/home/user/project");
|
||||
expect(result).toContain('git commit -m "feat(FN-001): complete Step N — description" -m "Ref: runfusion/fusion#2915"');
|
||||
});
|
||||
|
||||
it("omits source issue reference from commit instruction when sourceIssue is missing", () => {
|
||||
const task = createMockTaskDetail();
|
||||
const result = buildExecutionPrompt(task, "/home/user/project");
|
||||
|
||||
expect(result).toContain('git commit -m "feat(FN-001): complete Step N — description"');
|
||||
expect(result).not.toContain(' -m "Ref:');
|
||||
});
|
||||
|
||||
it("omits Project Commands section when neither command is set", () => {
|
||||
const task = createMockTaskDetail();
|
||||
const result = buildExecutionPrompt(task, "/home/user/project", {} as any);
|
||||
|
||||
@@ -5194,6 +5194,34 @@ describe("aiMergeTask — fresh session and compaction recovery", () => {
|
||||
|
||||
// ── Merge Prompt Truncation Tests ─────────────────────────────────────
|
||||
|
||||
describe("buildSourceIssueRef", () => {
|
||||
it("returns owner/repo#number for GitHub source issues", async () => {
|
||||
const { buildSourceIssueRef } = await import("../merger.js");
|
||||
expect(buildSourceIssueRef({
|
||||
provider: "github",
|
||||
repository: "runfusion/fusion",
|
||||
externalIssueId: "123",
|
||||
issueNumber: 123,
|
||||
})).toBe("runfusion/fusion#123");
|
||||
});
|
||||
|
||||
it("returns empty string for non-GitHub providers", async () => {
|
||||
const { buildSourceIssueRef } = await import("../merger.js");
|
||||
expect(buildSourceIssueRef({
|
||||
provider: "gitlab",
|
||||
repository: "group/project",
|
||||
externalIssueId: "123",
|
||||
issueNumber: 123,
|
||||
})).toBe("");
|
||||
});
|
||||
|
||||
it("returns empty string for nullish source issue", async () => {
|
||||
const { buildSourceIssueRef } = await import("../merger.js");
|
||||
expect(buildSourceIssueRef(undefined)).toBe("");
|
||||
expect(buildSourceIssueRef(null)).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildMergePrompt — truncation behavior", () => {
|
||||
it("truncates commit log when exceeding MERGE_COMMIT_LOG_MAX_CHARS", async () => {
|
||||
const { buildMergePrompt } = await import("../merger.js");
|
||||
@@ -5331,6 +5359,37 @@ describe("buildMergePrompt — truncation behavior", () => {
|
||||
|
||||
expect(prompt).not.toContain("Be sure to include");
|
||||
});
|
||||
|
||||
it("includes source issue reference guidance when provided", async () => {
|
||||
const { buildMergePrompt } = await import("../merger.js");
|
||||
|
||||
const prompt = buildMergePrompt({
|
||||
taskId: "FN-001",
|
||||
branch: "fusion/fn-001",
|
||||
commitLog: "- feat: something",
|
||||
diffStat: "1 file changed",
|
||||
hasConflicts: false,
|
||||
sourceIssueRef: "runfusion/fusion#2915",
|
||||
});
|
||||
|
||||
expect(prompt).toContain("Include this in the commit message body:");
|
||||
expect(prompt).toContain("Ref: runfusion/fusion#2915");
|
||||
});
|
||||
|
||||
it("omits source issue reference guidance when not provided", async () => {
|
||||
const { buildMergePrompt } = await import("../merger.js");
|
||||
|
||||
const prompt = buildMergePrompt({
|
||||
taskId: "FN-001",
|
||||
branch: "fusion/fn-001",
|
||||
commitLog: "- feat: something",
|
||||
diffStat: "1 file changed",
|
||||
hasConflicts: false,
|
||||
});
|
||||
|
||||
expect(prompt).not.toContain("Include this in the commit message body:");
|
||||
expect(prompt).not.toContain("Ref: runfusion/fusion#2915");
|
||||
});
|
||||
});
|
||||
|
||||
// ── Context Limit Recovery Tests ─────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user