fix: remove dead BuildingRepository.GetByBuildingCode#14
Merged
Conversation
It cannot correctly populate a struct from any table shape: its unquoted WHERE clause only matches unquoted (lowercased) columns, which TableConstructor never produces, and even when a row is found, populateStructFromMap looks values up by the mixed-case JSON tag while Postgres returns unquoted columns lowercased - so fields stay zero either way. Nothing calls it or NewIgnisServiceWithDB in production; all real building lookups go through TabulaRepository, which uses quoted, case-correct queries and is unaffected. The shared struct-mapping helpers it depended on move to struct_mapper.go, still used by TabulaRepository.GetVariant. Closes #13 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Removes
BuildingRepository/GetByBuildingCode/NewIgnisServiceWithDB— closes #13.While writing repository integration tests in #12, found this path was doubly broken: its unquoted
WHERE code_buildingvariant = $1can't match the quoted mixed-case columnsTableConstructoractually creates, and even on a table shaped to match the filter,populateStructFromMaplooked values up by the mixed-case JSON tag while Postgres returns unquoted columns lowercased, so fields never populated either way.It was unreachable from any handler (only wired via
NewIgnisServiceWithDB, which nothing called), so this is dead-code removal, not a behavior change. The shared struct-mapping helpers it depended on move tostruct_mapper.go, still used byTabulaRepository.GetVariant.TabulaRepository(used by all real handlers) already used quoted, case-correct queries and is unaffected.This was originally the second commit on #12's branch, but #12 was merged before that commit landed, so it never reached
main— re-submitting it here on top of currentmain.Test plan
go build ./...go vet ./...andgo vet -tags integration ./...go test ./...— all packages passgo test -tags integration -timeout 5m ./internal/utils/ ./internal/db/ ./internal/db/repository/— all pass against a local Docker PostgresCloses #13
🤖 Generated with Claude Code