Repository navigation
Fix empty FORMAT column in library search - #6
Merged
Merged
Conversation
The Album struct mapped Format to json:"format", but the backend returns the field as "format_name". The tag never matched, so Format decoded to "" and the table's FORMAT column was always blank (--json was unaffected, since it passes raw bytes through). Correct the tag to json:"format_name", fix the test fixture's key to match the real server response, and add a Format assertion so the mismatch can't silently regress. Also document red-green TDD (including for bug fixes) in CLAUDE.md's testing conventions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wxyc library searchalways rendered an emptyFORMATcolumn in table mode.Root cause: the
Albumstruct mappedFormatto the JSON key"format", but the backend actually returns the field as"format_name". The tag never matched, soFormatdecoded to"".--jsonwas unaffected because it passes the raw server bytes straight through — the data only vanished in the table projection.Changes
internal/api/types.go—json:"format"→json:"format_name".internal/api/endpoints_test.go— correct the test fixture's key toformat_name(mirroring the real server response) and add aFormat == "vinyl"assertion. The old test never checkedFormat, which is how this slipped through.CLAUDE.md— document red-green TDD (including for bug fixes) in the testing conventions.Testing
go test ./...— passgo vet ./...— cleanwxyc library search --artist "Miles Davis"now showsvinyl/cd/etc. in the FORMAT column.🤖 Generated with Claude Code