docs: server comments say what the code does, not how it came to be (#6277)
Comment blocks in cmd/minstrel and 30 smaller internal packages, rewritten
to rule 32's standard with each citation read in context: task, milestone
and rule ids go, and so do the stories they were attached to ("used to",
"Before #N", measurements from one install, quotes, pointers to Fabled
Librarian's records and to docs/superpowers files that are not in the
repo). Where a story wrapped a real constraint, the constraint stays as a
present-tense fact.
Comments that had gone stale are corrected:
- taste.Config: the tuned values are overlaid by internal/recsettings;
it is no longer "a later follow-up".
- StorageConfig: the data dir holds art, caches and the stream secret,
not only playlist covers.
- the Subsonic album list and getUser comments describe what they do
today rather than a milestone that would change it.
Checked: the non-comment token stream of every changed file matches
HEAD, and gofmt -l is empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+12
-22
@@ -24,12 +24,10 @@ type Config struct {
|
||||
Recommendation RecommendationConfig `yaml:"recommendation"`
|
||||
Branding BrandingConfig `yaml:"branding"`
|
||||
// StreamSecret is the base64-decoded HMAC key used to sign UPnP /
|
||||
// Sonos stream URLs (see internal/api/stream_token.go and
|
||||
// docs/superpowers/specs/2026-06-03-android-output-picker-upnp-design.md).
|
||||
// Sourced from MINSTREL_STREAM_SECRET (base64-encoded), with a
|
||||
// per-machine fallback persisted at <Storage.DataDir>/stream_secret.
|
||||
// Not serialized to YAML — operator-machine-scoped runtime state, not
|
||||
// a user-facing setting. Never log the contents.
|
||||
// Sonos stream URLs (see internal/api/stream_token.go). Sourced from
|
||||
// MINSTREL_STREAM_SECRET (base64-encoded), with a per-machine fallback
|
||||
// persisted at <Storage.DataDir>/stream_secret. Not read from YAML: it
|
||||
// is per-machine state, not a setting. Never log the contents.
|
||||
StreamSecret []byte `yaml:"-"`
|
||||
}
|
||||
|
||||
@@ -37,12 +35,8 @@ type ServerConfig struct {
|
||||
Address string `yaml:"address"`
|
||||
}
|
||||
|
||||
// StorageConfig points at on-disk locations the server uses for cached
|
||||
// runtime artifacts. Currently:
|
||||
// - DataDir hosts <DataDir>/playlist_covers/{playlist_id}.jpg (M7 #352).
|
||||
//
|
||||
// More entries may grow here (e.g., transcode cache) without breaking
|
||||
// existing layouts.
|
||||
// StorageConfig points at the on-disk root for generated files: playlist
|
||||
// cover collages, artwork, caches and the stream secret.
|
||||
type StorageConfig struct {
|
||||
// DataDir is the root for cached artifacts. Default: "./data" (relative
|
||||
// to the working directory). Operators in production should set an
|
||||
@@ -88,10 +82,9 @@ type EventsConfig struct {
|
||||
SkipMaxDurationPlayedMs int `yaml:"skip_max_duration_played_ms"`
|
||||
}
|
||||
|
||||
// RecommendationConfig holds the radio path's operational knobs. The
|
||||
// scoring WEIGHTS moved to DB-backed admin settings (#1250,
|
||||
// internal/recsettings) — YAML is bootstrap-only; anything an operator
|
||||
// tunes lives in the UI with live effect.
|
||||
// RecommendationConfig holds the radio path's operational knobs. The scoring
|
||||
// weights are DB-backed admin settings (internal/recsettings), tuned in the
|
||||
// UI with live effect.
|
||||
type RecommendationConfig struct {
|
||||
RecentlyPlayedHours int `yaml:"recently_played_hours"`
|
||||
RadioSize int `yaml:"radio_size"`
|
||||
@@ -120,8 +113,7 @@ func Default() Config {
|
||||
},
|
||||
Library: LibraryConfig{
|
||||
// On by default so a fresh install populates its library on
|
||||
// first boot without the operator hunting for a "scan now"
|
||||
// button. Scans are incremental (unchanged files skipped by
|
||||
// first boot with no manual step. Scans are incremental (unchanged files skipped by
|
||||
// mtime), so every later restart is just a cheap directory walk.
|
||||
ScanOnStartup: true,
|
||||
CoverArtFromMBCAA: true,
|
||||
@@ -159,15 +151,13 @@ const streamSecretBytes = 64
|
||||
const streamSecretFile = "stream_secret"
|
||||
|
||||
// resolveStreamSecret populates cfg.StreamSecret using, in order:
|
||||
// 1. MINSTREL_STREAM_SECRET env var (operator-supplied, base64-url
|
||||
// encoded — accepts either padded or raw form).
|
||||
// 1. MINSTREL_STREAM_SECRET env var (base64-url encoded — accepts either padded or raw form).
|
||||
// 2. <Storage.DataDir>/stream_secret if present (auto-generated on a
|
||||
// previous boot; survives restarts so signed URLs stay valid).
|
||||
// 3. Auto-generate streamSecretBytes random bytes, persist them to that
|
||||
// file at 0600, then use them.
|
||||
//
|
||||
// Logs (only) when an auto-generation happens so the operator can spot
|
||||
// it during first-boot. Never logs the contents.
|
||||
// Logs (only) when an auto-generation happens, so it shows on first boot. Never logs the contents.
|
||||
//
|
||||
// The loader runs before slog is initialized in cmd/minstrel/main.go;
|
||||
// log.Printf is the project's pre-logger convention.
|
||||
|
||||
Reference in New Issue
Block a user