carlos / platform Public

Regional domains (#447): published placements examples put the hostname after every flag

Go's flag parser stops at the first non-flag, so the documented write
examples (docs/site/cli.md and design §6.6) printed usage. The hostname now
comes last, and TestRunDomainsPlacementsPublishedExamples runs every fenced
placements line from docs/site/cli.md through the real binary.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 2b020e9d2c343a241240aba131d5f9b232316898 parent e33311b
3 files changed, +87 −4
  • docs/site/cli.md +2 −2
  • docs/superpowers/specs/2026-10-28-regional-domains-447-design.md +2 −2
  • domains_cli_test.go +83 −0
diff --git a/docs/site/cli.md b/docs/site/cli.md
index 9a505dca9..62a213d65 100644
--- a/docs/site/cli.md
+++ b/docs/site/cli.md
@@ -1313,8 +1313,8 @@ A regional domain is served in each region by that region's own instance of the
```sh
carlos domains placements --app shop example.com
-carlos domains placements --app shop example.com --set ie=shop-ie.example.net --set uk=shop-uk.example.net
-carlos domains placements --app shop example.com --set ie=shop-ie.example.net --set uk=shop-uk.example.net --wildcard --catchall
+carlos domains placements --app shop --set ie=shop-ie.example.net --set uk=shop-uk.example.net example.com
+carlos domains placements --app shop --set ie=shop-ie.example.net --set uk=shop-uk.example.net --wildcard --catchall example.com
```
`--set` gives the whole set each time, one `region=instance` per region. Without `--set`, the command shows each region's instance, whether it is ready, and the addresses where its servers answer. Once every region you named is ready, point DNS for the domain at those addresses with latency-based routing.
diff --git a/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md b/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md
index 01579eef2..7fa628718 100644
--- a/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md
+++ b/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md
@@ -546,7 +546,7 @@ Reasons are JSON values, not copy: `no-serving-box`, `below-floor`,
```
carlos domains placements --app shop example.com
-carlos domains placements --app shop example.com --set ie=shop-ie.example.net --set uk=shop-uk.example.net
+carlos domains placements --app shop --set ie=shop-ie.example.net --set uk=shop-uk.example.net example.com
```
`--set` gives the whole set and creates the claim if there is none.
@@ -556,7 +556,7 @@ only when given (`fs.Visit`, as attach does) and take effect on create;
on an existing regional claim a differing value is refused (§6.2 step 4).
```
-carlos domains placements --app shop example.com --set ie=shop-ie.example.net --set uk=shop-uk.example.net --wildcard --catchall
+carlos domains placements --app shop --set ie=shop-ie.example.net --set uk=shop-uk.example.net --wildcard --catchall example.com
```
### 6.7 Overlap with catch-alls (ruling 4)
diff --git a/domains_cli_test.go b/domains_cli_test.go
index b7505cd20..be4fed5d4 100644
--- a/domains_cli_test.go
+++ b/domains_cli_test.go
@@ -15,6 +15,7 @@ import (
"errors"
"net/http"
"net/http/httptest"
+ "os"
"os/exec"
"path/filepath"
"strings"
@@ -1172,3 +1173,85 @@ func TestRunDomainsPlacementsAgainstAnOlderConsole(t *testing.T) {
t.Fatalf("proof pending points at domains verify, which has no claim to verify:\n%s", out)
}
}
+
+// TestRunDomainsPlacementsPublishedExamples (#447 whole-branch R1 P2-1):
+// every fenced `carlos domains placements` line in docs/site/cli.md runs as
+// published, through the real binary (a usage error is a log.Fatal), and
+// reaches the console: the read as a GET, each --set line as a PUT carrying
+// its whole set and exactly the capability flags it names. Go's flag parser
+// stops at the first non-flag, so a hostname placed before --set is a usage
+// error, which is what the page used to show.
+func TestRunDomainsPlacementsPublishedExamples(t *testing.T) {
+ raw, err := os.ReadFile("docs/site/cli.md")
+ if err != nil {
+ t.Fatal(err)
+ }
+ var examples [][]string
+ inFence := false
+ for _, line := range strings.Split(string(raw), "\n") {
+ if strings.HasPrefix(line, "```") {
+ inFence = !inFence
+ continue
+ }
+ if inFence && strings.HasPrefix(line, "carlos domains placements ") {
+ examples = append(examples, strings.Fields(line)[1:])
+ }
+ }
+ if len(examples) < 3 {
+ t.Fatalf("docs/site/cli.md has %d placements examples, want the read and both writes", len(examples))
+ }
+
+ bin := buildCarlos(t)
+ fc := newFakeDomainsConsole(t)
+ fc.placements = regionalPlacementsAnswer()
+ home := t.TempDir()
+ creds := filepath.Join(home, "credentials")
+ writeTestCredential(t, creds, fc.ts.URL)
+ writes := 0
+ for _, args := range examples {
+ fc.lastPlacementsPath, fc.lastPlacementsPut = "", nil
+ cmd := exec.Command(bin, args...)
+ cmd.Env = carlosTestEnv(t, "CARLOS_CREDENTIALS="+creds, "CARLOS_DEPLOYMENT_BUCKET=", "CARLOS_DEPLOYMENT_DIR=")
+ cmd.Dir = home
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatalf("carlos %s: %v\n%s", strings.Join(args, " "), err, out)
+ }
+ host := args[len(args)-1]
+ if !strings.HasSuffix(fc.lastPlacementsPath, "/domains/"+host+"/placements") {
+ t.Fatalf("carlos %s asked for %q, want the placements door for %s", strings.Join(args, " "), fc.lastPlacementsPath, host)
+ }
+ var sets int
+ named := map[string]bool{}
+ for _, a := range args {
+ switch a {
+ case "--set", "-set":
+ sets++
+ case "--wildcard", "-wildcard":
+ named["wildcard"] = true
+ case "--catchall", "-catchall":
+ named["catchall"] = true
+ }
+ }
+ if sets == 0 {
+ if fc.lastPlacementsPut != nil {
+ t.Fatalf("carlos %s (a read) sent a PUT: %v", strings.Join(args, " "), fc.lastPlacementsPut)
+ }
+ continue
+ }
+ writes++
+ var set []map[string]string
+ if err := json.Unmarshal(fc.lastPlacementsPut["placements"], &set); err != nil || len(set) != sets {
+ t.Fatalf("carlos %s sent placements %s (%v), want %d entries", strings.Join(args, " "), fc.lastPlacementsPut["placements"], err, sets)
+ }
+ for _, key := range []string{"wildcard", "catchall"} {
+ got, ok := fc.lastPlacementsPut[key]
+ if ok != named[key] || (ok && string(got) != "true") {
+ t.Fatalf("carlos %s sent %s = %s (present %v), want present %v", strings.Join(args, " "), key, got, ok, named[key])
+ }
+ }
+ }
+ if writes < 2 {
+ t.Fatalf("ran %d published write examples, want both", writes)
+ }
+}