docs: query comments say what each query selects and why, not how it came to be (#6277)
Rewrites the internal/db/queries comments to rule 32 and regenerates dbq, whose doc comments and embedded SQL carry them. The bugs behind the tiered mixes, the md5 order seed, the score bands and the round-robin arms are restated as the constraint each one enforces; counts from one library and stale cross-references are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ UPDATE artists
|
||||
AND artist_art_source = 'none'
|
||||
`
|
||||
|
||||
// M7 cover-sources: parallel of ClearAlbumCoverNone. Used by the
|
||||
// Parallel of ClearAlbumCoverNone. Used by the
|
||||
// eligibility loop to flip stale 'none' rows back to NULL.
|
||||
func (q *Queries) ClearArtistArtNone(ctx context.Context, id pgtype.UUID) error {
|
||||
_, err := q.db.Exec(ctx, clearArtistArtNone, id)
|
||||
@@ -56,7 +56,7 @@ WHERE a.id = $1
|
||||
RETURNING a.id
|
||||
`
|
||||
|
||||
// M7 #372: deletes the artist row only when it has no remaining albums
|
||||
// Deletes the artist row only when it has no remaining albums
|
||||
// AND no remaining tracks (defensive — tracks can in principle exist
|
||||
// without an album, though the scanner doesn't write that shape today).
|
||||
func (q *Queries) DeleteArtistIfEmpty(ctx context.Context, id pgtype.UUID) (pgtype.UUID, error) {
|
||||
@@ -253,7 +253,7 @@ type ListArtistsAlphaWithCoversRow struct {
|
||||
AlbumCount int64
|
||||
}
|
||||
|
||||
// M6a: alpha-sorted artist list with derived cover_album_id (most-recent
|
||||
// Alpha-sorted artist list with derived cover_album_id (most-recent
|
||||
// album whose cover_art_path is set). Replaces ListArtistsAlpha for the
|
||||
// /api/artists?sort=alpha branch — the new column is appended, so the
|
||||
// alpha branch is purely additive on the wire. album_count is computed
|
||||
@@ -305,7 +305,7 @@ type ListArtistsMissingArtParams struct {
|
||||
Limit int32
|
||||
}
|
||||
|
||||
// M7 cover-sources: returns artist rows the artist-art enricher should
|
||||
// Returns artist rows the artist-art enricher should
|
||||
// attempt. Eligible: artist_art_source IS NULL OR (= 'none' AND stale
|
||||
// artist_art_sources_version). MBID-less artists are returned but the
|
||||
// enricher skips them at the row.mbid == nil guard inside the chain.
|
||||
@@ -432,7 +432,7 @@ type SetArtistArtWithVersionParams struct {
|
||||
ArtistArtSourcesVersion int32
|
||||
}
|
||||
|
||||
// M7 cover-sources: records a successful or settled artist-art
|
||||
// Records a successful or settled artist-art
|
||||
// enrichment with the current sources_version stamp. thumb_path /
|
||||
// fanart_path are NULL on a 'none' result, or independently NULL if
|
||||
// the provider returned only one of the two image types (e.g.
|
||||
@@ -460,7 +460,7 @@ type SetArtistMbidIfNullParams struct {
|
||||
Mbid *string
|
||||
}
|
||||
|
||||
// M7 #379: heal MBID on existing artist rows during rescan. Idempotent —
|
||||
// Heal MBID on existing artist rows during rescan. Idempotent —
|
||||
// only updates when the existing mbid is NULL, so concurrent scans don't
|
||||
// overwrite an existing value with a stale one.
|
||||
func (q *Queries) SetArtistMbidIfNull(ctx context.Context, arg SetArtistMbidIfNullParams) error {
|
||||
|
||||
Reference in New Issue
Block a user