Files
fusion/packages/core/src/task-helpers.ts
gsxdsm dc54b615d4 FN-7182: pause auto-merge for manual pull requests
Manual pull requests now pause automatic merge processing until human action closes or merges the PR.

- Mark dashboard-created or linked pull requests with manual provenance and preserve it across PR refreshes and merges.
- Exclude tasks with manual open or draft PRs from automatic merge processing while preserving pipeline PR automation.
- Add regression coverage and document the manual PR handoff behavior.

Files changed:
 .changeset/FN-7182-no-auto-merge-with-manual-pr.md |  7 ++
 docs/architecture.md                               |  2 +-
 docs/dashboard-guide.md                            |  1 +
 packages/core/src/__tests__/task-helpers.test.ts   | 49 ++++++++++++-
 packages/core/src/__tests__/task-merge.test.ts     | 60 +++++++++++++++-
 packages/core/src/index.ts                         |  2 +-
 packages/core/src/task-helpers.ts                  | 13 ++++
 packages/core/src/task-merge.ts                    | 10 ++-
 packages/core/src/types.ts                         |  6 ++
 .../dashboard/src/__tests__/routes-auth.test.ts    | 80 ++++++++++++++++++++++
 .../dashboard/src/__tests__/routes-github.test.ts  | 45 +++++++++++-
 .../dashboard/src/routes/register-git-github.ts    | 20 +++++-
 12 files changed, 285 insertions(+), 10 deletions(-)

Fusion-Task-Id: FN-7182

Fusion-Task-Lineage: c415a9dc-43c1-4609-a032-367991e949a1

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-06-28 01:43:08 -07:00

19 lines
968 B
TypeScript

import type { PrInfo, Task } from "./types.js";
export function getPrimaryPrInfo(task: Pick<Task, "prInfo" | "prInfos">): PrInfo | undefined {
return task.prInfos?.[0] ?? task.prInfo;
}
/**
* FNXC:PrAutoMergeGate 2026-06-28-00:33:
* FN-7182: active in-review rows keep `prInfo`/`prInfos` even in slim task listings; only archived snapshots strip PR payloads.
* This makes the manual-open-PR handoff check safe for project-engine and self-healing slim sweeps while supporting legacy single-PR and multi-PR shapes.
*
* FNXC:PrAutoMergeGate 2026-06-28-01:39:
* A draft PR is still an active human handoff: GitHub has not closed or merged it, and Fusion must not auto-process the task around it.
*/
export function taskHasManualOpenPullRequest(task: Pick<Task, "prInfo" | "prInfos">): boolean {
const prs = task.prInfos ?? (task.prInfo ? [task.prInfo] : []);
return prs.some((pr) => pr.manual === true && (pr.status === "open" || pr.status === "draft"));
}