feat: new-music notices come from the scanner; request notices and the original specs go
release / web (push) Failing after 1m29s
release / go (push) Successful in 1m55s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 4m22s
release / android (push) Successful in 4m57s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 4m23s

Request notifications (approved, declined, completed, pending) are removed
along with the request flow that produced them. A new_music kind takes the
"new music arrived" slot: when a scan or a watcher batch finishes, the
scanner claims every album not yet announced (albums.announced_at) and tells
every user about the ones that are new: an album with a track on disk and
no track older than itself. The first import into an empty library, and an
album formed only by retagging tracks already held, announce nothing. One
notice per scan, carrying up to 50 albums and the total; it is never
coalesced, so a notice already emailed can't quietly absorb later arrivals.
It feeds the daily summary email, grouped by artist. Defaults: inbox and
email on, phone off.

Migration 0103 deletes request-kind notification rows and prefs, swaps the
kind CHECKs to new_music, and adds albums.announced_at with every album
held marked announced, so the first scan after it announces nothing old.

Web and Android: labels, the Android "Requests" settings section becomes
"New music", the shade channel your_requests becomes new_music (the old one
is deleted at startup), and "/" opens Home in the app. TrackLabel moves to
the notifications package. docs/smart-music-{server,client}-spec.md are
deleted per the operator; an Android comment loses the word "exchanges".

Grimoire #7666, #7671.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 23:29:13 -05:00
co-authored by Claude Opus 5.5
parent 9d267ba8dd
commit 561c1d5eae
42 changed files with 647 additions and 859 deletions
+20 -11
View File
@@ -25,16 +25,25 @@ func TestRender_EveryKindHasATitleAndALink(t *testing.T) {
}
}
func TestRender_RequestCompletedLinksToWhatArrived(t *testing.T) {
require.Equal(t, "/albums/al-1", render(KindRequestCompleted, Payload{Name: "WWW", AlbumID: "al-1", ArtistID: "ar-1"}).Link)
require.Equal(t, "/artists/ar-1", render(KindRequestCompleted, Payload{Name: "Moe Shop", ArtistID: "ar-1"}).Link)
require.Equal(t, "/requests", render(KindRequestCompleted, Payload{Name: "WWW"}).Link)
require.Equal(t, "WWW has arrived.", render(KindRequestCompleted, Payload{Name: "WWW"}).Body)
func TestRender_NewMusicOpensWhatArrived(t *testing.T) {
one := render(KindNewMusic, Payload{Count: 1, Albums: []Arrival{{Artist: "Moe Shop", Title: "WWW", AlbumID: "al-1"}}})
require.Equal(t, "New album", one.Title)
require.Equal(t, "Moe Shop – WWW is in the library.", one.Body)
require.Equal(t, "/albums/al-1", one.Link)
// Several open Home, whose Recently added row starts with them; the
// count, not only the albums carried, is what "more" counts.
many := render(KindNewMusic, Payload{Count: 60, Albums: []Arrival{
{Artist: "A", Title: "1"}, {Artist: "B", Title: "2"}, {Artist: "C", Title: "3"}, {Artist: "D", Title: "4"},
}})
require.Equal(t, "60 new albums", many.Title)
require.Equal(t, "Now in the library: A – 1, B – 2, C – 3 and 57 more.", many.Body)
require.Equal(t, "/", many.Link)
}
func TestRender_RejectionCarriesTheReasonWhenThereIsOne(t *testing.T) {
require.Equal(t, "WWW was declined.", render(KindRequestRejected, Payload{Name: "WWW"}).Body)
require.Equal(t, "WWW was declined: already owned", render(KindRequestRejected, Payload{Name: "WWW", Reason: "already owned"}).Body)
func TestRender_FlagCarriesTheReasonWhenThereIsOne(t *testing.T) {
require.Equal(t, "Ann flagged WWW.", render(KindQuarantineFlagged, Payload{Name: "WWW", Actor: "Ann"}).Body)
require.Equal(t, "Ann flagged WWW: bad rip", render(KindQuarantineFlagged, Payload{Name: "WWW", Actor: "Ann", Reason: "bad rip"}).Body)
}
func TestRender_CoalescedCountsReadNaturally(t *testing.T) {
@@ -76,9 +85,9 @@ func TestRender_AScanFailureSaysWhatStopped(t *testing.T) {
}
func TestRender_AnUnreadablePayloadStillRenders(t *testing.T) {
r := Render(KindRequestApproved, []byte(`not json`))
require.Equal(t, "Request approved", r.Title)
require.Equal(t, "Your request is on its way.", r.Body)
r := Render(KindQuarantineFlagged, []byte(`not json`))
require.Equal(t, "Track flagged", r.Title)
require.Equal(t, "Someone flagged A track.", r.Body)
}
func TestPayloadMap_DropsEmptyFields(t *testing.T) {