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:
2026-12-03 23:24:24 +00:00
parent 806b5eca46
commit fc7dbb0ac0
138 changed files with 1958 additions and 4651 deletions
+13 -2
View File
@@ -17,7 +17,12 @@ type Config struct {
OpenCode string `json:"opencode"`
OpenCodeEnv map[string]string `json:"opencode_env"`
Path string `json:"path"`
Ntfy struct {
// Mode is "native" for a native installation (the per-user supervisor)
// and "docker" or empty for Compose.
Mode string `json:"mode"`
// LegacyNtfy is read only for its mode: manifests written before ntfy was
// removed recorded a native installation as ntfy.mode "native".
LegacyNtfy struct {
Mode string `json:"mode"`
} `json:"ntfy"`
Web struct {
@@ -70,7 +75,7 @@ func Load(executable string) (*Config, error) {
if config.Format != 1 || config.Prefix != prefix || config.ServerPort < 1024 || config.ServerPort > 65535 {
return nil, fmt.Errorf("invalid managed installation manifest")
}
if inferred && config.Ntfy.Mode != "native" {
if inferred && !config.Native() {
return nil, nil
}
if inferred {
@@ -82,6 +87,12 @@ func Load(executable string) (*Config, error) {
return &config, nil
}
// Native reports whether the manifest describes a native installation, in the
// current form or the one written before ntfy was removed.
func (c Config) Native() bool {
return c.Mode == "native" || (c.Mode == "" && c.LegacyNtfy.Mode == "native")
}
func (c Config) Environment() error {
for key, value := range c.OpenCodeEnv {
switch key {
+29 -2
View File
@@ -84,7 +84,7 @@ func nativeFixture(t *testing.T) (string, string) {
t.Fatal(err)
}
config := Config{Format: 1, Prefix: root, ServerPort: 18080, Python: filepath.Join(root, "python3")}
config.Ntfy.Mode = "native"
config.Mode = "native"
data, _ := json.Marshal(config)
if err = os.WriteFile(filepath.Join(root, "pipelines-install.json"), data, 0600); err != nil {
t.Fatal(err)
@@ -156,7 +156,7 @@ func TestNativeDiscoveryRejectsSymlinkManifestAndMismatchedPrefix(t *testing.T)
os.Symlink(target, manifest)
} else {
config := Config{Format: 1, Prefix: "/another/prefix", ServerPort: 18080}
config.Ntfy.Mode = "native"
config.Mode = "native"
data, _ := json.Marshal(config)
os.WriteFile(manifest, data, 0600)
}
@@ -166,3 +166,30 @@ func TestNativeDiscoveryRejectsSymlinkManifestAndMismatchedPrefix(t *testing.T)
})
}
}
// A manifest written before ntfy was removed marks a native installation as
// ntfy.mode "native" (with the rest of the old ntfy block); it must still be
// selected until a reinstall rewrites it with the top-level mode.
func TestLegacyNtfyManifestStillSelectsNativeInstallation(t *testing.T) {
t.Setenv("PIPELINES_PREFIX", "")
root, binary := nativeFixture(t)
legacy := map[string]any{"format": 1, "prefix": root, "server_port": 18080, "python": filepath.Join(root, "python3"),
"ntfy_port": 8090, "topic": "pipelines", "username": "phone-reader",
"ntfy": map[string]any{"mode": "native", "bin": filepath.Join(root, "bin", "ntfy"), "config": filepath.Join(root, "data", "ntfy", "server.yml"), "version": "v2.38.1"}}
data, _ := json.Marshal(legacy)
if err := os.WriteFile(filepath.Join(root, "pipelines-install.json"), data, 0600); err != nil {
t.Fatal(err)
}
loaded, err := Load(binary)
if err != nil || loaded == nil || !loaded.Native() {
t.Fatal("legacy native manifest not selected", loaded, err)
}
docker := Config{Mode: "docker"}
docker.LegacyNtfy.Mode = "native"
if docker.Native() {
t.Fatal("explicit docker mode overridden by the legacy block")
}
if !(Config{Mode: "native"}).Native() || (Config{}).Native() {
t.Fatal("top-level mode not honoured")
}
}
+5 -8
View File
@@ -77,8 +77,8 @@ func (d serviceDefinition) render(platform string) (string, error) {
}
// Only explicitly supported settings are captured, never the complete environment
// or provider credentials. File-based notification credentials remain references.
var serviceEnvironmentKeys = []string{"PATH", "HOME", "XDG_CONFIG_HOME", "XDG_DATA_HOME", "XDG_STATE_HOME", "XDG_CACHE_HOME", "PIPELINES_OPENCODE", "PIPELINES_OPENCODE_ENDPOINT", "PIPELINES_OPENCODE_ENDPOINT_PASSWORD_FILE", "PIPELINES_OPENCODE_ENDPOINT_USERNAME", "PIPELINES_NTFY_URL", "PIPELINES_NTFY_PUBLIC_URL", "PIPELINES_NTFY_TOKEN_FILE", "PIPELINES_WEB_PUBLIC_URL", "PIPELINES_CLAUDE"}
// or provider credentials. File-based credentials remain references.
var serviceEnvironmentKeys = []string{"PATH", "HOME", "XDG_CONFIG_HOME", "XDG_DATA_HOME", "XDG_STATE_HOME", "XDG_CACHE_HOME", "PIPELINES_OPENCODE", "PIPELINES_OPENCODE_ENDPOINT", "PIPELINES_OPENCODE_ENDPOINT_PASSWORD_FILE", "PIPELINES_OPENCODE_ENDPOINT_USERNAME", "PIPELINES_WEB_PUBLIC_URL", "PIPELINES_CLAUDE"}
func envValues(env map[string]string) []string {
var values []string
@@ -169,7 +169,7 @@ func ServiceCommand(ctx context.Context, executable string, args []string, out,
if err != nil {
return err
}
if config != nil && config.Ntfy.Mode == "native" {
if config != nil && config.Native() {
// Use an internal verb so an older manager fails instead of forwarding
// "service" back into this CLI recursively. Reinstall refreshes manage.py.
command := exec.CommandContext(ctx, config.Python, append([]string{filepath.Join(config.Prefix, "lib/manage.py"), "--prefix", config.Prefix, "native-service"}, args...)...)
@@ -182,7 +182,7 @@ func ServiceCommand(ctx context.Context, executable string, args []string, out,
if config == nil && os.Getenv("PIPELINES_PREFIX") != "" {
return fmt.Errorf("PIPELINES_PREFIX does not select an existing installation; refusing to configure a standalone service")
}
help := "Usage: pipelines service enable [--print]\n pipelines service disable | status\nNative installs manage the existing server/web/ntfy supervisor, selected by PIPELINES_PREFIX or the installed CLI path.\nAutostart is per-user, at login. enable starts now; --print only previews.\nStandalone developer binaries also support enable --db FILE --addr HOST:PORT.\nRuns use the directory you invoke pipelines run from.\n"
help := "Usage: pipelines service enable [--print]\n pipelines service disable | status\nNative installs manage the existing server/web supervisor, selected by PIPELINES_PREFIX or the installed CLI path.\nAutostart is per-user, at login. enable starts now; --print only previews.\nStandalone developer binaries also support enable --db FILE --addr HOST:PORT.\nRuns use the directory you invoke pipelines run from.\n"
if len(args) == 0 || args[0] == "--help" || args[0] == "help" {
_, err := io.WriteString(out, help)
return err
@@ -221,9 +221,6 @@ func ServiceCommand(ctx context.Context, executable string, args []string, out,
if len(f.Args()) != 0 {
return fmt.Errorf("service enable takes no positional arguments")
}
if os.Getenv("PIPELINES_NTFY_TOKEN") != "" {
return fmt.Errorf("use PIPELINES_NTFY_TOKEN_FILE for autostart; inline tokens are not saved")
}
binary, err := ServerExecutable(executable)
if err != nil {
return err
@@ -242,7 +239,7 @@ func ServiceCommand(ctx context.Context, executable string, args []string, out,
d.Environment[key] = value
}
}
for _, key := range []string{"PIPELINES_OPENCODE", "PIPELINES_OPENCODE_ENDPOINT_PASSWORD_FILE", "PIPELINES_NTFY_TOKEN_FILE"} {
for _, key := range []string{"PIPELINES_OPENCODE", "PIPELINES_OPENCODE_ENDPOINT_PASSWORD_FILE"} {
if value := d.Environment[key]; value != "" && (key != "PIPELINES_OPENCODE" || strings.ContainsRune(value, filepath.Separator)) {
absolute, err := filepath.Abs(value)
if err != nil {
+1 -2
View File
@@ -41,7 +41,7 @@ func TestSystemdDefinitionAcceptedByNativeValidator(t *testing.T) {
}
func TestServiceDefinitionsQuotePathsAndKeepEnvironmentLimited(t *testing.T) {
d := serviceDefinition{Binary: `/some bin/server`, Directory: `/repo "quoted" 100% $USER`, Args: []string{"-db", `/repo "quoted" 100% $USER/data.db`}, Environment: map[string]string{"PATH": "/usr/bin:/custom bin", "PIPELINES_NTFY_TOKEN_FILE": "/secret & token", "PIPELINES_CLAUDE": "/custom bin/claude", "PROVIDER_SECRET": "must-not-export"}}
d := serviceDefinition{Binary: `/some bin/server`, Directory: `/repo "quoted" 100% $USER`, Args: []string{"-db", `/repo "quoted" 100% $USER/data.db`}, Environment: map[string]string{"PATH": "/usr/bin:/custom bin", "PIPELINES_OPENCODE_ENDPOINT_PASSWORD_FILE": "/secret & token", "PIPELINES_CLAUDE": "/custom bin/claude", "PROVIDER_SECRET": "must-not-export"}}
for _, platform := range []string{"linux", "darwin"} {
text, err := d.render(platform)
if err != nil {
@@ -142,7 +142,6 @@ func TestServiceConfigurationPreviewAndLifecycleWithMockOSManager(t *testing.T)
t.Setenv("XDG_CONFIG_HOME", filepath.Join(home, "config"))
t.Setenv("XDG_DATA_HOME", filepath.Join(home, "data"))
t.Setenv("PATH", bin)
t.Setenv("PIPELINES_NTFY_TOKEN", "")
server := filepath.Join(bin, "pipelines-server")
if err := os.WriteFile(server, []byte("#!/bin/sh\nexit 0\n"), 0700); err != nil {
t.Fatal(err)