dev → main: collage center-crop, server DRY, CI durability-off #80

Merged
bvandeusen merged 3 commits from dev into main 2026-06-04 08:42:36 -04:00
Owner

Three commits on top of the prior PR #79 merge.

Changes

edd198cdfix(server): collage drawScaled uses center-crop instead of stretch

The collage cell scaler was nearest-neighbor stretching non-square album covers to fill a 300×300 cell. Operator saw it on the new_for_you system playlist because album-coherent variants pull fewer unique covers per cell, amplifying the warping. Replaced with cover-fit (preserve aspect, center-crop) matching every other UI surface. Existing collages won't re-render until the next 03:00 system-playlist rebuild.

024493f2refactor(server): unify stream URL builders + MIME tables + cover-path helper

Closes Scribe #614, #615, server half of #616 from the 2026-06-04 divergent-provider audit.

  • streamURL helper used everywhere /api/tracks/{id}/stream is built (was inline concat in playlists.go and cast_token.go). New streamURLWithExt for the .ext cast variant.
  • audioContentType in media.go is the canonical file_format → MIME lookup. mimeForFormat in cast_token.go is a thin wrapper that overrides the unknown-format fallback to audio/mpeg (Sonos rejects octet-stream). Adds mpeg/vorbis/wave aliases. Subsonic's contentTypeForFormat stays frozen.
  • coverart.ResolveAlbumPath extracted; api/media.go and subsonic/stream.go both delegate (was byte-identical duplicate).

28300e19perf(ci): turn off Postgres durability in integration tests

ALTER SYSTEM SET fsync = off / synchronous_commit = off / full_page_writes = off on the throwaway CI Postgres before migrations. Non-fatal so a perms surprise degrades to slow, never red.

Measured before/after on CI runs 474 vs 486:

Package Before After Speedup
integration job wall 10m34s 4m27s 2.4×
go test portion 7m24s 2m16s 3.7×
internal/api 225s 29s 7.8×
internal/recommendation 39s 3.7s 10.5×
internal/playlists 39s 8.3s 4.8×
internal/coverart 21s 4.5s 4.7×

Test plan

  • CI green on dev (already verified at 28300e19)
  • On-device: stream URLs return real TrackDuration from Sonos (server change from PR #79; doubles down here)
  • System playlist collages re-render without stretching after next 03:00 rebuild (or force a regen via /api/playlists/system/{kind}/refresh)

🤖 Generated with Claude Code

Three commits on top of the prior PR #79 merge. ## Changes ### `edd198cd` — `fix(server): collage drawScaled uses center-crop instead of stretch` The collage cell scaler was nearest-neighbor stretching non-square album covers to fill a 300×300 cell. Operator saw it on the `new_for_you` system playlist because album-coherent variants pull fewer unique covers per cell, amplifying the warping. Replaced with cover-fit (preserve aspect, center-crop) matching every other UI surface. Existing collages won't re-render until the next 03:00 system-playlist rebuild. ### `024493f2` — `refactor(server): unify stream URL builders + MIME tables + cover-path helper` Closes Scribe #614, #615, server half of #616 from the 2026-06-04 divergent-provider audit. - `streamURL` helper used everywhere `/api/tracks/{id}/stream` is built (was inline concat in `playlists.go` and `cast_token.go`). New `streamURLWithExt` for the `.ext` cast variant. - `audioContentType` in `media.go` is the canonical `file_format → MIME` lookup. `mimeForFormat` in `cast_token.go` is a thin wrapper that overrides the unknown-format fallback to `audio/mpeg` (Sonos rejects octet-stream). Adds `mpeg`/`vorbis`/`wave` aliases. Subsonic's `contentTypeForFormat` stays frozen. - `coverart.ResolveAlbumPath` extracted; `api/media.go` and `subsonic/stream.go` both delegate (was byte-identical duplicate). ### `28300e19` — `perf(ci): turn off Postgres durability in integration tests` `ALTER SYSTEM SET fsync = off / synchronous_commit = off / full_page_writes = off` on the throwaway CI Postgres before migrations. Non-fatal so a perms surprise degrades to slow, never red. **Measured before/after on CI runs 474 vs 486:** | Package | Before | After | Speedup | |---|---|---|---| | integration job wall | 10m34s | 4m27s | 2.4× | | `go test` portion | 7m24s | 2m16s | 3.7× | | `internal/api` | 225s | 29s | 7.8× | | `internal/recommendation` | 39s | 3.7s | 10.5× | | `internal/playlists` | 39s | 8.3s | 4.8× | | `internal/coverart` | 21s | 4.5s | 4.7× | ## Test plan - [ ] CI green on `dev` (already verified at `28300e19`) - [ ] On-device: stream URLs return real `TrackDuration` from Sonos (server change from PR #79; doubles down here) - [ ] System playlist collages re-render without stretching after next 03:00 rebuild (or force a regen via `/api/playlists/system/{kind}/refresh`) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bvandeusen added 3 commits 2026-06-04 08:42:22 -04:00
fix(server): collage drawScaled uses center-crop instead of stretch
test-go / test (push) Successful in 27s
test-go / integration (push) Has been cancelled
edd198cdf5
refactor(server): unify stream URL builders + MIME tables + cover-path helper
test-go / test (push) Successful in 28s
test-go / integration (push) Has been cancelled
024493f2a7
Closes Scribe #614, #615, server half of #616 surfaced by the 2026-06-04 divergent-provider audit.

- streamURL helper now used everywhere /api/tracks/{id}/stream is built (was inline concat in playlists.go and cast_token.go); add streamURLWithExt for the .ext cast variant.

- audioContentType in media.go is the canonical file_format -> MIME lookup; mimeForFormat in cast_token.go is now a thin wrapper that overrides the unknown-format fallback to audio/mpeg (Sonos rejects octet-stream). Adds mpeg/vorbis/wave aliases. Subsonic's contentTypeForFormat stays frozen per docs.

- coverart.ResolveAlbumPath extracted; api and subsonic both delegate to it.
perf(ci): turn off Postgres durability in integration tests
test-go / test (push) Successful in 28s
test-go / integration (push) Successful in 4m27s
28300e19fd
TRUNCATE-everything ResetDB before every test forces a commit fsync; the CI DB is rebuilt each run so durability buys nothing. ALTER SYSTEM via docker exec (the services: block can't override the postgres command line). Non-fatal so a perms surprise degrades to slow, never red.

Per the playbook the operator shared from another project (~17x speedup observed there). Measure before/after in the next two CI runs.
bvandeusen merged commit 222a0ff636 into main 2026-06-04 08:42:36 -04:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bvandeusen/minstrel#80