feat(tpagectl): implement preview deploy subcommand #576
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!576
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/cli-preview-deploy"
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
preview deployend to end: the daemon's missingPOST /api/v1/sites/{name}/previewendpoint plus the tpagectlpreview deploysubcommand.Daemon
POST /api/v1/sites/{name}/previewhandler (#223): owner-scoped (403), binds{"branch"}, calls the existingPublishPreviewservice method, returns 200 with theDeployment, 400 on invalid body or previews disabled, 404 when the site is missing.isValidationErrornow maps "disabled" messages (e.g. "site X has previews disabled") to 400.CLI
--site(required),--branch(required),--timeout(default 60s)./api/v1/sites/{name}/previewbody{"branch": ...}.activeor the--timeoutelapses (deploy is synchronous, so usually immediate); timeout returns a clear error.Preview ready for site "X": <site-url>/preview/<branch>(falls back to the path when the site URL is unavailable).previews are disabled for site "X"on 400, missing--site/--branch.--timeout, branch stays building), missing--site, missing--branch.Why
Phase 4 roadmap task #226.
Testing
--site/--branchgo test -race ./...passes (19 packages)golangci-lint runcleanBreaking Changes
None.
isValidationErrorbroadened to also classify "disabled" messages as client errors.Notes
The remaining preview subcommands (
delete,get) are still stubs tracked by their own issues.Closes #223
Closes #224
Closes #225
Closes #226
Closes #232
Add the daemon POST /api/v1/sites/{name}/preview endpoint and the tpagectl preview deploy subcommand. Daemon: the handler binds a branch, calls the existing PublishPreview service method, and returns 200 with the deployment, 400 on invalid body or previews disabled, 404 when the site is missing. isValidationError now maps 'disabled' messages to 400. CLI: preview deploy takes --site and --branch (required) plus --timeout, posts to the preview endpoint, polls the previews list until the branch is active or the timeout elapses, and displays the preview URL built from the site's public URL.Record completion of the tpagectl preview deploy subcommand and its daemon endpoint: --site/--branch flags, POST /api/v1/sites/{name}/preview, wait for readiness with a timeout, and preview URL display. closes #223 closes #224 closes #225 closes #226 closes #232Summary
preview deploy: daemonPOST /api/v1/sites/{name}/preview+ tpagectl subcommand. Verified:go test -race ./...passes (19 packages) andgolangci-lint run ./...is clean. Closes #223-226 + #232.Verified the branch convention is consistent: the webhook passes full
test/…branches toPublishPreview(webhook.go:47-61), which storesVersion: branchraw — so the CLI's--branch test/featurematches the daemon model.No blocking issues; no new issues filed (remaining items are recurring gaps already tracked).
References (covered by existing issues)
internal/tpagectl/preview/deploy.go– the 404→friendly mapping is now an eighth inline copy (extends #565/#561);previewURLswallows the site-status GET error and falls back to the path (pattern from #569);previewSiteStatusnear-duplicates the promote/rollback status structs (#565); non-404/400 passthrough remains untested (#571).Praise
waitForPreviewpolling with deadline and a clean timeout error; aborts onctx.Done()isValidationErrorpreviews are disabled/site not foundmessages--site/--branch, handler 200/400/404