fc7dbb0ac0
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>
79 lines
3.0 KiB
Go
79 lines
3.0 KiB
Go
package tui
|
|
|
|
import (
|
|
"git.a-wan.net/alan/pipelines/internal/protocol"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestScheduleToolbar(t *testing.T) {
|
|
m := panelModel(t)
|
|
m.detail.Graph.Settings = &protocol.Settings{Schedules: []protocol.Schedule{{Every: "15m", Days: []string{"mon", "fri"}}, {Times: []string{"09:00"}, Timezone: "Europe/London"}}}
|
|
view := strings.Join(m.pipelineToolbar(), "\n")
|
|
for _, text := range []string{"Schedule:", "mon,fri every 15m (server local)", "everyday at 09:00 (Europe/London)"} {
|
|
if !strings.Contains(view, text) {
|
|
t.Fatal("missing schedule", text, view)
|
|
}
|
|
}
|
|
m.detail.LatestVersion = m.detail.Version + 1
|
|
if !strings.Contains(strings.Join(m.pipelineToolbar(), "\n"), "historical, inactive") {
|
|
t.Fatal("historical schedule appears active")
|
|
}
|
|
}
|
|
|
|
func TestStageToolsVisible(t *testing.T) {
|
|
m := panelModel(t)
|
|
m.detail.Graph.Stages[0].Blocks["tools"] = "websearch\nwebfetch"
|
|
header, lines := m.stageColumns(116)
|
|
view := header + "\n" + strings.Join(lines, "\n")
|
|
for _, text := range []string{"TOOLS", "websearch", "webfetch"} {
|
|
if !strings.Contains(view, text) {
|
|
t.Fatal("missing tools in detail", text, view)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestRunComposerShowsStageScopedTools(t *testing.T) {
|
|
m := panelModel(t)
|
|
m.runForm = 1
|
|
m.runInput = newInput()
|
|
m.detail.Graph.Stages[0].Blocks["tools"] = "websearch\nwebfetch"
|
|
if m.runHasMutationTools() {
|
|
t.Fatal("web stage requires mutation approval")
|
|
}
|
|
view := m.runFormView(40)
|
|
if !strings.Contains(view, "websearch, webfetch") || strings.Contains(view, "RUN approves") {
|
|
t.Fatal("incorrect web confirmation", view)
|
|
}
|
|
m.detail.Graph.Stages[0].Blocks["tools"] = "shell"
|
|
if !m.runHasMutationTools() {
|
|
t.Fatal("shell cannot be approved without edits")
|
|
}
|
|
view = m.runFormView(40)
|
|
if !strings.Contains(view, "shell") || strings.Contains(view, "RUN approves") {
|
|
t.Fatal("composer should show tools, not demand approval", view)
|
|
}
|
|
}
|
|
|
|
func TestNotifyPolicyAndReceiptsVisible(t *testing.T) {
|
|
m := panelModel(t)
|
|
m.detail.Graph.Stages[0].Notify = &protocol.NotificationPolicy{On: []string{"success", "failure"}, Destination: "anime", Artifacts: []string{"markdown", "files"}}
|
|
header, lines := m.stageColumns(116)
|
|
view := header + "\n" + strings.Join(lines, "\n")
|
|
for _, text := range []string{"NOTIFY", "Connection: global", "success, failure", "Artifacts: markdown,", "files"} {
|
|
if !strings.Contains(view, text) {
|
|
t.Fatal("missing notify policy", text, view)
|
|
}
|
|
}
|
|
run := runInspectionModel()
|
|
run.runStepIndex = 1
|
|
run.toggleRunSection(4)
|
|
run.runDetail.Steps[0].Notifications = []protocol.NotificationReceipt{{Destination: "anime", Status: "sent", Filename: "report.txt", MessageID: "message123", AttachmentURL: "https://files.example.com/report.txt"}, {Destination: "anime", Status: "failed", Diagnostic: "HTTP 401"}}
|
|
view = strings.Join(run.runSectionLines(116), "\n")
|
|
for _, text := range []string{"Notification: anime", "report.txt", "message123", "HTTP 401"} {
|
|
if !strings.Contains(view, text) {
|
|
t.Fatal("missing notification receipt", text, view)
|
|
}
|
|
}
|
|
}
|