console: getting started needs a served static route on any channel
A static route counts toward step 2 only when its status is ready: a pending record no box serves yet, a route still being set up, failed or held never ticks. The legacy rung check goes, so a custom channel such as production ticks when its own pointer is valid.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+62
−6
internal/console/gettingstarted.go+14 −5internal/console/gettingstarted_test.go+48 −1
Intent
Human
<task-notification> <task-id>b03n9q44j</task-id> <tool-use-id>toolu_01Kq3SZd6HhBb4J91AgHokk4</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1b5840b5-e917-4792-8f16-aa99071d45d6/tasks/b03n9q44j.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra round 1 to finish" completed (exit code 0)</summary> </task-notification>
diff --git a/internal/console/gettingstarted.go b/internal/console/gettingstarted.go| index 73a6a385a..5e13acaee 100644 |
| --- a/internal/console/gettingstarted.go |
| +++ b/internal/console/gettingstarted.go |
| @@ -4,8 +4,6 @@ import ( |
| "log" |
| "strings" |
| "time" |
| - |
| - "github.com/carlosframework/platform/internal/release" |
| ) |
| // personConnected: the person has a live CLI token of their own. Person |
| @@ -21,7 +19,7 @@ func personConnected(tokens []CLIToken, now time.Time) bool { |
| // appIsLive is the one definition of "this app is live" for the checklist: |
| // healthy, and either serving a version from instances or a static site |
| -// whose own channel points at a version. |
| +// that a box serves, whose own channel points at a version. |
| func appIsLive(row appRow, v AppView, acct string) bool { |
| if row.Verdict != "ok" { |
| return false |
| @@ -33,9 +31,20 @@ func appIsLive(row appRow, v AppView, acct string) bool { |
| if rt.Account != acct || rt.Platform || rt.Kind != "static" { |
| continue |
| } |
| + // Observed, not intended: "ready" is the one status a box serves |
| + // (a local row's registry status, or remoteRoute's word for a host |
| + // an accepted report names). "pending" is a record no box serves |
| + // yet; creating, starting and issuing are being set up (healthWord |
| + // calls them Setting up); failed and the hold statuses |
| + // (registry.HoldStatuses) are not served; "" on a remote row is a |
| + // host no report vouches for. |
| + if rt.Status != "ready" { |
| + continue |
| + } |
| // An empty channel never resolves (view.go defaults it to stable |
| - // before it gets here); it does not tick. |
| - if _, ok := release.Rung(rt.Channel); !ok { |
| + // before it gets here); it does not tick. Any other name the |
| + // pipeline accepts is a channel, the legacy ladder or not. |
| + if rt.Channel == "" { |
| continue |
| } |
| for _, ch := range v.Channels { |
diff --git a/internal/console/gettingstarted_test.go b/internal/console/gettingstarted_test.go| index fda7e04c1..3e29e4c0c 100644 |
| --- a/internal/console/gettingstarted_test.go |
| +++ b/internal/console/gettingstarted_test.go |
| @@ -4,6 +4,8 @@ import ( |
| "strings" |
| "testing" |
| "time" |
| + |
| + "github.com/carlosframework/platform/internal/provision" |
| ) |
| func TestPersonConnected(t *testing.T) { |
| @@ -34,8 +36,14 @@ func TestAppIsLive(t *testing.T) { |
| mixed := DeploymentStatus{RouteCount: 2, ReportedCount: 2, Versions: []DeploymentVersion{{"v1", 1}, {"v2", 1}}} |
| unknown := DeploymentStatus{RouteCount: 1, UnknownCount: 1} |
| static := func(acct, ch string) RouteView { |
| - return RouteView{Host: "s.example.com", Kind: "static", Channel: ch, Account: acct} |
| + return RouteView{Host: "s.example.com", Kind: "static", Status: "ready", Channel: ch, Account: acct} |
| + } |
| + staticIn := func(status string) RouteView { |
| + rv := static("a", "stable") |
| + rv.Status = status |
| + return rv |
| } |
| + stableV1 := []ChannelView{{Name: "stable", Version: "v1"}} |
| cases := []struct { |
| name string |
| row appRow |
| @@ -61,6 +69,24 @@ func TestAppIsLive(t *testing.T) { |
| Channels: []ChannelView{{Name: "stable", Version: "v1"}}}, false}, |
| {"empty route channel", appRow{Verdict: "ok"}, AppView{ |
| Routes: []RouteView{static("a", "")}, Channels: []ChannelView{{Name: "", Version: "v1"}}}, false}, |
| + // Deployment intent is not observed deployment: a static route no |
| + // box serves yet (remoteRoute's "pending"), one still being set up, |
| + // failed, held by a move, or with no status at all never ticks, |
| + // whatever its channel points at. |
| + {"static pending", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("pending")}, Channels: stableV1}, false}, |
| + {"static creating", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("creating")}, Channels: stableV1}, false}, |
| + {"static starting", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("starting")}, Channels: stableV1}, false}, |
| + {"static issuing", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("issuing")}, Channels: stableV1}, false}, |
| + {"static failed", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("failed")}, Channels: stableV1}, false}, |
| + {"static moving", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("moving")}, Channels: stableV1}, false}, |
| + {"static no status", appRow{Verdict: "ok"}, AppView{Routes: []RouteView{staticIn("")}, Channels: stableV1}, false}, |
| + // A custom channel name the pipeline accepts is a channel like any |
| + // other. |
| + {"static custom channel", appRow{Verdict: "ok"}, AppView{ |
| + Routes: []RouteView{static("a", "production")}, Channels: []ChannelView{{Name: "production", Version: "v1"}}}, true}, |
| + {"static custom channel, other has version", appRow{Verdict: "ok"}, AppView{ |
| + Routes: []RouteView{static("a", "production")}, |
| + Channels: []ChannelView{{Name: "production"}, {Name: "stable", Version: "v1"}}}, false}, |
| } |
| for _, c := range cases { |
| if got := appIsLive(c.row, c.v, "a"); got != c.want { |
| @@ -69,6 +95,27 @@ func TestAppIsLive(t *testing.T) { |
| } |
| } |
| +// The pending static row the real wiring builds: a record whose route no |
| +// box serves yet, read from a complete set of box reports, under an app |
| +// whose own channel has a valid pointer. summarize calls it Deployed; the |
| +// checklist must not call it live. |
| +func TestAppIsLivePendingRemoteStatic(t *testing.T) { |
| + f := foldFleetReports(nil, true, time.Now()) |
| + rv, dv := remoteRoute(provision.Record{Host: "s.example.com", App: "shop", Account: "a", Kind: "static"}, nil, factsOf(f, "a", "shop"), "a", DNSTargets{}) |
| + if rv.Status != "pending" { |
| + t.Fatalf("fixture: remote static status = %q, want pending", rv.Status) |
| + } |
| + view := AppView{App: "shop", Routes: []RouteView{rv}, Domains: []DomainView{dv}, |
| + Channels: []ChannelView{{Name: "stable", Version: "v1"}}} |
| + row := summarize(view, "a") |
| + if row.Verdict != "ok" { |
| + t.Fatalf("fixture: verdict = %q, want ok", row.Verdict) |
| + } |
| + if appIsLive(row, view, "a") { |
| + t.Fatal("a static record no box serves yet counted as live") |
| + } |
| +} |
| + |
| func gsStates(v *gettingStartedView) string { |
| var out []string |
| for _, s := range v.Steps { |