test: invented artists, albums and MusicBrainz ids in place of real ones
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped

Test data and example comments named real artists, records and songs, and
carried real MusicBrainz ids. One mapping swaps them for invented ones
throughout (Fields of Ontario, Plastic Apes, Marlo Davies, ...), keeping
what each case tests: sort order, index letter, escaping, title keys,
artist-prefix stripping. A test username is no longer the operator's name.

The cover-art and Last.fm connection checks still query real releases;
they reach live services and need something that exists there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 13:21:34 -05:00
co-authored by Claude Opus 5.5
parent 4244d81dfd
commit 4e1807cbba
80 changed files with 570 additions and 570 deletions
+7 -7
View File
@@ -38,9 +38,9 @@ func TestDigest_BatchGoesOutOnceAWindowAfterTheFirstItem(t *testing.T) {
start := time.Now()
require.NoError(t, n.Notify(ctx, notifications.KindQuarantineFlagged, notifications.ToUser(alice),
notifications.Payload{Name: "Moe Shop – WWW"}.Map()))
notifications.Payload{Name: "Mochi Shop – XYZ"}.Map()))
require.NoError(t, n.Notify(ctx, notifications.KindQuarantineFlagged, notifications.ToUser(alice),
notifications.Payload{Name: "Tycho – Awake", Reason: "already have it"}.Map()))
notifications.Payload{Name: "Tacho – Asleep", Reason: "already have it"}.Map()))
d.Tick(ctx, start.Add(30*time.Minute))
require.Empty(t, fake.Sent, "inside the window nothing goes")
@@ -49,8 +49,8 @@ func TestDigest_BatchGoesOutOnceAWindowAfterTheFirstItem(t *testing.T) {
require.Len(t, fake.Sent, 1, "both items, one email")
require.Equal(t, "alice@example.com", fake.Sent[0].To)
require.Equal(t, "Minstrel: 2 updates", fake.Sent[0].Subject)
require.Contains(t, fake.Sent[0].TextBody, "Someone flagged Moe Shop – WWW.")
require.Contains(t, fake.Sent[0].TextBody, "Someone flagged Tycho – Awake: already have it")
require.Contains(t, fake.Sent[0].TextBody, "Someone flagged Mochi Shop – XYZ.")
require.Contains(t, fake.Sent[0].TextBody, "Someone flagged Tacho – Asleep: already have it")
d.Tick(ctx, start.Add(3*time.Hour))
require.Len(t, fake.Sent, 1, "never sent twice")
@@ -171,8 +171,8 @@ func TestDigest_NewMusicWaitsForTheSummaryHour(t *testing.T) {
}
for _, a := range []notifications.Arrival{
{Artist: "Moe Shop", Title: "WWW"},
{Artist: "Moe Shop", Title: "Pure"},
{Artist: "Mochi Shop", Title: "XYZ"},
{Artist: "Mochi Shop", Title: "Pure"},
} {
p := notifications.Payload{Count: 1, Albums: []notifications.Arrival{a}}
require.NoError(t, n.Notify(ctx, notifications.KindNewMusic, notifications.ToUser(alice), p.Map()))
@@ -184,7 +184,7 @@ func TestDigest_NewMusicWaitsForTheSummaryHour(t *testing.T) {
d.Tick(ctx, slot)
require.Len(t, fake.Sent, 1)
require.Equal(t, "Minstrel: new music in your library", fake.Sent[0].Subject)
require.Contains(t, fake.Sent[0].TextBody, "Moe Shop\n - WWW")
require.Contains(t, fake.Sent[0].TextBody, "Mochi Shop\n - XYZ")
require.Contains(t, fake.Sent[0].TextBody, " - Pure")
d.Tick(ctx, slot.Add(5*time.Hour))
+11 -11
View File
@@ -137,22 +137,22 @@ func TestRenderDigest_SummaryGroupsByArtist(t *testing.T) {
return pendingItem{Kind: KindNewMusic, Payload: b}
}
items := []pendingItem{
scan(Arrival{Artist: "Moe Shop", Title: "WWW", ArtistID: "ar-1", AlbumID: "al-1"},
Arrival{Artist: "Boards of Canada", Title: "Geogaddi", AlbumID: "al-2"}),
scan(Arrival{Artist: "Moe Shop", Title: "Pure", ArtistID: "ar-1", AlbumID: "al-3"}),
scan(Arrival{Artist: "Mochi Shop", Title: "XYZ", ArtistID: "ar-1", AlbumID: "al-1"},
Arrival{Artist: "Fields of Ontario", Title: "Geomantic", AlbumID: "al-2"}),
scan(Arrival{Artist: "Mochi Shop", Title: "Pure", ArtistID: "ar-1", AlbumID: "al-3"}),
}
e, err := renderDigest(EmailSummary, "alice", items, "https://music.example/")
require.NoError(t, err)
require.Equal(t, "Minstrel: new music in your library", e.Subject)
moe := strings.Index(e.Text, "Moe Shop")
moe := strings.Index(e.Text, "Mochi Shop")
require.GreaterOrEqual(t, moe, 0)
require.Equal(t, moe, strings.LastIndex(e.Text, "Moe Shop\n"), "one heading per artist, across scans")
require.Less(t, moe, strings.Index(e.Text, "Boards of Canada"), "artists in the order they arrived")
require.Contains(t, e.Text, "Moe Shop\n https://music.example/artists/ar-1")
require.Contains(t, e.Text, " - WWW\n https://music.example/albums/al-1")
require.Equal(t, moe, strings.LastIndex(e.Text, "Mochi Shop\n"), "one heading per artist, across scans")
require.Less(t, moe, strings.Index(e.Text, "Fields of Ontario"), "artists in the order they arrived")
require.Contains(t, e.Text, "Mochi Shop\n https://music.example/artists/ar-1")
require.Contains(t, e.Text, " - XYZ\n https://music.example/albums/al-1")
require.Contains(t, e.Text, " - Pure\n https://music.example/albums/al-3")
require.Contains(t, e.Text, " - Geogaddi\n https://music.example/albums/al-2")
require.Contains(t, e.Text, " - Geomantic\n https://music.example/albums/al-2")
require.Contains(t, e.Text, "https://music.example/settings/notifications")
require.Contains(t, e.HTML, `<a href="https://music.example/albums/al-1"`)
}
@@ -160,13 +160,13 @@ func TestRenderDigest_SummaryGroupsByArtist(t *testing.T) {
func TestRenderDigest_BatchListsEachItemAndEscapesHTML(t *testing.T) {
b, _ := json.Marshal(Payload{Name: "<script>x</script>", Reason: "dup"}.Map())
items := []pendingItem{
{Kind: KindQuarantineFlagged, Payload: []byte(`{"name":"WWW","actor":"Ann"}`)},
{Kind: KindQuarantineFlagged, Payload: []byte(`{"name":"XYZ","actor":"Ann"}`)},
{Kind: KindQuarantineFlagged, Payload: b},
}
e, err := renderDigest(EmailBatch, "alice", items, "")
require.NoError(t, err)
require.Equal(t, "Minstrel: 2 updates", e.Subject)
require.Contains(t, e.Text, "- Track flagged\n Ann flagged WWW.")
require.Contains(t, e.Text, "- Track flagged\n Ann flagged XYZ.")
require.NotContains(t, e.Text, "http", "no public address: no links")
require.Contains(t, e.Text, "Settings → Notifications")
require.NotContains(t, e.HTML, "<script>")
+2 -2
View File
@@ -83,13 +83,13 @@ func TestNotify_WritesARowAndNudgesOnlyThatUser(t *testing.T) {
n := notifications.New(pool, bus, nil)
require.NoError(t, n.Notify(ctx, notifications.KindNewMusic,
notifications.ToUser(alice), map[string]any{"count": 1, "name": "WWW"}))
notifications.ToUser(alice), map[string]any{"count": 1, "name": "XYZ"}))
rows := rowsFor(t, q, alice)
require.Len(t, rows, 1)
require.Equal(t, "new_music", rows[0].Kind)
require.False(t, rows[0].ReadAt.Valid)
require.JSONEq(t, `{"count":1,"name":"WWW"}`, string(rows[0].Payload))
require.JSONEq(t, `{"count":1,"name":"XYZ"}`, string(rows[0].Payload))
require.Empty(t, rowsFor(t, q, bob))
select {
+2 -2
View File
@@ -23,7 +23,7 @@ type Rendered struct {
// Payload is what producers put in a notification. Every field is optional;
// each kind documents the ones it uses in Render.
type Payload struct {
// Name is what was flagged, as the user would say it: "Moe Shop – WWW".
// Name is what was flagged, as the user would say it: "Mochi Shop – XYZ".
Name string `json:"name,omitempty"`
// Albums are new_music's arrivals, the first AlbumsKept of Count.
Albums []Arrival `json:"albums,omitempty"`
@@ -33,7 +33,7 @@ type Payload struct {
// Count is the coalesced kinds' running total since the notice was last
// read.
Count int64 `json:"count,omitempty"`
// Items name what Count counts, one each, newest first: "Weezer – Buddy
// Items name what Count counts, one each, newest first: "Glasshouse – Buddy
// Holly". A coalesced update puts its own in front and keeps ten,
// so the body can say which, not only how many.
Items []string `json:"items,omitempty"`
+9 -9
View File
@@ -26,9 +26,9 @@ func TestRender_EveryKindHasATitleAndALink(t *testing.T) {
}
func TestRender_NewMusicOpensWhatArrived(t *testing.T) {
one := render(KindNewMusic, Payload{Count: 1, Albums: []Arrival{{Artist: "Moe Shop", Title: "WWW", AlbumID: "al-1"}}})
one := render(KindNewMusic, Payload{Count: 1, Albums: []Arrival{{Artist: "Mochi Shop", Title: "XYZ", 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, "Mochi Shop – XYZ 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
@@ -42,8 +42,8 @@ func TestRender_NewMusicOpensWhatArrived(t *testing.T) {
}
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)
require.Equal(t, "Ann flagged XYZ.", render(KindQuarantineFlagged, Payload{Name: "XYZ", Actor: "Ann"}).Body)
require.Equal(t, "Ann flagged XYZ: bad rip", render(KindQuarantineFlagged, Payload{Name: "XYZ", Actor: "Ann", Reason: "bad rip"}).Body)
}
func TestRender_CoalescedCountsReadNaturally(t *testing.T) {
@@ -56,8 +56,8 @@ func TestRender_CoalescedCountsReadNaturally(t *testing.T) {
// A notice says which, not only how many.
func TestRender_NamesWhatChanged(t *testing.T) {
require.Equal(t, "No longer on disk: Weezer – Buddy Holly.",
render(KindTracksMissing, Payload{Count: 1, Items: []string{"Weezer – Buddy Holly"}}).Body)
require.Equal(t, "No longer on disk: Glasshouse – Lucky Penny.",
render(KindTracksMissing, Payload{Count: 1, Items: []string{"Glasshouse – Lucky Penny"}}).Body)
require.Equal(t, "No longer on disk: A – 1 and B – 2.",
render(KindTracksMissing, Payload{Count: 2, Items: []string{"A – 1", "B – 2"}}).Body)
// Three are named; the rest of the count, not only the rest of the
@@ -67,8 +67,8 @@ func TestRender_NamesWhatChanged(t *testing.T) {
require.Equal(t, "12 new duplicates to review", render(KindDuplicatesFound, Payload{Count: 12}).Title)
require.Equal(t, "Extra copies removed, the right one kept: A and B.",
render(KindDuplicatesResolved, Payload{Count: 2, Items: []string{"A", "B"}}).Body)
require.Equal(t, "Failed to play: Weezer – Buddy Holly (alice).",
render(KindPlaybackErrors, Payload{Count: 1, Items: []string{"Weezer – Buddy Holly (alice)"}}).Body)
require.Equal(t, "Failed to play: Glasshouse – Lucky Penny (alice).",
render(KindPlaybackErrors, Payload{Count: 1, Items: []string{"Glasshouse – Lucky Penny (alice)"}}).Body)
}
func TestRender_RowsFromBeforeItemsReadAsTheyDid(t *testing.T) {
@@ -91,5 +91,5 @@ func TestRender_AnUnreadablePayloadStillRenders(t *testing.T) {
}
func TestPayloadMap_DropsEmptyFields(t *testing.T) {
require.Equal(t, map[string]any{"name": "WWW", "count": float64(2)}, Payload{Name: "WWW", Count: 2}.Map())
require.Equal(t, map[string]any{"name": "XYZ", "count": float64(2)}, Payload{Name: "XYZ", Count: 2}.Map())
}