feat(site): implement rollback capability #322
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!322
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/rollback"
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
Add rollback when a version tag is deleted:
afterSHA toSiteService.Rollback(previously tag deletion fell through toPublish).Rollbacklists the repository tags and selects the highest remainingv*viapkg/version.Highest.Rollbackupdates the Kubernetes resources viaKubernetesService.PublishSiteand records an activeDeploymentat the reselected version.AuditEventmodel +AuditRepository(in-memory). Publish, preview, and rollback actions record events (AuditPublish,AuditPreview,AuditRollback). Wired throughNewService.Why
Phase 7 task #93 — rolling back a site when its latest version tag is removed.
Testing
go build ./...go vet ./...go test -race ./...—Rollback(happy path, no tags, unknown site), audit recording on publish + rollback, audit repository, receiver tag-deletion routing; full suite passesgofmt -l ./cmd ./internal ./pkgcleangolangci-lint run— 0 issuesBreaking Changes
None.
Notes
RollbackreusesPublishSite; content population into the serving volume remains deferred (same limitation as #73).Closes #89
Closes #90
Closes #91
Closes #92
Closes #93
Review Summary
Verified locally on the PR head (
58750c9):go build,go vet,gofmt,golangci-lint runall clean; full suite passes with-race(Rollback happy/no-tags/unknown-site, audit recording, audit repo, receiver tag-deletion routing).Clean, correct implementation. The receiver now routes tag deletions (
IsTag+IsDeleted) toRollback— closing the gap I flagged in #142/#144 where tag deletions fell through to a redundantPublish.Rollbackreselects the highest remainingv*(the deleted tag is absent fromListTags), republishes, and records an active deployment plus arollbackaudit event. TheAuditRepository(in-memory, newest-first) andlogAuditwiring across publish/preview/rollback are tidy, and allNewServicecall sites were updated consistently.No blocking issues.
Non-blocking observations:
logAuditsilently drops errors (_ = s.audit.Create(...)) — deliberate best-effort design so audit failure can't fail a publish, but worth documenting once a persistent audit store lands.RollbackandPublishare nearly identical apart from the audit event and error message — the shared "select highest tag + PublishSite + record deployment" path could be factored out once content population (#73's deferred follow-on) lands.SITE_VERSIONstays hardcoded) — acknowledged deferral; the "rollback" currently re-upserts identical resources.Approving.