feat(tpagectl): implement deployment rollback subcommand #570
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!570
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/cli-deployment-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
Implements
deployment rollbackend to end: the daemon's missingPOST /api/v1/sites/{name}/rollbackendpoint plus the tpagectldeployment rollbacksubcommand. This completes the Phase 3 deployment command group.Daemon
SiteService.Rollback(ctx, siteName, version)now accepts an optional version: empty selects the highest remainingv*tag (preserving the webhook tag-deletion path, which passes""); a non-empty version must be an existing tag, else a validation error (→ 400).POST /api/v1/sites/{name}/rollbackhandler (#211): owner-scoped (403), 200 with the newDeployment, 400 on invalid body / unknown tag / no tags, 404 when the site is missing.CLI
--site(required),--to-version(optional; latest if omitted),--force.Roll back site "X"? [y/N]viacmd.Root().Readerunless--force; aborts on no/empty input./api/v1/sites/{name}/rollbackbody{"to_version": ...}.Rolled back site "X": vPrev -> vNew.--siteerror.--forcehappy path (path + body + prev/new output), confirm-yes, confirm-no abort (no POST), default version, 404, missing--site.Why
Phase 3 roadmap task #214; the final deployment command.
Testing
--sitego test -race ./...passes (18 packages)golangci-lint runcleanBreaking Changes
SiteService.Rollbacksignature gains aversionparameter; the webhook receiver and test fakes were updated accordingly (empty string preserves existing behavior).Notes
With all four subcommands implemented, the deployment package's
errNotImplementedstub sentinel and its test are removed.Closes #210
Closes #211
Closes #212
Closes #213
Closes #214
Add the daemon POST /api/v1/sites/{name}/rollback endpoint and the tpagectl deployment rollback subcommand. Daemon: SiteService.Rollback now takes an optional version - empty selects the highest remaining v* tag (preserving webhook behavior, which passes empty), otherwise the version must be an existing tag. The handler is owner-scoped and returns 200 with the new deployment, 400 on unknown tags or no tags, 404 when the site is missing. CLI: deployment rollback takes --site (required), optional --to-version (latest if omitted), and --force to skip confirmation. It prompts for confirmation, posts to the rollback endpoint, and prints the previous and new active versions.Record completion of the tpagectl deployment rollback subcommand and its daemon endpoint: --site with optional --to-version, confirmation with --force, POST /api/v1/sites/{name}/rollback, and display of the previous and new active versions. This completes the Phase 3 deployment command group. closes #210 closes #211 closes #212 closes #213 closes #214Summary
deployment rollback: daemonPOST /api/v1/sites/{name}/rollback+ tpagectl subcommand, withSiteService.Rollbackgaining a version parameter. Verified:go test -race ./...passes (18 packages) andgolangci-lint run ./...is clean. Closes #210-214, completing the Phase 3 deployment group.Verified correctness:
selectVersionreuse keeps version semantics consistent with promote (empty → highestv*, explicit → must exist, else 400); handler maps ErrNotFound→404 and "has no "→400; rollback response is the daemonDeployment; the webhook tag-deletion path is preserved viaRollback(..., "").No blocking issues.
Suggestions (filed as issues)
internal/tpagectl/deployment/rollback_test.go– non-404 error passthrough (500/403) untested; recurring gap (see #554, #557, #566). Filed as #571References (covered by existing issues)
internal/tpagectl/deployment/rollback.go:52– previous-version status GET is best-effort and its error is dropped (err == nil && status.CurrentDeployment != nil→ "unknown" fallback); same pattern as #569.confirmRollbackduplicatesconfirmDelete; the inline 404 mapping is now a sixth copy;deploymentSiteStatusnear-duplicates promote'ssiteStatus— extends #565/#561.selectVersion.Praise
selectVersionreuse between promote and rollbackRollbacksignature handled cleanly across the webhook receiver and all test fakessite delete(y/N, abort on no/empty,--force)errNotImplementedremoval tidily completes the group