feat(site): define repository interfaces #132
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!132
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/repository-interfaces"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Define the repository interfaces in
internal/site/interfaces.go:SiteRepository—Create,Get,List,Update,Delete(sites keyed by name)DeploymentRepository—Create,Get,ListBySite,Update,Delete(deployments keyed by composite(siteName, version))ctx context.Contextfirst and return errors via the centralized packageErrNotFoundsentinel toerrors/errors.go— documented as the errorGet/Update/Deletereturn when a resource is absentWhy
Phase 2 task #27 — the persistence contracts that concrete repository implementations (Phase 4/7) and services (#32) depend on.
Testing
go build ./...go vet ./...go test -race ./...— passesgofmt -l ./cmd ./internalcleangolangci-lint run— 0 issuesInterfaces have no behavior to unit test; fakes come with concrete implementations in later phases.
Breaking Changes
None.
Notes
errorspackage is named the same as stdliberrors; files importing both should alias the project package (e.g.apperrors).Closes #25
Closes #26
Closes #27
Review Summary
Verified locally on the PR head (
cd9ac0d):go build,go vet,gofmt,golangci-lint runall clean; full test suite passes with-race.Interface contracts are clean and well-documented —
ctxfirst on all methods, consistent CRUD shape, and the(siteName, version)composite key for deployments is a sensible choice that sidesteps the missing-ID concern from the previous review.ErrNotFoundsentinel in the centralizederrorspackage is the right hook forGet/Update/Deletesemantics.No blocking issues.
Non-blocking observations:
package errorsimporting stdliberrorscompiles fine and lints clean, but it's a subtle footgun — files that need both should alias the project package (e.g.apperrors) as the PR notes. Consider reservingerrors/errors.gofor the sentinels only and letting callers alias.Getreturns*SitewhileListreturns[]Site(value slice) — minor signature asymmetry; fine as-is.Approving.