package console
// Console UI for release pipelines v2 (pipelinepage.go, ladder.go's
// pipeline-aware assembleLadder, app_overview.html's pending card,
// app_releases.html's hidden-vocabulary wrap): the three properties the
// brief pins, in the order they'd hurt if lost — a one-channel app shows
// none of the ladder's vocabulary, a multi-channel pipeline draws its own
// channels (in order, with their own gate sentence) and the settings page
// offers the two starter templates on a still-default pipeline, and the
// pending-changes card shows real quorum progress with working controls.
import (
"context"
"net/http"
"net/url"
"strings"
"testing"
"time"
"github.com/carlosframework/platform/internal/release"
)
func TestOneChannelAppHidesChannelVocabulary(t *testing.T) {
fx := newConsoleFixture(t)
token := cliToken(t, fx, "paul@keymail.dev", "code-hide-vocab")
if status, out := postJSON(t, fx.ts.URL+"/api/cli/apps/bab/new",
map[string]string{"name": "solo"}, token); status != http.StatusOK {
t.Fatalf("create app = %d %v", status, out)
}
c := signInPaul(t, fx)
status, _, body := get(t, c, fx.u("/apps/solo/releases"))
if status != http.StatusOK {
t.Fatalf("app page = %d", status)
}
assertNoChannelVocabulary(t, body)
// The releases list and observed-deployment summary are still there —
// hidden means no CHANNEL vocabulary, not no page.
if !strings.Contains(body, "Nothing shipped yet") {
t.Errorf("one-channel app page does not show the releases list:\n%s", body)
}
if !strings.Contains(body, `aria-label="Release status"`) {
t.Errorf("one-channel app page does not show the deployment summary:\n%s", body)
}
// Ship TWO builds and land both on the entry channel — still no
// vocabulary. Two promotions, not one, deliberately: the second gives the
// pointer a history, which is the state in which the rollback control
// renders (PR #258 review, I2). Tested with one promotion, this assertion
// passed only because the page had no rollback form to put a channel name
// into, so it never exercised the page a real one-channel app shows.
shipVersion(t, fx, "solo", "v1")
shipVersion(t, fx, "solo", "v2")
seedChannel(t, fx, "solo", "edge", "v1")
seedChannel(t, fx, "solo", "edge", "v2")
_, _, body2 := get(t, c, fx.u("/apps/solo/releases"))
if !strings.Contains(body2, "Roll back") {
t.Fatalf("this app has a rollback control by now — without it the check below proves nothing:\n%s", body2)
}
assertNoChannelVocabulary(t, body2)
}
// assertNoChannelVocabulary checks the RENDERED CONTENT — ...,
// not the shared chrome above it — for the ladder's hidden words. The page's
// one shared stylesheet (layout.html's `