Skip to content

fix: remove dead BuildingRepository.GetByBuildingCode#14

Merged
jravani merged 1 commit into
mainfrom
fix/remove-dead-buildingrepository
Jul 24, 2026
Merged

fix: remove dead BuildingRepository.GetByBuildingCode#14
jravani merged 1 commit into
mainfrom
fix/remove-dead-buildingrepository

Conversation

@jravani

@jravani jravani commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

Removes BuildingRepository/GetByBuildingCode/NewIgnisServiceWithDBcloses #13.

While writing repository integration tests in #12, found this path was doubly broken: its unquoted WHERE code_buildingvariant = $1 can't match the quoted mixed-case columns TableConstructor actually creates, and even on a table shaped to match the filter, populateStructFromMap looked 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 to struct_mapper.go, still used by TabulaRepository.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 current main.

Test plan

  • go build ./...
  • go vet ./... and go vet -tags integration ./...
  • go test ./... — all packages pass
  • go test -tags integration -timeout 5m ./internal/utils/ ./internal/db/ ./internal/db/repository/ — all pass against a local Docker Postgres

Closes #13

🤖 Generated with Claude Code

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-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jravani
jravani merged commit 31259d8 into main Jul 24, 2026
5 checks passed
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.

BuildingRepository.GetByBuildingCode cannot correctly populate a struct from any table shape

2 participants