Remove ntfy: notifications go only through the app notification stream
Server: drop ntfy publishing (stage hooks, run outbox, chat attention, chat tool notify, auto-switch and schedule notices), the chat push outbox (its table is dropped at startup), ntfy status/endpoints and PIPELINES_NTFY_*. The app_notifications stream, subscribe/clear and kinds are unchanged. Notification settings keep run_finished/chat_needs_you/chat_reply_finished; ntfy_enabled is accepted and ignored and its stored row is never read. Stage type=ntfy is rejected: "ntfy stages were removed; notifications go to the Pipelines apps — use the stage notify hook". The notify hook remains. Installer: no ntfy build, accounts, config or supervisor child; manifest gets top-level "mode" (legacy ntfy.mode still read). Reinstall retires an old ntfy (safe PID-file stop, deletes binary, config, data dir, token, log, with a note in logs/install.log); uninstall cleans leftovers. App: ntfy settings section replaced by "Notification events"; texts updated. Docs: docs/ntfy.md folded into docs/notifications.md; install, docker, cli, author skill references updated; security review M1 marked resolved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -89,8 +89,34 @@ func TestNotificationSettingsProtocol(t *testing.T) {
|
||||
wantSettings(t, replies[0], updated)
|
||||
}
|
||||
|
||||
// ntfy was removed. An older app may still send its "also send to ntfy"
|
||||
// switch, alone or beside a real setting: the key is accepted and ignored,
|
||||
// and every reply carries exactly the three notification settings.
|
||||
func TestLegacyNtfySettingIsAcceptedAndIgnored(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
store := newOperatorStore(t)
|
||||
replies := notificationSettingsRoundTrip(t, ctx, store,
|
||||
protocol.Message{Type: protocol.SetNotificationSettings, ID: "ntfy", NotificationSettings: map[string]any{protocol.LegacyNotifyNtfyEnabled: false}},
|
||||
protocol.Message{Type: protocol.SetNotificationSettings, ID: "mixed", NotificationSettings: map[string]any{protocol.LegacyNotifyNtfyEnabled: true, protocol.NotifyRunFinished: true}},
|
||||
protocol.Message{Type: protocol.GetNotificationSettings, ID: "get"},
|
||||
)
|
||||
want := protocol.DefaultNotificationSettings()
|
||||
wantSettings(t, replies[0], want)
|
||||
want.RunFinished = true
|
||||
wantSettings(t, replies[1], want)
|
||||
wantSettings(t, replies[2], want)
|
||||
for _, reply := range replies {
|
||||
if len(reply.NotificationSettings) != 3 {
|
||||
t.Fatalf("reply carries %d settings: %+v", len(reply.NotificationSettings), reply)
|
||||
}
|
||||
if _, present := reply.NotificationSettings[protocol.LegacyNotifyNtfyEnabled]; present {
|
||||
t.Fatalf("reply still carries ntfy_enabled: %+v", reply)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestChatNeedsYouSettingSuppressesQuestionsAndApprovals(t *testing.T) {
|
||||
captured := newNtfyCapture(t)
|
||||
store := newOperatorStore(t)
|
||||
if _, err := store.UpdateNotificationSettings(context.Background(), map[string]any{protocol.NotifyChatNeedsYou: false}); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -98,6 +124,9 @@ func TestChatNeedsYouSettingSuppressesQuestionsAndApprovals(t *testing.T) {
|
||||
h := chatAttentionHub(t, "ses_quiet")
|
||||
h.registry = store
|
||||
h.settings = store
|
||||
notes, recorder := newNoteCapture(t, store)
|
||||
h.notes = notes
|
||||
captured := recorder.recorded
|
||||
form := protocol.ChatForm{ID: "que_1", SessionID: "ses_quiet", Kind: "question", Title: "Ship?"}
|
||||
h.emit(protocol.ChatEventFrame{SessionID: "ses_quiet", Kind: protocol.ChatEventForm, Form: &form})
|
||||
h.pushPermission("ses_quiet", protocol.ChatPermissionFrame{SessionID: "ses_quiet", RequestID: "per_1", Message: "Allow?"})
|
||||
@@ -127,8 +156,6 @@ func replyTurn(h *chatHub, session, turnID, messageID, text string) {
|
||||
}
|
||||
|
||||
func TestChatReplyFinishedNotifiesOncePerTurn(t *testing.T) {
|
||||
t.Setenv("PIPELINES_WEB_PUBLIC_URL", "https://pipelines.example.com")
|
||||
captured := newNtfyCapture(t)
|
||||
store := newOperatorStore(t)
|
||||
ctx := context.Background()
|
||||
if err := store.RecordOperatorSession(ctx, "ses_done", t.TempDir(), "Release prep", protocol.ChatSessionTagOperator); err != nil {
|
||||
@@ -137,6 +164,9 @@ func TestChatReplyFinishedNotifiesOncePerTurn(t *testing.T) {
|
||||
h := chatAttentionHub(t, "ses_done", "ses_bare")
|
||||
h.registry = store
|
||||
h.settings = store
|
||||
notes, recorder := newNoteCapture(t, store)
|
||||
h.notes = notes
|
||||
captured := recorder.recorded
|
||||
// Off by default: a finished turn is silent.
|
||||
replyTurn(h, "ses_done", "turn_0", "msg_0", "Quiet reply")
|
||||
h.attentionWG.Wait()
|
||||
@@ -162,10 +192,9 @@ func TestChatReplyFinishedNotifiesOncePerTurn(t *testing.T) {
|
||||
if len(got) != 1 {
|
||||
t.Fatalf("deliveries = %+v", got)
|
||||
}
|
||||
wantBody := truncateRunes("The build is green. "+strings.Repeat("x", 300), chatReplyBodyRunes)
|
||||
want := ntfyCapture{Title: "Release prep replied", Message: wantBody, Click: "pipelines://chat/ses_done", Actions: "view, Open in browser, https://pipelines.example.com/chat/ses_done"}
|
||||
if got[0] != want {
|
||||
t.Fatalf("got %+v, want %+v", got[0], want)
|
||||
if n := got[0]; n.Title != "Release prep replied" || n.Click != "pipelines://chat/ses_done" || n.Kind != protocol.NotificationChatReply ||
|
||||
!strings.HasPrefix(n.Message, "The build\nis green. xxx") {
|
||||
t.Fatalf("got %+v", n)
|
||||
}
|
||||
// The next genuine turn notifies again; a turn without text (and a
|
||||
// session without a title or native turn ids) uses the fallback text.
|
||||
@@ -186,8 +215,9 @@ func TestChatReplyFinishedNotifiesOncePerTurn(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestChatReplyFinishedNeedsNtfyConfiguration(t *testing.T) {
|
||||
t.Setenv("PIPELINES_NTFY_URL", "")
|
||||
// Without the app notification stream a finished turn has nowhere to go and
|
||||
// is not even considered.
|
||||
func TestChatReplyFinishedNeedsTheAppStream(t *testing.T) {
|
||||
store := newOperatorStore(t)
|
||||
if _, err := store.UpdateNotificationSettings(context.Background(), map[string]any{protocol.NotifyChatReplyFinished: true}); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -199,6 +229,6 @@ func TestChatReplyFinishedNeedsNtfyConfiguration(t *testing.T) {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
if len(h.attentionSeen) != 0 {
|
||||
t.Fatalf("unconfigured ntfy still considered a publication: %v", h.attentionSeen)
|
||||
t.Fatalf("a stream-less hub still considered a notification: %v", h.attentionSeen)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user