fix(KB-124): resolve ntfy duplicate notifications and spec editor layout

- Fix duplicate ntfy.sh notifications on task merge events
- Fix spec editor layout overflow in TaskDetailModal
- Add regression test coverage for merge notifications
- Add changeset for notification fix
This commit is contained in:
gsxdsm
2026-03-30 07:49:44 -07:00
parent 054c9eab39
commit ea5a34f7cf
2 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
---
"@dustinbyrne/kb": patch
---
Remove duplicate ntfy notification on task merge
Previously, when a task was merged to main, two identical notifications were sent because both `task:moved` (to "done") and `task:merged` events triggered notifications. Now only the `task:merged` event sends the notification, eliminating the duplicate.

View File

@@ -374,6 +374,39 @@ describe("NtfyNotifier", () => {
expect(fetchMock).toHaveBeenCalledTimes(2); expect(fetchMock).toHaveBeenCalledTimes(2);
}); });
it("sends notification only once on merge when task:moved and task:merged both fire", async () => {
notifier = new NtfyNotifier(store);
await notifier.start();
const task = createTask("KB-001", "Test Task");
const mergeResult: MergeResult = {
task,
branch: "kb/kb-001",
merged: true,
worktreeRemoved: true,
branchDeleted: true,
};
// completeTask() emits task:moved to done before task:merged
store.triggerTaskMoved(task, "in-review", "done");
store.triggerTaskMerged(mergeResult);
await new Promise(resolve => setTimeout(resolve, 10));
expect(fetchMock).toHaveBeenCalledTimes(1);
expect(fetchMock).toHaveBeenCalledWith(
"https://ntfy.sh/test-topic",
expect.objectContaining({
method: "POST",
headers: expect.objectContaining({
"Title": "Task KB-001 merged",
"Priority": "default",
}),
body: 'Task "Test Task" has been merged to main',
})
);
});
it("prevents duplicate task:merged events for the same task", async () => { it("prevents duplicate task:merged events for the same task", async () => {
notifier = new NtfyNotifier(store); notifier = new NtfyNotifier(store);
await notifier.start(); await notifier.start();