feat(site): implement site status API #143
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!143
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/site-status-api"
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
Implement the site status and deployment history endpoints:
GET /api/v1/sites/{name}(#76) — returns aSiteStatus(the site plus its current deployment, i.e. newest deployment;current_deploymentomitted when none exists).404for unknown sites.GET /api/v1/sites/{name}/deployments(#77) — returns the deployment history, newest first.404for unknown sites.SiteServicegains:Status(ctx, siteName) (*SiteStatus, error)—sites.Get→deployments.ListBySite(newest first) → first entry as current deploymentDeployments(ctx, siteName) ([]Deployment, error)— 404 viasites.Get, thendeployments.ListBySitehttpapiregisters the two GET routes on the existing sites handler; both return200on success and404for unknown sites.Why
Phase 5 task #78 — completes the HTTP Server and API phase; these endpoints let operators inspect a site's deployment state.
Testing
go build ./...go vet ./...go test -race ./...— 6 new site service tests (status with/without deployment, unknown site; history ordering, unknown site) + 4 handler tests; full suite passesgofmt -l ./cmd ./internal ./pkgcleangolangci-lint run— 0 issuesBreaking Changes
None.
Notes
SiteStatusembedsSitewith an optionalCurrentDeployment.Closes #76
Closes #77
Closes #78
Review Summary
Verified locally on the PR head (
7281689):go build,go vet,gofmt,golangci-lint runall clean; full suite passes with-race(6 new service tests + 4 handler tests).Clean, correct implementation.
Statuscomposessites.Get+deployments.ListBySite(newest first) with the first entry asCurrentDeployment(omitted when none), andDeploymentspreserves the 404-on-unknown-site semantics. The embedded-SiteSiteStatusserializes flat with the optionalcurrent_deploymentfield, and the gin routes (/api/v1/sites/:nameand/api/v1/sites/:name/deployments) don't conflict with the existingPOST /api/v1/sites. Handlers mapErrNotFound→ 404 correctly.No blocking issues.
Non-blocking observations:
DeployedAt; sincePublishstampstime.Now(), this is sound today, but a distinct active/status flag will be needed once failed/pending states exist (Phase 6/7).Approving.