carlos / platform Public

tests: follow DispatchArm's tunnel-name refusal and the flag help text

TestLinkRefusesUnpublished sent a request down the link channel with no
publication header through a -tunnel row naming the channel. The hub's
dispatch now refuses that row (ValidTunnelName), so the test checks the
hub's own 404 and holds home's LD-C50 backstop at the handler directly.

The CLI golden's two links ls help lines take copyLinksFlagAccountID's
reviewed draft (no em dash).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 4b3e561e1852ad4eb5a0e0692b540af2f8b9f689 parent 3cdd8d0
2 files changed, +20 −6
  • internal/host/link_e2e_test.go +18 −4
  • testdata/clireg-golden.jsonl +2 −2

CI failed — run details

diff --git a/internal/host/link_e2e_test.go b/internal/host/link_e2e_test.go
index 292bbda10..8533cef45 100644
--- a/internal/host/link_e2e_test.go
+++ b/internal/host/link_e2e_test.go
@@ -543,8 +543,8 @@ func TestLinkRefusesUnpublished(t *testing.T) {
w := newLinkedWorld(t, nil)
// A hub that names a publication home never made.
w.hubRow(t, linkPublicHost("admin"), "admin")
- // A hub row that sends down the link channel with no publication header
- // at all: a -tunnel route naming the link's channel.
+ // A hub row that would send down the link channel with no publication
+ // header at all: a -tunnel route naming the link's channel.
if err := w.hubReg.Upsert(registry.Route{Host: "raw.example.com", Slug: "raw", Kind: "instance", Tunnel: linkE2EChannel,
Status: "ready", App: "raw", Account: linkServingAcct, Channel: "production"}); err != nil {
t.Fatal(err)
@@ -557,9 +557,23 @@ func TestLinkRefusesUnpublished(t *testing.T) {
resp, body := w.via(t, "GET", "admin", "/", nil, "")
wantStatus(t, "Carlos-Link-App: admin", resp, body, http.StatusNotFound, deckLD50)
- // A client's own header never survives the hub; the row sends none.
+ // The hub's dispatch refuses a row whose Tunnel is no fleet tunnel name
+ // (DispatchArm: ValidTunnelName), so this row reaches no channel at all,
+ // whatever header the client sends.
resp, body = linkDoTo(t, w.hubURL, "GET", "raw.example.com", "/", http.Header{tunnelclient.LinkAppHeader: {"shop"}}, "")
- wantStatus(t, "no header", resp, body, http.StatusNotFound, deckLD50)
+ if resp.StatusCode != http.StatusNotFound || strings.Contains(body, deckLD50) {
+ t.Fatalf("a -tunnel row naming the link's channel: %d %q, want the hub's own 404", resp.StatusCode, body)
+ }
+ // Home's refusal stays the backstop: a request down the channel with no
+ // publication header is LD-C50, before anything is served.
+ h := linkHandler{reg: w.homeReg, linkID: linkE2EID, serve: func(http.ResponseWriter, *http.Request, edge.LinkedTarget) {
+ t.Error("a request with no publication header was served")
+ }}
+ rec := httptest.NewRecorder()
+ h.ServeHTTP(rec, httptest.NewRequest("GET", "/", nil))
+ if rec.Code != http.StatusNotFound || !strings.Contains(rec.Body.String(), deckLD50) {
+ t.Fatalf("no header at home: %d %q, want 404 %q", rec.Code, rec.Body.String(), deckLD50)
+ }
resp, body = linkDoTo(t, w.hubURL, "GET", linkHomeHost("admin"), "/", nil, "")
wantStatus(t, "shop named with admin's Host", resp, body, http.StatusOK, "shop")
diff --git a/testdata/clireg-golden.jsonl b/testdata/clireg-golden.jsonl
index 4c059977b..c232b6285 100644
--- a/testdata/clireg-golden.jsonl
+++ b/testdata/clireg-golden.jsonl
@@ -470,8 +470,8 @@
{"case":"link | bare","argv":["link"],"exit":1,"stdout":"","stderr":"usage: carlos link create --to <console URL> [--name <name>] | status | publish <app> [--account <account>] [--name <name>] | unpublish <name> | rotate | remove [--local]\n"}
{"case":"link | help","argv":["link","help"],"exit":1,"stdout":"","stderr":"usage: carlos link create --to <console URL> [--name <name>] | status | publish <app> [--account <account>] [--name <name>] | unpublish <name> | rotate | remove [--local]\n"}
{"case":"link | zz-unknown","argv":["link","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos link create --to <console URL> [--name <name>] | status | publish <app> [--account <account>] [--name <name>] | unpublish <name> | rotate | remove [--local]\n"}
-{"case":"links ls | --zz-unknown-flag","argv":["links","ls","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos links ls [flags]\nflags:\n --account <string> account (sqid or name) to list linked deployments for (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
-{"case":"links ls | -h","argv":["links","ls","-h"],"exit":0,"stdout":"","stderr":"usage: carlos links ls [flags]\nflags:\n --account <string> account (sqid or name) to list linked deployments for (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
+{"case":"links ls | --zz-unknown-flag","argv":["links","ls","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos links ls [flags]\nflags:\n --account <string> account (sqid or name) to list linked deployments for (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid only; overrides --account\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
+{"case":"links ls | -h","argv":["links","ls","-h"],"exit":0,"stdout":"","stderr":"usage: carlos links ls [flags]\nflags:\n --account <string> account (sqid or name) to list linked deployments for (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid only; overrides --account\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
{"case":"links | --help","argv":["links","--help"],"exit":1,"stdout":"","stderr":"usage: carlos links ls --account <account>\n"}
{"case":"links | --zz-unknown-flag","argv":["links","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos links ls --account <account>\n"}
{"case":"links | -h","argv":["links","-h"],"exit":1,"stdout":"","stderr":"usage: carlos links ls --account <account>\n"}