Notify link=: review fixes

- ntfy uses the link only beside a web run view; otherwise it keeps the
  run click and the receipt says why (app click stays the link).
- The outbox retry of a hook's failed publication re-resolves the stage's
  link=, so the ntfy and app tap targets keep it.
- A valid link file is never the attached artifact.
- Notification artifacts are read through os.OpenRoot with O_NOFOLLOW.
- The link note is recorded once, on the first receipt, and never becomes
  the run-level failure reason.
- Android: a recents relaunch does not reopen the link, and a run thread of
  several entries opens the run rather than the latest external page.
- Docs and the protocol comment say "first non-empty line".
This commit is contained in:
2026-12-02 12:29:46 +00:00
parent f5f31b7bcd
commit 0c75ff1b0d
10 changed files with 401 additions and 109 deletions
+3 -3
View File
@@ -289,7 +289,7 @@ func TestNotificationArtifactSelectionAndPreview(t *testing.T) {
t.Fatal(err)
}
r := &runner{artifactsRoot: root}
a, preview := r.resolveNotificationArtifact(9, 3, "reports/*.md")
a, preview := r.resolveNotificationArtifact(9, 3, "reports/*.md", "")
if a == nil || a.Path != "reports/new.md" || a.URL != "/artifacts/9/3/public/reports/new.md" {
t.Fatalf("wrong selected artifact: %+v", a)
}
@@ -299,13 +299,13 @@ func TestNotificationArtifactSelectionAndPreview(t *testing.T) {
if got := notificationClick(9, 3, a); got != "pipelines://artifact/9/3/reports/new.md" {
t.Fatal(got)
}
if got, _ := r.resolveNotificationArtifact(9, 3, ""); got != nil {
if got, _ := r.resolveNotificationArtifact(9, 3, "", ""); got != nil {
t.Fatal("multiple files selected automatically")
}
if err := os.Remove(old); err != nil {
t.Fatal(err)
}
if got, _ := r.resolveNotificationArtifact(9, 3, ""); got == nil || got.Path != "reports/new.md" {
if got, _ := r.resolveNotificationArtifact(9, 3, "", ""); got == nil || got.Path != "reports/new.md" {
t.Fatal("single artifact not selected automatically")
}
}