Skip to content

Fix empty FORMAT column in library search - #6

Merged
rybesh merged 1 commit into
mainfrom
fix-library-search-format
Jul 11, 2026
Merged

rybesh merged 1 commit into
mainfrom
fix-library-search-format

Conversation

@rybesh

@rybesh rybesh commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

wxyc library search always rendered an empty FORMAT column in table mode.

Root cause: the Album struct mapped Format to the JSON key "format", but the backend actually returns the field as "format_name". The tag never matched, so Format decoded to "". --json was 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 to format_name (mirroring the real server response) and add a Format == "vinyl" assertion. The old test never checked Format, which is how this slipped through.
  • CLAUDE.md — document red-green TDD (including for bug fixes) in the testing conventions.

Testing

  • go test ./... — pass
  • go vet ./... — clean
  • Live: wxyc library search --artist "Miles Davis" now shows vinyl/cd/etc. in the FORMAT column.

🤖 Generated with Claude Code

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>
@rybesh
rybesh merged commit dd1521a into main Jul 11, 2026
1 check passed
@rybesh
rybesh deleted the fix-library-search-format branch July 11, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant