feat: Delete unused Postgres backend (dead code) - Issue #41#86
Open
anota-fernandocosta wants to merge 8 commits into
Open
feat: Delete unused Postgres backend (dead code) - Issue #41#86anota-fernandocosta wants to merge 8 commits into
anota-fernandocosta wants to merge 8 commits into
Conversation
…layer) Remove all 5 files in api/db/postgres/: postgres_handler.go, sql.go, types.go, sql_test.go, and postgres_suite_test.go. These are dead code only referenced by other Postgres-deletion targets (psqlretriever.go and context.go). Builds will temporarily break until subsequent stories fix the callers. Co-Authored-By: Tamandua <tamandua@tetradactyla.org>
Removes the Postgres data retrieval adapter containing: - ConvertStringToSlice helper function - SQLJSONRetrieve methods (Connect, RetrieveFromDB, WriteInDB, PqArray) - Import of github.com/lib/pq This file had a broken import of the already-deleted postgres.SQLGen type. Co-Authored-By: Tamandua <tamandua@tetrandactyla.org>
Removed the PostgresRequests implementation methods and standalone query builder functions (ConfigureQuery, ConfigureInsertQuery, ConfigureUpdateQuery, ConfigureUpsertQuery) along with all their tests. These files are dead code after US-001 (deleted api/db/postgres/) and US-002 (deleted api/db/psqlretriever.go). Co-Authored-By: Tamandua <tamandua@tetrandactyla.org>
- Removed import of deleted github.com/githubanotaai/huskyci-api/api/db/postgres - Removed DataGenerator interface (only implemented by SQLJSONRetrieve, already deleted) - Removed SQLJSONRetrieve struct (only used by Postgres code, already deleted) - Removed PostgresRequests struct (only used by Postgres code, already deleted) - Preserved: Requests interface, MongoRequests struct, JSON interface, JSONCaller struct - go vet ./db/ passes; go test -race ./db/ passes Co-Authored-By: Tamandua <tamandua@tetrandactyla.org>
Remove the Postgres import and GetDB condition branch so that
GetDB unconditionally returns &db.MongoRequests{}. The Postgres
backend was already deleted in prior stories (US-001 through US-004).
Co-Authored-By: Tamandua <tamandua@tetrandactyla.org>
- Remove commented-out postgres service block from deployments/docker-compose.yml - Delete deployments/dockerfiles/postgres.Dockerfile - Delete deployments/huskyci.sql (PostgreSQL database dump) No remaining references to postgres deployment artifacts exist in the repo. All api tests pass. Co-Authored-By: Tamandua <tamandua@tetradactyla.org>
Remove Postgres backend mention and update database paragraph to state MongoDB is the supported production store, with db.Requests preserved for abstraction and testability. Co-Authored-By: Tamandua <tamandua@tetradactyla.org>
- Ran go mod tidy to remove github.com/lib/pq from api/go.mod and api/go.sum - Applied gofmt formatting to 8 files - go vet ./... passes cleanly - golangci-lint shows only pre-existing issues (sha3 inlining in authmongo.go) - go test -race -count=1 ./... all 11 test packages pass - client/go.mod and cli/go.mod unchanged Co-Authored-By: Tamandua <tamandua@tetrandactyla.org>
anota-fernandocosta
left a comment
Contributor
Author
There was a problem hiding this comment.
Review: Approve ✅
This is a clean, well-executed dead code removal. All 8 user stories are completed, the diff is focused, and no behavioral contracts are broken.
What was removed (10 files, ~3,000 lines):
api/db/postgres/(5 files): innermost Postgres implementationapi/db/postgres.go+api/db/postgres_test.go: PostgresRequests and testsapi/db/psqlretriever.go: SQLJSONRetrieve adapter with lib/pq dependencydeployments/dockerfiles/postgres.Dockerfile+deployments/huskyci.sql: deployment artifacts- Commented-out Postgres service in
docker-compose.yml
What was modified correctly:
api/context/context.go: Postgres import + entire GetDB Postgres branch removed. Function now unconditionally returns&db.MongoRequests{}.stringsimport correctly preserved (still used elsewhere).api/db/types.go: DataGenerator, SQLJSONRetrieve, PostgresRequests removed. Requests, MongoRequests, JSON, JSONCaller preserved.timeimport correctly preserved (used in Requests interface).api/go.mod+go.sum:github.com/lib/pqremoved.golang.org/x/netcorrectly moved to indirect (only needed by k8s.io deps now).CLAUDE.md: Updated to state MongoDB is the supported production store,db.Requestspreserved for abstraction/testability.deployments/docker-compose.yml: Postgres service block fully removed.
Incidental gofmt fixes (all benign):
api/auth/types.go,api/context/context_test.go,api/context/gitleaks_env_test.go,api/securitytest/gitleaks_severity.go,api/securitytest/run_test.go,api/securitytest/runner.go,api/securitytest/securitycodescan.go,api/types/types.go: formatting/alignment fixes
CI: All 8 checks pass
Build & Test (api, cli, client) ✅ | Lint ✅ | Docker Build (api, client) ✅ | Deployment shell ✅ | Gitleaks ✅
Non-blocking note:
JSON interface, JSONCaller struct, and api/db/jsoncaller.go are no longer referenced by any production or test code after the Postgres removal. The task spec preserves them — a reasonable choice. Worth considering for a future cleanup pass if they remain unused.
Verdict:
No bugs, no regressions, no missed references. The removal is thorough and the diff is clean. Approving.
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.
Description
Deletes the unused Postgres backend implementation from the codebase. The Postgres backend implemented the same
Requestsinterface as MongoDB but was never wired up in production (the docker-compose Postgres service was commented out).Changes
Deleted (US-001 through US-008):
api/db/postgres/directory (5 files: postgres_handler.go, sql.go, types.go, sql_test.go, postgres_suite_test.go)api/db/psqlretriever.go(SQLJSONRetrieve adapter with lib/pq dependency)api/db/postgres.goandapi/db/postgres_test.go(PostgresRequests implementation + tests)api/db/types.go— removed Postgres-only types (DataGenerator, SQLJSONRetrieve, PostgresRequests); preserved Requests, MongoRequests, JSON, JSONCallerapi/context/context.go::GetDB— removed Postgres branch, now always returns&db.MongoRequests{}deployments/dockerfiles/postgres.Dockerfileanddeployments/huskyci.sql; removed commented-out Postgres service fromdeployments/docker-compose.ymlCLAUDE.md— states MongoDB is the supported production store,db.Requestspreserved for abstraction/testabilitygo mod tidyinapi/— removedgithub.com/lib/pqfrom go.mod and go.sumWhat remains:
db.Requestsinterface (api/db/huskydb.go) — preserved for abstraction and testabilityMongoRequestsstruct (api/db/types.go) — the active MongoDB implementationTesting
cd api && go vet ./...— passes cleanlycd api && go test -race -count=1 ./...— all 10 test packages pass, no race conditionsclient/go.modandcli/go.modunchangedCloses #41