test(FN-5047): cover merged event emission and docs

Fusion-Task-Id: FN-5047
Fusion-Task-Lineage: 9b03f2de-1b4a-45ad-b1ce-0a6217d6da77
This commit is contained in:
Fusion (runfusion.ai)
2026-05-18 07:42:19 -07:00
committed by gsxdsm
parent d94ef51238
commit be6279f656
3 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Fix: ntfy 'merged' notifications now fire for every merge-success path (auto-finalize no-op merges, mergeConfirmed fast-path, PR-strategy merges, and self-healing finalize).

View File

@@ -712,7 +712,7 @@ Guardrails: this routine does **not** retry merges, does **not** apply to mixed/
- `[scheduler]`, `[executor]`, `[merger]` — core execution/dispatch/merge lanes.
- `Notifier` (`notifier.ts`) — legacy ntfy compatibility shim (`NtfyNotifier`) plus shared ntfy helpers
- Runtime ownership: `NtfyNotifier` no longer owns an independent task-lifecycle listener graph; `ProjectEngine` injects the canonical `NotificationService` instance so task lifecycle notifications (`task:moved`, `task:updated`, `task:merged`) are emitted through a single path.
- Merge dedup safety: `ProjectEngine.start()` is idempotent, so repeated start calls do not wire a second `NotificationService`/`NtfyNotifier` pair. A successful merge therefore emits exactly one canonical `merged` ntfy lifecycle notification per task.
- Merge dedup safety: all merge-success → done code paths (direct merger completion, owned/no-op auto-finalize, mergeConfirmed fast-path, PR-strategy finalize, and merge-success self-healing finalizers) emit `store.emit("task:merged", result)` with a merged `MergeResult`. `NotificationService.notifiedEvents` remains the single dedup source of truth, so duplicate upstream emits still produce exactly one canonical `merged` ntfy lifecycle notification per task.
- Compatibility scope: `NtfyNotifier` remains responsible for gridlock-only compatibility notifications (`notifyGridlock`) and legacy helper APIs.
- Legacy gridlock ntfy delivery is cooldown-throttled: first detection notifies immediately, subsequent detections are suppressed for 15 minutes (even if blocked-task membership changes), and the cooldown resets as soon as gridlock fully clears.
- `NotificationService` (`notification/notification-service.ts`) — provider lifecycle + event dispatch orchestration

View File

@@ -1438,7 +1438,7 @@ describe("ProjectEngine paused in-review auto-merge behavior", () => {
column: "done",
branch: "fusion/fn-merged",
mergeDetails: { mergeConfirmed: true, mergedAt: "2026-05-18T00:00:00.000Z", mergeTargetBranch: "main" },
});
} as any);
mocks.currentStore = mockStore.store;
const engine = createEngine();