api tests hash passwords at bcrypt's lowest cost; one genre splitter (#8330, #8331)
release / web (push) Successful in 1m30s
release / go (push) Successful in 1m55s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 2m43s
release / android (push) Successful in 4m31s
release / Build signed APK (push) Successful in 5m0s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Build + push container image (push) Successful in 13s
release / Verify release artifacts (tag releases only) (push) Skipped

#8330: every password the api handlers store goes through hashPassword at
bcrypt.DefaultCost, most of a second per hash under -race, so the password
tests took about 1.4s each, roughly 15s of the package. The cost is now a
package variable the tests' TestMain lowers to MinCost, after refusing a
production default below bcrypt.DefaultCost.

#8331: recommendation and taste each had a splitGenres and subsonic's
hasGenre split inline, the same rule three times. internal/genretag.Split
is the one copy, a stdlib-only leaf, and the two TestSplitGenres tables
are one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 14:05:33 -05:00
co-authored by Claude Opus 5.5
parent 10b10b8179
commit 6ef96be290
10 changed files with 90 additions and 112 deletions
+3 -5
View File
@@ -13,6 +13,7 @@ import (
"github.com/jackc/pgx/v5/pgxpool"
"github.com/Fabled-Sword/minstrel/internal/db/dbq"
"github.com/Fabled-Sword/minstrel/internal/genretag"
"github.com/Fabled-Sword/minstrel/internal/playlists"
"github.com/Fabled-Sword/minstrel/internal/recommendation"
)
@@ -341,11 +342,8 @@ func randomSongsFilter(ctx context.Context, q *dbq.Queries, genre, fromYear, toY
}
func hasGenre(tagged *string, genre string) bool {
if tagged == nil {
return false
}
for _, g := range strings.FieldsFunc(*tagged, func(r rune) bool { return r == ';' || r == ',' }) {
if strings.EqualFold(strings.TrimSpace(g), genre) {
for _, g := range genretag.Split(tagged) {
if strings.EqualFold(g, genre) {
return true
}
}