feat(tpagectl): implement preview get subcommand #579
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!579
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/cli-preview-get"
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 getend to end: the daemon's missingGET /api/v1/sites/{name}/preview/{branch}endpoint plus the tpagectlpreview getsubcommand. This completes the Phase 4 preview command group.Daemon
SiteService.Preview(ctx, siteName, branch)returns a specific preview deployment,ErrNotFoundwhen the site, deployment, or preview is missing (a non-preview deployment, e.g. a production tag, is treated as not found).GET /api/v1/sites/{name}/preview/*branchhandler (#233): owner-scoped (403), 404, 200 with theDeployment. Uses a wildcard branch segment sotest/*branch names route correctly.CLI
--site(required),--branch(required)./api/v1/sites/{name}/preview/{branch}decoded into apreviewRecord./preview/{branch}).preview "X" for site "Y" not found); missing--site/--brancherrors.--site, missing--branch.Why
Phase 4 roadmap task #235; the final preview command.
Testing
--site/--branchgo test -race ./...passes (19 packages)golangci-lint runcleanBreaking Changes
None.
SiteServicegainsPreview.Notes
All four preview subcommands are now implemented, so the preview package's
errNotImplementedstub sentinel and its test are removed. The per-preview endpoint also supports the deferredsite getpreview display (#181) as a follow-up.Closes #232
Closes #233
Closes #234
Closes #235
Add the daemon GET /api/v1/sites/{name}/preview/{branch} endpoint and the tpagectl preview get subcommand. This completes the Phase 4 preview command group. Daemon: SiteService.Preview returns a specific preview deployment, ErrNotFound when the site, deployment, or preview is missing. The handler is owner-scoped and uses a wildcard branch segment so branch names with slashes (test/*) route correctly. CLI: preview get takes --site and --branch (required), fetches the preview, and prints its status, commit, deployed time, and URL. The preview package stub sentinel and its test are removed now that all preview subcommands are implemented.Record completion of the tpagectl preview get subcommand and its daemon endpoint: --site/--branch flags, GET /api/v1/sites/{name}/preview/{branch}, and status/URL display. This completes the Phase 4 preview command group. closes #232 closes #233 closes #234 closes #235Summary
preview get: daemonGET /api/v1/sites/{name}/preview/{branch}+ tpagectl subcommand, completing the Phase 4 preview group. Verified:go test -race ./...passes (19 packages) andgolangci-lint run ./...is clean. Closes #232-235.Verified correctness:
Service.Previewrejects non-preview deployments (a productionv*tag returnsErrNotFound, covered byTestPreviewNonPreviewDeployment); wildcard*branchrouting with leading-slash strip is consistent withdeletePreview(#577); thepreviewURLhelper is reused within the package.No blocking issues; no new issues filed (remaining items are recurring gaps already tracked).
References (covered by existing issues)
internal/tpagectl/preview/get.go– the 404→friendly mapping is now a tenth inline copy (extends #565/#561); non-404 passthrough remains untested (#571);Previewfilters withisPreviewDeployment(!HasPrefix("v")), so a production deployment at a non-vtag would be returned as a "preview" — reinforces the #568/#575 question.Praise
preview delete, reusable for the deferredsite getpreview display (#181)errNotImplementedremoval tidily completes the group; webhook fake updated--site/--branch