feat(tpagectl): implement preview list subcommand #575
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!575
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/cli-preview-list"
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 listend to end: the daemon's missingGET /api/v1/sites/{name}/previewsendpoint plus the tpagectlpreview listsubcommand.Daemon
SiteService.Previews(ctx, siteName)returns a site's preview deployments (branch-based versions) via the existingisPreviewDeploymenthelper;ErrNotFoundwhen the site is missing.GET /api/v1/sites/{name}/previewshandler (#218): owner-scoped (403), 404, 200 with[]Deployment.CLI
SITEor--siteflag (the shared--siteissue was completed underdeployment list)./api/v1/sites/{name}/previewsdecoded into apreviewRecord(yaml tags for snake_case structured output)./preview/{branch}.--format(#220):table(default),json,yaml.--site/positional forms, JSON round-trip, YAML output, 404, missing arg.Why
Phase 4 roadmap task #221.
Testing
--site/positional, json/yaml, 404, missing arggo test -race ./...passes (19 packages)golangci-lint runcleanBreaking Changes
None.
SiteServicegainsPreviews(already implemented by the concrete type).Notes
The new previews endpoint also unblocks
site getpreview display (#181, previously deferred); that remains a separate follow-up. The remaining preview subcommands (deploy,delete,get) are still stubs tracked by their own issues.Closes #217
Closes #218
Closes #219
Closes #220
Closes #221
Add the daemon GET /api/v1/sites/{name}/previews endpoint and the tpagectl preview list subcommand. Daemon: SiteService.Previews returns a site's preview deployments (branch-based versions) via the existing isPreviewDeployment helper, 404 when the site is missing. The handler is owner-scoped and returns 200 with the preview list. CLI: preview list takes a positional site name or --site flag, fetches the previews, and renders a table of branch, path, status, and last updated, with --format (table, json, yaml). The preview path is derived as /preview/{branch}.Record completion of the tpagectl preview list subcommand and its daemon endpoint: positional site name or --site, GET /api/v1/sites/{name}/previews, table of branch/path/status/last updated, and --format. The shared --site subtask #217 was completed under deployment list. closes #217 closes #218 closes #219 closes #220 closes #221Summary
preview list: daemonGET /api/v1/sites/{name}/previews+ tpagectl subcommand. Verified:go test -race ./...passes (19 packages) andgolangci-lint run ./...is clean. Closes #217-221.Verified:
previewRecordmirrors the daemonDeploymentpayload (JSON + yaml tags); the service returns an empty[]rather thannullwhen a site has no previews; handler error mapping (403/404/500) is consistent with the other endpoints.No blocking issues; no new issues filed (remaining items are recurring gaps already tracked).
Questions
internal/site/service.go(Previews) filters withisPreviewDeployment(!HasPrefix("v")), whileCleanupPreviewsusesHasPrefix("test/"). A production deployment at a non-vtag (promotable viadeployment promote --version <non-v-tag>, #568) would be misclassified and appear inpreview list. Consider aligning the preview-vs-production convention (extends #568).References (covered by existing issues)
internal/tpagectl/preview/list.go– the 404→friendly mapping is now a seventh inline copy (extends #565/#561); invalid--formatand non-404 passthrough remain untested (recurring gaps #566/#571).Praise
Previewsservice using the existingisPreviewDeploymenthelper, with production deployments explicitly excluded in testspreviewPathderivation is simple and correct--site/positional, JSON round-trip, snake_case YAML, 404, missing-arg