feat: define service interfaces #133
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!133
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/service-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 four service interfaces, each in its module package:
internal/forgejo/service.go—ForgejoService:CreateRepository(returns clone URL),CreateWebhook(returns webhook ID),ListTagsinternal/kubernetes/service.go—KubernetesService:CreateSiteIngress,PublishSite,CreatePreviewIngress,DeletePreview,DeleteSiteinternal/git/service.go—GitService:Clone,Fetch,Checkout,VerifyAssetsinternal/site/service.go—SiteService:Register,Publish,Rollbackplus theRegisterSiteRequeststructAll methods take
ctx context.Contextfirst and use thesitedomain types (site.Site,site.Visibility) to avoid leaking the Forgejo SDK or client-go into service contracts.Why
Phase 2 task #32 — completes the Core Domain Models and Interfaces phase. These contracts are implemented in Phases 3 (Forgejo/Git), 4 (Kubernetes), 5 (HTTP API), and 7 (rollback).
Testing
go build ./...go vet ./...go test -race ./...— passesgofmt -l ./cmd ./internalcleangolangci-lint run— 0 issuesInterfaces have no behavior to unit test; concrete implementations and fakes come in later phases.
Breaking Changes
None.
Notes
SiteService.Registertakes a fullRegisterSiteRequeststruct (owner, visibility, custom domain, preview enabled) matching the Phase 5 registration flow.Closes #28
Closes #29
Closes #30
Closes #31
Closes #32
Review Summary
Verified locally on the PR head (
04ea444):go build,go vet,gofmt,golangci-lint runall clean; full test suite passes with-race.The four service interfaces are well-factored —
ctxfirst everywhere, and the contracts are decoupled from both the Forgejo SDK and client-go by using thesitedomain types (site.Site,site.Visibility) and plain values (clone URL string, webhook IDint64, tag name slice). Method granularity maps cleanly onto the roadmap phases (Forgejo/Git in 3, Kubernetes in 4, HTTP/rollback in 5/7).RegisterSiteRequestas an explicit struct is the right shape for the Phase 5 registration flow.No blocking issues.
Non-blocking observations:
RegisterSiteRequestfields have no JSON tags — fine as an internal service-layer type, but the Phase 5 HTTP handler will need JSON binding. Either add tags then or introduce a separate API DTO.GitService(only Clone/Fetch/Checkout/VerifyAssets) — expected, sincepkg/versionowns that in Phase 3. Consistent.Approving.