cli: account subdomain review fixes, round 1 (T7)
Set's TLS check probes a real host: the console's set answer gains check_host, one name host of an eligible instance record of the account (omitted when there is none), and the CLI handshakes with it, so the check works on per-host certificate deployments too. With no check host set skips the wait. Every handshake runs under the one 120 s deadline. A first static deploy keeps the create answer's public_host, so the announcement and the watch print the name host; the watch still dials the sqid host. Approved copy for direct bucket mode and an unknown account (cli.subdomain.needs_console, cli.subdomain.not_found), pinned in the copy test; approved docs prose in docs/site/cli.md. The routes test uses a neutral fixture. Census re-proposed for the runDeploy delta.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 files changed,
+409
−83
accounts_subdomain.go+57 −40accounts_subdomain_copy.go+7 −0accounts_subdomain_test.go+179 −24approved_account_subdomains_copy_test.go+2 −0deploy.go+10 −7deploy_test.go+33 −1docs/site/cli.md+2 −2docs/superpowers/notes/census-proposal-account-subdomains.md+2 −2internal/console/apisubdomain.go+64 −3internal/console/apisubdomain_test.go+49 −0internal/provision/testdata/plan14-root-reads-account-subdomains.tsv+3 −3internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1
CI failed — run details
Intent
Attributed to this commit: 79.0 g CO₂e (4,991,561 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-account-name-hosts, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/accounts_subdomain.go b/accounts_subdomain.go| index cf8d648c7..af89e2dec 100644 |
| --- a/accounts_subdomain.go |
| +++ b/accounts_subdomain.go |
| @@ -10,7 +10,8 @@ package main |
| // A refusal's sentence is the console's: its answer carries the approved |
| // copy already formatted, so this side prints it as it comes, with the |
| // hosts it is about listed under it. Only an unknown account (code |
| -// not_found, whose sentence is the mux's) is said in the CLI's own words. |
| +// not_found, whose sentence is the mux's) and direct bucket mode are said |
| +// in the CLI's own approved words. |
| import ( |
| "context" |
| @@ -75,6 +76,9 @@ type accountSubdomainReply struct { |
| Name string `json:"name"` |
| Host string `json:"host"` |
| Foreign []subdomainHost `json:"foreign"` |
| + // CheckHost is set's answer only: one real name host of the account |
| + // (one of its apps under the name), "" when it has none. |
| + CheckHost string `json:"check_host"` |
| } |
| // subdomainInventoryReply is the inventory door's answer. |
| @@ -114,10 +118,11 @@ func writeSubdomainHosts(w io.Writer, hosts []subdomainHost, indent string) { |
| tw.Flush() |
| } |
| -// subdomainError reads a refusal from the doors. An unknown account (code |
| -// not_found) is the CLI's not-found answer; everything else is the |
| -// console's sentence, with its hosts when it names some. |
| -func subdomainError(status int, body []byte) error { |
| +// subdomainError reads a refusal from the doors about account ("" for the |
| +// inventory). An unknown account (code not_found) is the CLI's own answer |
| +// naming the sqid; everything else is the console's sentence, with its |
| +// hosts when it names some. |
| +func subdomainError(account string, status int, body []byte) error { |
| var e struct { |
| Error string `json:"error"` |
| Code string `json:"code"` |
| @@ -127,7 +132,7 @@ func subdomainError(status int, body []byte) error { |
| return apiErrorFromBody(status, body) |
| } |
| if e.Code == "not_found" { |
| - return notFoundErr() |
| + return fmt.Errorf(cliSubdomainCopyNotFound, account) |
| } |
| return &subdomainRefusal{msg: e.Error, hosts: e.Hosts} |
| } |
| @@ -181,7 +186,9 @@ func runAccountsSubdomainWithSession(ctx context.Context, sess *apiSession, verb |
| } |
| } |
| if sess == nil { |
| - sess = requirePlanAPISession(*consoleFlag) |
| + if sess, err = subdomainAPISession(*consoleFlag); err != nil { |
| + return err |
| + } |
| printUsing(out, sess) |
| } |
| switch verb { |
| @@ -191,7 +198,7 @@ func runAccountsSubdomainWithSession(ctx context.Context, sess *apiSession, verb |
| return err |
| } |
| fmt.Fprintln(out, colorFor(out).ok(fmt.Sprintf(cliSubdomainCopySetDone, res.Account, res.Name, res.Host))) |
| - waitForSubdomainCertificate(ctx, out, res.Host) |
| + waitForSubdomainCertificate(ctx, out, res.Host, res.CheckHost) |
| case "remove": |
| res, err := sess.removeAccountSubdomain(ctx, acct) |
| if err != nil { |
| @@ -214,23 +221,37 @@ func runAccountsSubdomainWithSession(ctx context.Context, sess *apiSession, verb |
| return nil |
| } |
| +// subdomainAPISession is the console session the subdomain doors need. |
| +// Subdomains are namespace claims the console writes, so direct bucket mode |
| +// has no equivalent. |
| +func subdomainAPISession(consoleFlag string) (*apiSession, error) { |
| + sess, err := resolveMode(consoleFlag) |
| + if err != nil { |
| + return nil, err |
| + } |
| + if sess == nil { |
| + return nil, errors.New(cliSubdomainCopyNeedsConsole) |
| + } |
| + return sess, nil |
| +} |
| + |
| func subdomainPath(account string) string { |
| return "/api/cli/accounts/" + url.PathEscape(account) + "/subdomain" |
| } |
| func (s *apiSession) accountSubdomain(ctx context.Context, account string) (accountSubdomainReply, error) { |
| status, body, err := s.getJSON(ctx, subdomainPath(account)) |
| - return decodeAccountSubdomain(status, body, err) |
| + return decodeAccountSubdomain(account, status, body, err) |
| } |
| func (s *apiSession) setAccountSubdomain(ctx context.Context, account, name string) (accountSubdomainReply, error) { |
| status, body, err := s.postJSON(ctx, subdomainPath(account), map[string]string{"name": name}) |
| - return decodeAccountSubdomain(status, body, err) |
| + return decodeAccountSubdomain(account, status, body, err) |
| } |
| func (s *apiSession) removeAccountSubdomain(ctx context.Context, account string) (accountSubdomainReply, error) { |
| status, body, err := s.deleteJSON(ctx, subdomainPath(account)) |
| - return decodeAccountSubdomain(status, body, err) |
| + return decodeAccountSubdomain(account, status, body, err) |
| } |
| func (s *apiSession) subdomainInventory(ctx context.Context) (subdomainInventoryReply, error) { |
| @@ -239,7 +260,7 @@ func (s *apiSession) subdomainInventory(ctx context.Context) (subdomainInventory |
| return subdomainInventoryReply{}, err |
| } |
| if status != http.StatusOK { |
| - return subdomainInventoryReply{}, subdomainError(status, body) |
| + return subdomainInventoryReply{}, subdomainError("", status, body) |
| } |
| var out subdomainInventoryReply |
| if err := json.Unmarshal(body, &out); err != nil { |
| @@ -248,12 +269,12 @@ func (s *apiSession) subdomainInventory(ctx context.Context) (subdomainInventory |
| return out, nil |
| } |
| -func decodeAccountSubdomain(status int, body []byte, err error) (accountSubdomainReply, error) { |
| +func decodeAccountSubdomain(account string, status int, body []byte, err error) (accountSubdomainReply, error) { |
| if err != nil { |
| return accountSubdomainReply{}, err |
| } |
| if status != http.StatusOK { |
| - return accountSubdomainReply{}, subdomainError(status, body) |
| + return accountSubdomainReply{}, subdomainError(account, status, body) |
| } |
| var out accountSubdomainReply |
| if err := json.Unmarshal(body, &out); err != nil { |
| @@ -287,7 +308,7 @@ func printSubdomainInventory(w io.Writer, r subdomainInventoryReply) { |
| } |
| // set's wait for the name's certificate (spec §4.8): one handshake every |
| -// subdomainCheckEvery, for up to subdomainCheckFor. Vars so a test can |
| +// subdomainCheckEvery, all within subdomainCheckFor. Vars so a test can |
| // shorten them and stand in for the network. |
| var ( |
| subdomainCheckEvery = 5 * time.Second |
| @@ -295,40 +316,35 @@ var ( |
| subdomainHandshake = tlsHandshake |
| ) |
| -// subdomainProbeLabel is the label of the host set probes under the name. |
| -// Any one label under <name>.<apps-domain> is covered by the account's |
| -// wildcard certificate, and the edge serves that certificate for it whether |
| -// or not an app answers there (internal/edge/wildcard.go, certFor), so a |
| -// verified handshake on it says the wildcard is in place. Before it is, the |
| -// edge's per-host policy refuses a name that is not a route, so the probe |
| -// never starts a certificate order of its own. |
| -const subdomainProbeLabel = "carlos-check" |
| - |
| -// waitForSubdomainCertificate tries the probe host under root until a |
| -// verified TLS handshake succeeds or the wait ends, and says which. Neither |
| -// is a failure: the subdomain is set either way. |
| -func waitForSubdomainCertificate(ctx context.Context, w io.Writer, root string) { |
| - if root == "" { |
| +// waitForSubdomainCertificate checks check, the one real name host the |
| +// console named for the account, until a verified TLS handshake with it |
| +// succeeds or the wait ends, and says which. A real host answers however |
| +// the deployment issues certificates (the wildcard for root, or one per |
| +// host). With no check host (the account has no app under the name yet) |
| +// there is nothing to check, and nothing more is said. Neither outcome is |
| +// a failure: the subdomain is set either way. |
| +func waitForSubdomainCertificate(ctx context.Context, w io.Writer, root, check string) { |
| + if root == "" || check == "" { |
| return |
| } |
| - if subdomainServing(ctx, subdomainProbeLabel+"."+root) { |
| - fmt.Fprintln(w, colorFor(w).ok(fmt.Sprintf(cliSubdomainCopySetServing, "*."+root))) |
| + if subdomainServing(ctx, check) { |
| + fmt.Fprintln(w, colorFor(w).ok(fmt.Sprintf(cliSubdomainCopySetServing, check))) |
| return |
| } |
| mutedf(w, cliSubdomainCopySetIssuing, root) |
| } |
| -// subdomainServing reports whether a handshake with probe succeeds within |
| -// subdomainCheckFor, trying every subdomainCheckEvery. |
| -func subdomainServing(ctx context.Context, probe string) bool { |
| - deadline := time.Now().Add(subdomainCheckFor) |
| +// subdomainServing reports whether a handshake with host succeeds within |
| +// subdomainCheckFor, trying every subdomainCheckEvery. Every attempt runs |
| +// under the one overall deadline, so none outlasts it, and a handshake that |
| +// returns after it does not count. |
| +func subdomainServing(ctx context.Context, host string) bool { |
| + ctx, cancel := context.WithTimeout(ctx, subdomainCheckFor) |
| + defer cancel() |
| for { |
| - if subdomainHandshake(ctx, probe) == nil { |
| + if subdomainHandshake(ctx, host) == nil && ctx.Err() == nil { |
| return true |
| } |
| - if time.Now().Add(subdomainCheckEvery).After(deadline) { |
| - return false |
| - } |
| t := time.NewTimer(subdomainCheckEvery) |
| select { |
| case <-ctx.Done(): |
| @@ -340,7 +356,8 @@ func subdomainServing(ctx context.Context, probe string) bool { |
| } |
| // tlsHandshake dials host:443 and completes a TLS handshake that verifies |
| -// the certificate for host against the system roots. |
| +// the certificate for host against the system roots, within ctx and at most |
| +// ten seconds. |
| func tlsHandshake(ctx context.Context, host string) error { |
| ctx, cancel := context.WithTimeout(ctx, 10*time.Second) |
| defer cancel() |
diff --git a/accounts_subdomain_copy.go b/accounts_subdomain_copy.go| index 16db66f3c..886f5fe24 100644 |
| --- a/accounts_subdomain_copy.go |
| +++ b/accounts_subdomain_copy.go |
| @@ -40,4 +40,11 @@ const ( |
| cliSubdomainCopyInventoryHeading = "unused labels under %s. give one to an account to add hosts under it:" |
| // cli.subdomain.inventory.empty |
| cliSubdomainCopyInventoryEmpty = "every label under %s is an account sqid or an assigned subdomain" |
| + // cli.subdomain.needs_console |
| + // A raw literal, so the record's line breaks are in the file as they are. |
| + cliSubdomainCopyNeedsConsole = `carlos accounts subdomain works through a console, and this shell is in direct bucket mode |
| +(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set). subdomains are kept by the console. |
| +unset the store env and run: carlos auth login --console <url>` |
| + // cli.subdomain.not_found |
| + cliSubdomainCopyNotFound = "no account %s. check the sqid with carlos accounts list" |
| ) |
diff --git a/accounts_subdomain_test.go b/accounts_subdomain_test.go| index 9f4c4f113..aa2ce2b9f 100644 |
| --- a/accounts_subdomain_test.go |
| +++ b/accounts_subdomain_test.go |
| @@ -8,6 +8,8 @@ import ( |
| "io" |
| "net/http" |
| "net/http/httptest" |
| + "os" |
| + "path/filepath" |
| "reflect" |
| "strings" |
| "sync" |
| @@ -67,14 +69,17 @@ func fastSubdomainCheck(t *testing.T, answer func(n int) error) *[]string { |
| } |
| func TestAccountsSubdomainSet(t *testing.T) { |
| + const checkHost = "shop.harbour.apps.test" |
| sess, paths, names := subdomainConsole(t, func(w http.ResponseWriter, r *http.Request) { |
| - writeTestJSON(w, http.StatusOK, map[string]any{"account": "bdq", "name": "harbour", "host": "harbour.apps.test", "foreign": []any{}}) |
| + writeTestJSON(w, http.StatusOK, map[string]any{"account": "bdq", "name": "harbour", "host": "harbour.apps.test", |
| + "foreign": []any{}, "check_host": checkHost}) |
| }) |
| - // The certificate is there on the second handshake. |
| + // A per-host deployment: only real hosts have certificates, so only the |
| + // check host the console named answers, on the second handshake. |
| tried := fastSubdomainCheck(t, func(n int) error { |
| if n < 2 { |
| - return errors.New("tls: no certificate") |
| + return errors.New("tls: no certificate yet") |
| } |
| return nil |
| }) |
| @@ -91,22 +96,14 @@ func TestAccountsSubdomainSet(t *testing.T) { |
| text := out.String() |
| for _, want := range []string{ |
| "account bdq has the subdomain harbour. its apps answer at <app>.harbour.apps.test, and at their old addresses too", |
| - "checked: *.harbour.apps.test answers over https", |
| + "checked: " + checkHost + " answers over https", |
| } { |
| if !strings.Contains(text, want) { |
| t.Errorf("output lacks %q:\n%s", want, text) |
| } |
| } |
| - if len(*tried) != 2 { |
| - t.Fatalf("handshakes %v, want two", *tried) |
| - } |
| - // The probe is one host directly under the name, which the wildcard |
| - // covers. |
| - for _, h := range *tried { |
| - label, ok := strings.CutSuffix(h, ".harbour.apps.test") |
| - if !ok || label == "" || strings.Contains(label, ".") { |
| - t.Errorf("probed %q, want one label under harbour.apps.test", h) |
| - } |
| + if want := []string{checkHost, checkHost}; !reflect.DeepEqual(*tried, want) { |
| + t.Fatalf("handshakes %v, want the console's check host twice", *tried) |
| } |
| // Still issuing when the wait ends: said, and not a failure. |
| @@ -123,6 +120,103 @@ func TestAccountsSubdomainSet(t *testing.T) { |
| } |
| } |
| +// An account with no app under the name: the console names no check host, |
| +// so set checks nothing and says only that the name is set. |
| +func TestAccountsSubdomainSetWithNoAppSkipsTheCheck(t *testing.T) { |
| + sess, _, _ := subdomainConsole(t, func(w http.ResponseWriter, r *http.Request) { |
| + writeTestJSON(w, http.StatusOK, map[string]any{"account": "bdq", "name": "harbour", "host": "harbour.apps.test", "foreign": []any{}}) |
| + }) |
| + tried := fastSubdomainCheck(t, func(int) error { return nil }) |
| + var out bytes.Buffer |
| + if err := runAccountsSubdomainWithSession(context.Background(), sess, "set", []string{"--account", "bdq", "harbour"}, &out); err != nil { |
| + t.Fatal(err) |
| + } |
| + if len(*tried) != 0 { |
| + t.Fatalf("handshakes %v, want none with no check host", *tried) |
| + } |
| + want := "account bdq has the subdomain harbour. its apps answer at <app>.harbour.apps.test, and at their old addresses too\n" |
| + if out.String() != want { |
| + t.Fatalf("output %q, want only %q", out.String(), want) |
| + } |
| +} |
| + |
| +// Every handshake runs under the one overall deadline: an attempt that |
| +// hangs is cut off at it, and set reports still issuing. |
| +func TestAccountsSubdomainSetHandshakesShareTheDeadline(t *testing.T) { |
| + sess, _, _ := subdomainConsole(t, func(w http.ResponseWriter, r *http.Request) { |
| + writeTestJSON(w, http.StatusOK, map[string]any{"account": "bdq", "name": "harbour", "host": "harbour.apps.test", |
| + "foreign": []any{}, "check_host": "shop.harbour.apps.test"}) |
| + }) |
| + oldEvery, oldFor, oldShake := subdomainCheckEvery, subdomainCheckFor, subdomainHandshake |
| + t.Cleanup(func() { subdomainCheckEvery, subdomainCheckFor, subdomainHandshake = oldEvery, oldFor, oldShake }) |
| + subdomainCheckEvery, subdomainCheckFor = time.Millisecond, 50*time.Millisecond |
| + start := time.Now() |
| + subdomainHandshake = func(ctx context.Context, host string) error { |
| + if d, ok := ctx.Deadline(); !ok || d.After(start.Add(time.Second)) { |
| + t.Errorf("handshake deadline %v (set %v), want the overall one", d, ok) |
| + } |
| + <-ctx.Done() // hangs until the overall deadline |
| + return ctx.Err() |
| + } |
| + var out bytes.Buffer |
| + if err := runAccountsSubdomainWithSession(context.Background(), sess, "set", []string{"--account", "bdq", "harbour"}, &out); err != nil { |
| + t.Fatal(err) |
| + } |
| + if elapsed := time.Since(start); elapsed > 2*time.Second { |
| + t.Fatalf("set waited %v past a 50ms deadline", elapsed) |
| + } |
| + if !strings.Contains(out.String(), "is still being issued") || strings.Contains(out.String(), "checked:") { |
| + t.Fatalf("output:\n%s", out.String()) |
| + } |
| + |
| + // A handshake that returns nil only once the deadline has passed is not |
| + // success. |
| + subdomainHandshake = func(ctx context.Context, host string) error { |
| + <-ctx.Done() |
| + return nil |
| + } |
| + out.Reset() |
| + if err := runAccountsSubdomainWithSession(context.Background(), sess, "set", []string{"--account", "bdq", "harbour"}, &out); err != nil { |
| + t.Fatal(err) |
| + } |
| + if strings.Contains(out.String(), "checked:") { |
| + t.Fatalf("a handshake past the deadline was reported as checked:\n%s", out.String()) |
| + } |
| +} |
| + |
| +// Direct bucket mode and an unknown account are said in the CLI's own |
| +// approved words, not the plan command's or the shared --app riddle. |
| +func TestAccountsSubdomainNeedsConsoleAndNotFound(t *testing.T) { |
| + t.Setenv("CARLOS_DEPLOYMENT_DIR", t.TempDir()) |
| + for _, verb := range []string{"set", "remove", "show", "inventory"} { |
| + args := []string{"--account", "bdq"} |
| + switch verb { |
| + case "set": |
| + args = append(args, "harbour") |
| + case "inventory": |
| + args = nil |
| + } |
| + err := runAccountsSubdomainWithSession(context.Background(), nil, verb, args, io.Discard) |
| + if err == nil || err.Error() != cliSubdomainCopyNeedsConsole { |
| + t.Errorf("%s in direct bucket mode: err = %v, want %q", verb, err, cliSubdomainCopyNeedsConsole) |
| + } |
| + } |
| + |
| + sess, _, _ := subdomainConsole(t, func(w http.ResponseWriter, r *http.Request) { |
| + writeTestJSON(w, http.StatusNotFound, map[string]any{"error": "404 page not found", "code": "not_found"}) |
| + }) |
| + for _, verb := range []string{"set", "remove", "show"} { |
| + args := []string{"--account", "bdq"} |
| + if verb == "set" { |
| + args = append(args, "harbour") |
| + } |
| + err := runAccountsSubdomainWithSession(context.Background(), sess, verb, args, io.Discard) |
| + if want := "no account bdq. check the sqid with carlos accounts list"; err == nil || err.Error() != want { |
| + t.Errorf("%s of an unknown account: err = %v, want %q", verb, err, want) |
| + } |
| + } |
| +} |
| + |
| func TestAccountsSubdomainSetRefusalPrintsReason(t *testing.T) { |
| tried := fastSubdomainCheck(t, func(int) error { return nil }) |
| @@ -159,14 +253,6 @@ func TestAccountsSubdomainSetRefusalPrintsReason(t *testing.T) { |
| t.Fatalf("err = %v, want %q", err, notOperator) |
| } |
| - // An unknown account is the CLI's own not-found answer, not the mux's |
| - // words. |
| - sess, _, _ = subdomainConsole(t, func(w http.ResponseWriter, r *http.Request) { |
| - writeTestJSON(w, http.StatusNotFound, map[string]any{"error": "404 page not found", "code": "not_found"}) |
| - }) |
| - if err := runAccountsSubdomainWithSession(context.Background(), sess, "set", []string{"--account", "bdq", "harbour"}, io.Discard); !errors.Is(err, errMembershipNotFound) { |
| - t.Fatalf("err = %v, want the not-found answer", err) |
| - } |
| if len(*tried) != 0 { |
| t.Fatalf("a refused set waited for a certificate: %v", *tried) |
| } |
| @@ -391,11 +477,25 @@ func TestDeployAnnouncementPrintsPublicHost(t *testing.T) { |
| func TestRoutesPrintsPublicHost(t *testing.T) { |
| useTempCredentials(t) |
| - origin := routesConsole(t, []map[string]any{ |
| + // A neutral console: account bdq with app shop, answering the account |
| + // list and shop's routes. |
| + rows := []map[string]any{ |
| {"host": testSqidHost, "public_host": testNameHost, "kind": "instance", "upstream": "127.0.0.1:9001", |
| "channel": "stable", "status": "ready", "health": "Running"}, |
| {"host": "blog.bdq.apps.test", "kind": "instance", "upstream": "127.0.0.1:9002", |
| "channel": "stable", "status": "ready", "health": "Running"}, |
| + } |
| + origin := signedInConsole(t, func(w http.ResponseWriter, r *http.Request) { |
| + switch r.URL.Path { |
| + case "/api/cli/apps": |
| + json.NewEncoder(w).Encode(map[string]any{"accounts": []map[string]any{ |
| + {"sqid": "bdq", "name": "harbour", "role": "owner", "apps": []string{"shop"}}, |
| + }}) |
| + case "/api/cli/apps/bdq/shop/routes": |
| + json.NewEncoder(w).Encode(map[string]any{"routes": rows}) |
| + default: |
| + http.NotFound(w, r) |
| + } |
| }) |
| var out bytes.Buffer |
| old := stdout |
| @@ -403,7 +503,7 @@ func TestRoutesPrintsPublicHost(t *testing.T) { |
| t.Cleanup(func() { stdout = old }) |
| // --match matches host, the identity: "bdq" finds both rows. |
| - runRoutes([]string{"-app", "titogo", "-account-id", "bae", "-console", origin, "-match", "bdq"}) |
| + runRoutes([]string{"-app", "shop", "-account-id", "bdq", "-console", origin, "-match", "bdq"}) |
| text := out.String() |
| if !strings.Contains(text, testNameHost) || strings.Contains(text, testSqidHost) { |
| t.Fatalf("routes must show the public host, not the sqid host:\n%s", text) |
| @@ -415,3 +515,58 @@ func TestRoutesPrintsPublicHost(t *testing.T) { |
| t.Fatalf("--match bdq matched %d rows, want 2:\n%s", n, text) |
| } |
| } |
| + |
| +// A first static deploy mints the app's platform host; the create door's |
| +// public_host rides through to the announcement and the watch, which still |
| +// dials the sqid host (Task 7 fix round 1, I2). |
| +func TestFirstStaticDeployPrintsPublicHost(t *testing.T) { |
| + useTempCredentials(t) |
| + clearDeploymentEnv(t) |
| + fc := newDeployFakeConsole(t, "sha0001") |
| + fc.mintDomain, fc.mintPublicDomain = "bdq.apps.test", "harbour.apps.test" |
| + credFile, err := loadCredentials() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + credFile.put(credential{Console: fc.ts.URL, Address: "a@example.com", Token: "cli-token", |
| + ExpiresAt: time.Now().Add(time.Hour)}) |
| + if err := credFile.save(); err != nil { |
| + t.Fatal(err) |
| + } |
| + edgeSrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("X-Carlos-Version", "sha0001") |
| + })) |
| + defer edgeSrv.Close() |
| + var mu sync.Mutex |
| + var dialed []string |
| + origOrigin := watchOrigin |
| + watchOrigin = func(h string) string { |
| + mu.Lock() |
| + dialed = append(dialed, h) |
| + mu.Unlock() |
| + return edgeSrv.URL |
| + } |
| + defer func() { watchOrigin = origOrigin }() |
| + siteDir := t.TempDir() |
| + if err := os.WriteFile(filepath.Join(siteDir, "index.html"), []byte("v1"), 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + |
| + buf := captureStdout(t) |
| + runDeploy([]string{"-app", "shop", "-account", "bdq", "-kind", "static", "-version", "sha0001", |
| + "-channel", "stable", "-timeout", "5s", siteDir}) |
| + out := buf.String() |
| + if fc.callIndex("POST /api/cli/apps/bdq/shop/instances") < 0 { |
| + t.Fatalf("the platform host was never minted: %v\n%s", fc.calls, out) |
| + } |
| + for _, want := range []string{"deploying https://" + testNameHost, "live https://" + testNameHost} { |
| + if !strings.Contains(out, want) { |
| + t.Errorf("output lacks %q:\n%s", want, out) |
| + } |
| + } |
| + mu.Lock() |
| + defer mu.Unlock() |
| + if !reflect.DeepEqual(dialed, []string{testSqidHost}) { |
| + t.Fatalf("watch dialed %v, want the sqid host only", dialed) |
| + } |
| +} |
diff --git a/approved_account_subdomains_copy_test.go b/approved_account_subdomains_copy_test.go| index decafc6db..f17f5a724 100644 |
| --- a/approved_account_subdomains_copy_test.go |
| +++ b/approved_account_subdomains_copy_test.go |
| @@ -29,6 +29,8 @@ var accountSubdomainsCopyIDs = []string{ |
| "cli.subdomain.show.foreign", |
| "cli.subdomain.inventory.heading", |
| "cli.subdomain.inventory.empty", |
| + "cli.subdomain.needs_console", |
| + "cli.subdomain.not_found", |
| "refuse.shape", |
| "refuse.sqid_shaped", |
| "refuse.reserved", |
diff --git a/deploy.go b/deploy.go| index f6f7fb44b..31238df62 100644 |
| --- a/deploy.go |
| +++ b/deploy.go |
| @@ -450,11 +450,14 @@ func runDeploy(args []string) { |
| // channel there is nothing to mint onto, so the refusal stands and names |
| // --host, which is the step that makes --channel askable next. |
| if errors.Is(err, errNoStaticHost) && channel != "" { |
| - host, mintErr := mintPlatformHost(ctx, sess, acct, *app, channel, message) |
| + minted, mintErr := mintPlatformHost(ctx, sess, acct, *app, channel, message) |
| switch { |
| case mintErr == nil: |
| - hosts, err = []string{host}, nil |
| - recs = append(recs, apiInstanceRecord{Host: host, Channel: channel, Kind: "static"}) |
| + // The create door's public_host rides along, so the |
| + // announcement and the watch print the name host where the |
| + // account has a subdomain; host stays what is dialed. |
| + hosts, err = []string{minted.Host}, nil |
| + recs = append(recs, apiInstanceRecord{Host: minted.Host, PublicHost: minted.PublicHost, Channel: channel, Kind: "static"}) |
| case enableUnavailable(mintErr): |
| // This deployment has no platform host to give — no apps domain, |
| // or an operator-pinned instance domain. The original refusal is |
| @@ -1074,21 +1077,21 @@ var errNoStaticHost = errors.New("no static host") |
| // stays right regardless: this caller has already resolved the channel it is |
| // about to promote to, and a record minted on a different one would serve |
| // something else. |
| -func mintPlatformHost(ctx context.Context, sess *apiSession, acct apiAcct, app, channel string, messages ...string) (string, error) { |
| +func mintPlatformHost(ctx context.Context, sess *apiSession, acct apiAcct, app, channel string, messages ...string) (apiInstanceRecord, error) { |
| m, err := sess.instancesEnable(ctx, acct, app, nil, nil, nil) |
| if err != nil { |
| - return "", err |
| + return apiInstanceRecord{}, err |
| } |
| // No environment: the app's apex serves its default config bundle, which |
| // is exactly right — this is the app's primary host, the one every other |
| // bundle's origin values are written to name. |
| rec, err := sess.instanceCreate(ctx, acct, app, app+"."+m.Domain, "", channel, "static", "", nil, nil, nil, firstMutationMessage(messages)) |
| if err != nil { |
| - return "", err |
| + return apiInstanceRecord{}, err |
| } |
| fmt.Fprintf(stdout, "%s %s (static, channel %s)\n", |
| colorFor(stdout).ok("minted"), rec.Host, rec.Channel) |
| - return rec.Host, nil |
| + return rec, nil |
| } |
| // attachUnclaimedHost auto-attaches --host before shipping, when this deploy |
diff --git a/deploy_test.go b/deploy_test.go| index 1b78486ec..11c24a9d2 100644 |
| --- a/deploy_test.go |
| +++ b/deploy_test.go |
| @@ -691,6 +691,12 @@ type deployFakeConsole struct { |
| // guarded channel's proposal shape, release pipelines v2 §4) instead of |
| // the normal 200 — the RIDER case, Task 11. |
| promoteProposed bool |
| + |
| + // mintDomain and mintPublicDomain answer a first static deploy's mint: |
| + // the manifest door pins mintDomain, and the create door answers the |
| + // record at <app>.<mintDomain> with public_host <app>.<mintPublicDomain> |
| + // when that is set (an account with a subdomain). |
| + mintDomain, mintPublicDomain string |
| } |
| func newDeployFakeConsole(t *testing.T, shipVersion string) *deployFakeConsole { |
| @@ -800,6 +806,31 @@ func newDeployFakeConsole(t *testing.T, shipVersion string) *deployFakeConsole { |
| } |
| json.NewEncoder(w).Encode(map[string]any{"result": "promoted", "held": false}) |
| }) |
| + mux.HandleFunc("PUT /api/cli/apps/{account}/{app}/instances-manifest", func(w http.ResponseWriter, r *http.Request) { |
| + fc.record(r) |
| + fc.mu.Lock() |
| + domain := fc.mintDomain |
| + fc.mu.Unlock() |
| + json.NewEncoder(w).Encode(map[string]any{"app": r.PathValue("app"), "domain": domain}) |
| + }) |
| + mux.HandleFunc("POST /api/cli/apps/{account}/{app}/instances", func(w http.ResponseWriter, r *http.Request) { |
| + fc.record(r) |
| + var in struct { |
| + Host string `json:"host"` |
| + Channel string `json:"channel"` |
| + Kind string `json:"kind"` |
| + } |
| + json.NewDecoder(r.Body).Decode(&in) |
| + fc.mu.Lock() |
| + public := fc.mintPublicDomain |
| + fc.mu.Unlock() |
| + rec := map[string]any{"host": in.Host, "channel": in.Channel, "kind": in.Kind} |
| + if public != "" { |
| + rec["public_host"] = r.PathValue("app") + "." + public |
| + } |
| + w.WriteHeader(http.StatusCreated) |
| + json.NewEncoder(w).Encode(rec) |
| + }) |
| fc.ts = httptest.NewServer(mux) |
| t.Cleanup(fc.ts.Close) |
| return fc |
| @@ -1738,7 +1769,8 @@ func TestMintPlatformHostSendsKindAndChannel(t *testing.T) { |
| defer ts.Close() |
| out := captureStdout(t) |
| - host, err := mintPlatformHost(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "mysite", "edge", "publish the new site") |
| + rec, err := mintPlatformHost(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "mysite", "edge", "publish the new site") |
| + host := rec.Host |
| if err != nil { |
| t.Fatalf("mintPlatformHost: %v", err) |
| } |
diff --git a/docs/site/cli.md b/docs/site/cli.md| index 3bc0a7863..d6d204725 100644 |
| --- a/docs/site/cli.md |
| +++ b/docs/site/cli.md |
| @@ -2305,7 +2305,7 @@ Without `--set` it prints the plan, who set it and why, and every limit the acco |
| ### carlos accounts subdomain |
| -Gives an account a readable name in its app addresses, so `shop.bdq.oncarlos.com` also answers at `shop.harbour.oncarlos.com`. It is a platform-operator command. |
| +Assigns a readable name to an account's app addresses, so `shop.bdq.oncarlos.com` also works as `shop.harbour.oncarlos.com`. Only platform operators can use it. |
| ```sh |
| carlos accounts subdomain set --account bdq harbour |
| @@ -2314,7 +2314,7 @@ carlos accounts subdomain remove --account bdq |
| carlos accounts subdomain inventory |
| ``` |
| -`set` gives the account the subdomain, then checks for up to two minutes that addresses under it answer over HTTPS. `remove` takes it away. It refuses while the account still has hosts attached under the name, and lists them. `show` prints the subdomain and any hosts under it that belong to other accounts. `inventory` lists the labels under the apps domain that are neither an account sqid nor an assigned subdomain, with the hosts under each. |
| +The `set` command gives the account the subdomain, then checks for up to two minutes that addresses under it work over HTTPS. The `remove` command takes it away, and refuses while the account still has hosts attached under the name, listing them. The `show` command prints the subdomain and any hosts under it that belong to other accounts. The `inventory` command lists labels under the apps domain that are neither an account sqid nor an assigned subdomain, with the hosts under each. |
| ### carlos billing |
diff --git a/docs/superpowers/notes/census-proposal-account-subdomains.md b/docs/superpowers/notes/census-proposal-account-subdomains.md| index ee9027e9b..bcb1d26cb 100644 |
| --- a/docs/superpowers/notes/census-proposal-account-subdomains.md |
| +++ b/docs/superpowers/notes/census-proposal-account-subdomains.md |
| @@ -4,7 +4,7 @@ Ruling `census-ruling-account-subdomains`. The independent reviewer approves or |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| -| `deploy.go` `runDeploy` | body | unchanged (1) | builds its watch targets with watchTargetsFor (host, watchOrigin(host), the instance list's public_host as Display, place, probe) from the instance list it already read, and passes them to watchDeployed; deployingLine prints the public host from that same list; the watch still dials and matches host; no read added, read site unchanged (1) | |
| +| `deploy.go` `runDeploy` | body | unchanged (1) | builds its watch targets with watchTargetsFor (host, watchOrigin(host), the instance list's public_host as Display, place, probe) from the instance list it already read, and passes them to watchDeployed; deployingLine prints the public host from that same list; the watch still dials and matches host; no read added, read site unchanged (1); fix round 1: a first static deploy keeps the create answer mintPlatformHost now returns (the whole record, not its host) and carries its public_host into the record it appends, for printing only; mintPlatformHost makes the same two console requests as before | |
| | `internal/edge/wildcard.go` `newWildcardFromEnv` | body | unchanged (3) | with PLATFORM_APPS_DOMAIN set, also gives the wildcard manager a names reader: the edge's own registry handle's ListAccountNamespaces (the box's own registry database, as carlos, as ListWildcardDomains beside it), keeping the last good names on a read error; refresh() inverts them to sqid -> name and parentsFor adds <name>.<apps-domain> as a parent only beside a sqid parent it already derives from a route host, and only for a name in the subdomain shape; no apps domain, no reader; same read sites (body change only); no file, path, command or bucket read added | |
| | `internal/host/agent.go` `aliasPassReportingComplete` | body | unchanged (5) | sets AliasReport.AppsDomain from PLATFORM_APPS_DOMAIN (trimmed), the variable domainsTickConfig reads; same reads and calls otherwise; body change only | |
| | `internal/domains/aliases.go` `ReconcileAliasesReport` | sites | +whole:Route ×3, +whole:RouteAlias ×3 | with AliasReport.AppsDomain set, reads the box's own account_namespaces table (reg.ListAccountNamespaces), sorts a listed-but-unread namespace claim (ParseNamespaceHost on the dropped host): a not-found body keeps nothing and is not counted by relevantDropped, any other failure keeps that name's recorded rows; runs deriveNamespaceAliases after deriveInstanceAliases on the routes, alias rows and claims it already read (AccountNamespaces over the read claims), keepNamespaceAliases for unread names, and writes the table through writeAccountNamespaces (once, only when it differs; no shrink under StartupNoRemoval); the added sites are the routes and alias rows already read handed to those helpers; no file or bucket read added; fix round 1: keepNamespaceAliases runs before deriveNamespaceAliases, and repairNamespaceStatus stamps "pointing" on derived-shape rows of exact claims and kept names, over claims and rows already read | |
| @@ -39,6 +39,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the |
| - other `changed registry schema`: closed only if it is the registry schema (re-pinned) |
| - reads `internal/registry/remote_dispatch.go:Registry.dispatchRemote`: +registry:Names, +registry:StringMap; keeps hint, task E2 |
| -Seal: `b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369` → `17d8c803e6d0930608c76963b82b5e6211734029d0c3651cbe86130db869e390`. |
| +Seal: `b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369` → `6d195fae0d02f91b496db73a8909227ae8587e09561973c8a44476c13cefc939`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-account-subdomains.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/console/apisubdomain.go b/internal/console/apisubdomain.go| index 0a61752c5..349c24757 100644 |
| --- a/internal/console/apisubdomain.go |
| +++ b/internal/console/apisubdomain.go |
| @@ -52,6 +52,12 @@ type subdomainReply struct { |
| Name string `json:"name"` |
| Host string `json:"host"` |
| Foreign []occupant `json:"foreign"` |
| + // CheckHost is set's answer only: one name host a box derives for the |
| + // account (<prefix>.<name>.<apps-domain> of one of its eligible |
| + // instance records), which the CLI handshakes with to see the name |
| + // served over TLS. Omitted when the account has none, or the walk |
| + // that finds one fails: the set itself has landed either way. |
| + CheckHost string `json:"check_host,omitempty"` |
| } |
| // The door's own refusal codes, beside domains.SubdomainRefusal's: stable |
| @@ -189,6 +195,61 @@ func (s *Server) subdomainShown(acct *Account, name string, foreign []occupant) |
| return reply |
| } |
| +// subdomainCheckLimit bounds how many record bodies set reads looking for |
| +// a check host. |
| +const subdomainCheckLimit = 20 |
| + |
| +// subdomainSetReply is set's answer: show's, with a check host. |
| +func (s *Server) subdomainSetReply(ctx context.Context, acct *Account, name string) subdomainReply { |
| + reply := s.subdomainShown(acct, name, nil) |
| + reply.CheckHost = s.subdomainCheckHost(ctx, acct.Sqid, name) |
| + return reply |
| +} |
| + |
| +// subdomainCheckHost is one host under name that a box derives for account |
| +// (deriveNamespaceAliases): the first, by host, of the account's instance |
| +// records at <prefix>.<sqid>.<apps-domain> that derivesName allows (not a |
| +// replica, not a sidecar), as <prefix>.<name>.<apps-domain>. A real host |
| +// answers over TLS however the deployment issues certificates, wildcard or |
| +// per host. "" when the account has none, or when the walk or every read |
| +// fails (logged): the CLI then skips its TLS check. |
| +func (s *Server) subdomainCheckHost(ctx context.Context, account, name string) string { |
| + domain := s.appsDomain() |
| + if domain == "" || s.cfg.Releases == nil { |
| + return "" |
| + } |
| + under := account + "." + domain |
| + hosts, err := provision.RecordHostDeclaredUnder(ctx, s.cfg.Releases, under) |
| + if err != nil { |
| + log.Printf("console: subdomain set %s %s: check host: %v", account, name, err) |
| + return "" |
| + } |
| + sort.Slice(hosts, func(i, j int) bool { return hosts[i].Host < hosts[j].Host }) |
| + view := namespaceView{byAccount: map[string]string{account: name}} |
| + read := 0 |
| + for _, h := range hosts { |
| + if h.Account != account || h.Host == under { |
| + continue |
| + } |
| + if read == subdomainCheckLimit { |
| + break |
| + } |
| + read++ |
| + rec, err := provision.GetRecord(ctx, s.cfg.Releases, h.Account, h.App, h.Host) |
| + if err != nil || rec == nil { |
| + log.Printf("console: subdomain set %s %s: check host %s: %v", account, name, h.Host, err) |
| + continue |
| + } |
| + if !derivesName(true, false, rec.Role == "replica", rec.KindOrDefault()) { |
| + continue |
| + } |
| + if shown := canonicalHostIn(view, domain, h.Host); shown != h.Host { |
| + return shown |
| + } |
| + } |
| + return "" |
| +} |
| + |
| // subdomainWritten tells the readers a namespace claim changed: the claim |
| // cache is reset (display reads re-read every claim) and the serial bumped |
| // (boxes reconcile now, not on the hourly floor). |
| @@ -268,7 +329,7 @@ func (s *Server) handleAPISubdomainSet(w http.ResponseWriter, r *http.Request) { |
| if v.byAccount[acct.Sqid] == name { |
| // The name the account already holds: answered again, nothing |
| // written. |
| - writeJSON(w, http.StatusOK, s.subdomainShown(acct, name, nil)) |
| + writeJSON(w, http.StatusOK, s.subdomainSetReply(ctx, acct, name)) |
| return |
| } |
| // One name per account, established by a complete read: a namespace |
| @@ -307,7 +368,7 @@ func (s *Server) handleAPISubdomainSet(w http.ResponseWriter, r *http.Request) { |
| s.refuseSubdomain(w, domains.SubdomainUnreadable, acct, req.Name, name, "", nil) |
| return |
| } |
| - writeJSON(w, http.StatusOK, s.subdomainShown(acct, name, nil)) |
| + writeJSON(w, http.StatusOK, s.subdomainSetReply(ctx, acct, name)) |
| default: |
| s.refuseSubdomain(w, domains.SubdomainOccupied, acct, req.Name, name, "", |
| []occupant{{Host: cur.Host, Account: cur.Account, App: cur.App, Source: occupantClaim}}) |
| @@ -320,7 +381,7 @@ func (s *Server) handleAPISubdomainSet(w http.ResponseWriter, r *http.Request) { |
| return |
| } |
| s.subdomainWritten(ctx) |
| - writeJSON(w, http.StatusOK, s.subdomainShown(acct, name, nil)) |
| + writeJSON(w, http.StatusOK, s.subdomainSetReply(ctx, acct, name)) |
| } |
| // subdomainReread is set's read after its write (§4.2, the race): conflict |
diff --git a/internal/console/apisubdomain_test.go b/internal/console/apisubdomain_test.go| index c0f4b4318..309736852 100644 |
| --- a/internal/console/apisubdomain_test.go |
| +++ b/internal/console/apisubdomain_test.go |
| @@ -687,3 +687,52 @@ func TestSubdomainInventory(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// TestSubdomainSetAnswersCheckHost: set names one real name host of the |
| +// account for the CLI's TLS check (Task 7 fix round 1, I1): the first |
| +// eligible instance record under the account's sqid label, rewritten under |
| +// the name; a replica derives no name and is passed over. An account with |
| +// no instance under its label answers no check host. |
| +func TestSubdomainSetAnswersCheckHost(t *testing.T) { |
| + type answer struct { |
| + Name string `json:"name"` |
| + CheckHost *string `json:"check_host"` |
| + } |
| + set := func(fx *consoleFixture, operator string) answer { |
| + t.Helper() |
| + code, _, out := rawReq(t, http.MethodPost, sdURL(fx, "bdq"), operator, `{"name":"harbour"}`) |
| + var a answer |
| + if err := json.Unmarshal([]byte(out), &a); err != nil || code != http.StatusOK || a.Name != "harbour" { |
| + t.Fatalf("set harbour = %d %s", code, out) |
| + } |
| + return a |
| + } |
| + |
| + fx, operator, _ := sdFixture(t, "code-sd-check-none") |
| + if a := set(fx, operator); a.CheckHost != nil { |
| + t.Errorf("an account with no instance answered check_host %q, want it omitted", *a.CheckHost) |
| + } |
| + |
| + fx, operator, _ = sdFixture(t, "code-sd-check") |
| + for _, rec := range []provision.Record{ |
| + {Schema: 1, Host: "a.bdq." + nsApps, Slug: "a", App: "shop", Account: "bdq", Channel: "stable", Role: "replica"}, |
| + {Schema: 1, Host: "shop.bdq." + nsApps, Slug: "shop", App: "shop", Account: "bdq", Channel: "stable"}, |
| + } { |
| + rec.CreatedAt = time.Now().UTC() |
| + if err := provision.CreateRecord(context.Background(), fx.rel, rec); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + a := set(fx, operator) |
| + if want := "shop.harbour." + nsApps; a.CheckHost == nil || *a.CheckHost != want { |
| + t.Fatalf("check_host = %v, want %q", a.CheckHost, want) |
| + } |
| + // Set again (the name it already holds): the same check host. |
| + if a := set(fx, operator); a.CheckHost == nil || *a.CheckHost != "shop.harbour."+nsApps { |
| + t.Errorf("repeat set check_host = %v", a.CheckHost) |
| + } |
| + // Show never carries one. |
| + if _, _, out := sdReq(t, fx, http.MethodGet, "bdq", operator, ""); strings.Contains(out, "check_host") { |
| + t.Errorf("show answered a check host: %s", out) |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-account-subdomains.tsv b/internal/provision/testdata/plan14-root-reads-account-subdomains.tsv| index 7e1c11814..0f8c09017 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-account-subdomains.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-account-subdomains.tsv |
| @@ -1,7 +1,7 @@ |
| # Census overlay account-subdomains, written by census-propose (#369). census-ruling-account-subdomains, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-account-subdomains.md. |
| # 3 body, 5 sites, 6 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| # 8 new dispositions: 1 reads re-frozen at their disposition with the claim, 6 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 1 other. |
| -@legacy a7db0eae4f04f1dfc38a89842a97cb3e9929e137dd3137e5e402db3eee5cc21c deploy.go runDeploy legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-edge-asset-cache-1;basis=takes --assets and --no-assets, refuses both together and bad folders before anything runs (deployAssets), reads the folders saved in .carlos/config for the session's console through configAssets (the config walk the CLI already makes), and saves a new list there as it saves the other deploy settings; read site unchanged (1), none added;rev3=census-ruling-gated-deploy-watch-164;basis=the static-deploy branch passes its watch targets through passGatedTargets (a console POST for a gate pass per gated host) and passes the gated-host set to watchDeployed; no new local read, read site unchanged (1), none added;rev3=census-ruling-region-labels;basis=builds a host-to-label map (hostPlaces) from the instance list it already read and passes it to the static watch targets and watchDeployed, so the watch lines say where; no read added;rev3=census-ruling-first-deploy-493;basis=Sequences existing console APIs for confirmed-missing app and first instance creation, with repeatable environment values; local artifact preflight before these new writes. Existing config artifact stat read retained.;rev3=census-ruling-account-subdomains;basis=builds its watch targets with watchTargetsFor (host, watchOrigin(host), the instance list's public_host as Display, place, probe) from the instance list it already read, and passes them to watchDeployed; deployingLine prints the public host from that same list; the watch still dials and matches host; no read added, read site unchanged (1) file:Stat@9052 f011cacdfd05d9f422b530537a7b6bb1a65733ae76ee83464d6566540a9fcae6 |
| +@legacy ba7631ab091aeb9074ce874bc504dbab9714a6db83d21e087ea256517decca90 deploy.go runDeploy legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-edge-asset-cache-1;basis=takes --assets and --no-assets, refuses both together and bad folders before anything runs (deployAssets), reads the folders saved in .carlos/config for the session's console through configAssets (the config walk the CLI already makes), and saves a new list there as it saves the other deploy settings; read site unchanged (1), none added;rev3=census-ruling-gated-deploy-watch-164;basis=the static-deploy branch passes its watch targets through passGatedTargets (a console POST for a gate pass per gated host) and passes the gated-host set to watchDeployed; no new local read, read site unchanged (1), none added;rev3=census-ruling-region-labels;basis=builds a host-to-label map (hostPlaces) from the instance list it already read and passes it to the static watch targets and watchDeployed, so the watch lines say where; no read added;rev3=census-ruling-first-deploy-493;basis=Sequences existing console APIs for confirmed-missing app and first instance creation, with repeatable environment values; local artifact preflight before these new writes. Existing config artifact stat read retained.;rev3=census-ruling-account-subdomains;basis=builds its watch targets with watchTargetsFor (host, watchOrigin(host), the instance list's public_host as Display, place, probe) from the instance list it already read, and passes them to watchDeployed; deployingLine prints the public host from that same list; the watch still dials and matches host; no read added, read site unchanged (1); fix round 1: a first static deploy keeps the create answer mintPlatformHost now returns (the whole record, not its host) and carries its public_host into the record it appends, for printing only; mintPlatformHost makes the same two console requests as before file:Stat@9052 272076ae95f6342e8bcba1d8e8a968b96c608ec0ec09650c7ecc57674438de3a |
| @legacy 44c3c50f4bcda5c032356b159d9e5f4a15fdb66c82cbeca1989f1d1a247bac21 internal/edge/wildcard.go newWildcardFromEnv legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-agent-start-demo-1;basis=Includes the configured demo domain in the existing wildcard manager's explicit parent input.;rev3=census-ruling-region-ha-g2r-fixes;basis=W2a: on a gated box (issuer gate armed: store and mirror exist) with no DNS provider, builds a serve-only wildcard manager that loads and serves wildcard PEMs from the existing local cache/mirror and never orders (dns nil never reaches obtain). Ungated boxes still get nil. Same parent inputs; no new path or provider credential read.;rev3=census-ruling-account-subdomains;basis=with PLATFORM_APPS_DOMAIN set, also gives the wildcard manager a names reader: the edge's own registry handle's ListAccountNamespaces (the box's own registry database, as carlos, as ListWildcardDomains beside it), keeping the last good names on a read error; refresh() inverts them to sqid -> name and parentsFor adds <name>.<apps-domain> as a parent only beside a sqid parent it already derives from a route host, and only for a name in the subdomain shape; no apps domain, no reader; same read sites (body change only); no file, path, command or bucket read added registry:Host@6617,whole:WildcardDomain@6564,whole:WildcardDomain@6590 3fd6037048f31fdf43704ab87f43ab45a8aa8ad1a73b92bc656eeae367b4b225 |
| @legacy 25840eb4a2ba81e4108851318ad48bc9d7bdccc6a824c7a8ca372306428913bb internal/host/agent.go aliasPassReportingComplete legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-g2-fixes;basis=Extract the existing serialized alias pass, add cancellable locking and routing-only alias/regional publication from its completeness report; existing deployment/claim/registry reads retained, new in-memory Route/RegionalDomain passes.;rev3=census-ruling-fix-incomplete-domains-pass;basis=gains a startup bool parameter that it copies into domains.AliasReport.StartupNoRemoval; runHAIngressStartup passes true, aliasPassReporting (the ordinary agent pass) passes false; same reads and calls, body change only; no root pass calls it; no root decision;rev3=census-ruling-account-subdomains;basis=sets AliasReport.AppsDomain from PLATFORM_APPS_DOMAIN (trimmed), the variable domainsTickConfig reads; same reads and calls otherwise; body change only whole:RegionalDomain@1778,whole:Route@1856,whole:Route@957,whole:Route@979,whole:Route@998 8a439cd701910b91d9bf8c39e96a56141c20c063f590dc26f557eb5337884ad6 |
| @legacy 6640a6d2ced4baaf78c77b55c524e0cdf0392c0d028319922700db419e9a5c57 internal/domains/namespacealiases.go deriveNamespaceAliases legacy accepted-legacy accepted-legacy;rev3=census-ruling-account-subdomains;basis=new: derives <prefix>.<name>.<apps> -> <prefix>.<sqid>.<apps> alias rows from the routes, alias rows and claim listing the pass already read (Provisioned or Platform, not sidecar or replica, of the name's account), writes them "pointing" (fix round 1) with UpsertAlias, and SetAliasDNSStatus("pointing") for an existing one that is not, to the box's own registry, and HA names into the in-memory AliasIngress report; no file, path or bucket read registry:Account@1666,registry:Account@2867,registry:Alias@760,registry:App@1687,registry:App@1696,registry:App@1812,registry:DNSStatus@2137,registry:HA@2758,registry:Host@1238,registry:Host@1645,registry:Host@1655,registry:Host@1783,registry:Host@2740,registry:Host@2849,registry:Platform@1062,registry:Provisioned@1044,registry:Replica@1096,whole:Route@1028,whole:Route@1156,whole:Route@2412,whole:Route@2494,whole:Route@2532,whole:Route@2714,whole:Route@2769,whole:Route@3107,whole:Route@3172,whole:Route@3246,whole:Route@3302,whole:Route@3326,whole:Route@919,whole:RouteAlias@1617,whole:RouteAlias@712,whole:RouteAlias@742,whole:RouteAlias@755,whole:RouteAlias@771 c100c0ab8340ac352b4ccce7c6db7c572d5d54d4ba8924214d1cc097a7e39f21 |
| @@ -15,7 +15,7 @@ |
| @legacy 6487c32cb53e58f13d5304afbf1d1bfde28819c3d266fe32dd5600cade696388 internal/domains/reconcile.go StampHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-dns-fresh-lookup-724;basis=section 4 now computes every cached verdict first, then freshUpgrade gives up to 64 randomly ordered names that could have a public zone (not under the apps domain, not special-use like .internal) and whose verdict is "" or "elsewhere" an uncached lookup (30 s pass budget) that may only upgrade to "pointing", then stamps; the extra sites are the indexed loops over the same rows (#724);rev3=census-ruling-no-negative-prime-724;basis=section 4 now hands each route and alias, with its previous stamp (the two new registry:DNSStatus reads, rt.DNSStatus and a.DNSStatus, same rows already listed), to dnsVerdicts, which first hands the pass's hostnames to Config.FreshRetain (the resolver forgets its in-memory backoff and strike for names no longer carried) and then decides each hostname once per pass and applies the verdict to every row carrying it: a name not "pointing" before this pass and eligible for a fresh lookup (public name, not under the apps domain, ResolveFresh set) is looked at uncached first within the same 64-lookup/30 s budget (shared, with previously "pointing" names' upgrade looks serviced before any fresh-first name so new names cannot starve a published one) and stamped from it (edge address, A or AAAA, "pointing", other "elsewhere", authoritative not-found "", authoritative NODATA for A and AAAA with the zone's SOA "" with no cached query), falling back to the cached lookup past the budget or on the second fresh failure in a row; the first fresh failure in a row is held (stamp and check time untouched, the resolver forgives it so the next pass asks fresh again); a previously "pointing" name keeps cached-first plus the upgrade-only fresh look (ResolveUpgrade, nearest zones first), so the fresh path still never unpublishes; a fresh-first name that ends the pass "pointing" (fresh or cached) has its fresh failure backoff cleared through Config.FreshForget, so an onboarding failure never suppresses the upgrade look that keeps it published; new names are ordered never-checked first then oldest check, and lookups answered from the backoff do not count against the budget; StampHealth's own body is unchanged by the last round; no new file, path or command input; the dropped Alias/Host/Route/RouteAlias sites are the old indexed loops folded into the candidate build (#724);rev3=census-ruling-account-subdomains;basis=reads the box's own account_namespaces table (only when DNS stamping runs) and leaves out of the DNS loop the alias rows isNamespaceDerived names (an alias under a held name, of that name's account, pointing at its sqid twin); if that read fails it logs and leaves out every alias two or more labels under the apps domain, still stamping every other alias, every route and all TLS expiry (fix round 1); the added RouteAlias sites are that filter over rows already listed; stamps less, never more; TLS stamping unchanged registry:Alias@1972,registry:Alias@4450,registry:Alias@5039,registry:Alias@5129,registry:Alias@5563,registry:Alias@5627,registry:Alias@5715,registry:DNSCheckedAt@4325,registry:DNSCheckedAt@4472,registry:DNSStatus@4311,registry:DNSStatus@4459,registry:DNSStatus@4664,registry:DNSStatus@4963,registry:Host@4302,registry:Host@4736,registry:Host@4820,registry:Host@5332,registry:Host@5391,registry:Host@5473,whole:Route@199,whole:Route@236,whole:Route@4126,whole:Route@4242,whole:Route@4571,whole:Route@5286,whole:RouteAlias@1680,whole:RouteAlias@1906,whole:RouteAlias@2058,whole:RouteAlias@2106,whole:RouteAlias@2126,whole:RouteAlias@2138,whole:RouteAlias@4172,whole:RouteAlias@4386,whole:RouteAlias@4866,whole:RouteAlias@5516,whole:RouteAlias@780 5288387d1eac4611bc4b1acc30569011009192e7210127001c27174e1e1cfa43 |
| @legacy d5b19e5fea9c3ef9f7b7c68012a8529fcab3fe0a670e1e4a64d90366ab25bf10 internal/registry/registry.go Registry.Fingerprint legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user); the remote arm, unchanged, in the process that holds a remote handle: census-ruling-seeded-instances's body with the row's lifetime pair (incarnation, serving_seq) folded into the edge's change poll, each only when non-zero, so a registry with no pair digests as before; self-serve moves 1 Task 7;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: hashes regional_domains (host, target, account, app, region; created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no regional rows digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; no file path read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): review R1 finding 1: the routes SELECT also reads host, kind, account, app, platform and fingerprintForwardInert (one CASE over the ForwardForbidden columns), and every row folds host, kind, account and app (tagged, quoted), platform when set, and forward_inert=0 for a forward row that is not inert, so a rowid reused by another hostname, an in-place account or app rewrite, or a stray forbidden column moves the edge's change poll. Same one SELECT per table on the same fresh connection to the box's own registry database, as carlos; no table, file or bucket read added; a digest, never a decision.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5): the SELECT also reads fleet_label and, only when it is set, hashes "fleet_label=<q>" into the digest, so labelling a row moves the edge's reload fingerprint. Read sites unchanged (33). Registry side, not root; an unlabelled registry's digest is byte-identical.;rev3=census-ruling-stateless-replicas-1;basis=Read the additive stateless projection in the existing registry SELECT and hash only when set; no new read source.;rev3=census-ruling-agent-start-demo-1;basis=Existing SELECT reads four more demo columns; only a marked row adds them to the hash, so ordinary hashes remain unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Four additive projection columns join the existing routes SELECT and hash only when nonzero; no new query or file read. merge of origin/main 6be08467: Union main demo identity and expiry with replica columns in the same SELECT and hash; merge-only body change.;rev3=census-ruling-agent-start-demo-3;basis=Hash moved-notice wire bytes so notice-only changes invalidate an edge route snapshot. Census read-site delta: +file:QueryRow.;rev3=census-ruling-edge-page-cache-1;basis=selects the new pages_off column with the rest and folds "pages_off=1" into the hash only when set, as assets_off, so a registry that never sets it fingerprints as before; same routes SELECT, no new table; read sites unchanged (34); no read added;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: hashes link_channels (link_id, account, token_hash, status, generation; connected, seen_at, seq and created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no links digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; a digest, never a decision; linked deployments slice 1 Task 7: also folds home_link (id, serving_url, tunnel_url, the token's sha256 never the token, account, apps_domain, box_label, conn_gen; state and created_at not) and home_link_apps (name, home_account, home_app, home_host) through fingerprintHomeLink over the same fresh connection, each section marker written only when a row exists, so a registry with no link digests as before; no file path read; a digest, never a decision;rev3=census-ruling-account-subdomains;basis=hashes account_namespaces (name, account) over the same fresh connection, with a section marker written only when a row exists, so a registry with no held names digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; a digest, never a decision file:Exec@284,file:Open@188,file:Query@10785,file:Query@11707,file:Query@12810,file:Query@368,file:Query@6655,file:Query@7134,file:Query@8120,file:Query@8816,file:Query@9728,file:QueryRow@13727,registry:ClaimIncarnation@1729,registry:ClaimIncarnation@5563,registry:ClaimIncarnation@5640,registry:ClaimOwner@1773,registry:ClaimOwner@5764,registry:ClaimOwner@5829,registry:ClaimRowID@1792,registry:ClaimRowID@5856,registry:ClaimRowID@5922,registry:ClaimStamp@1754,registry:ClaimStamp@5673,registry:ClaimStamp@5737,registry:Incarnation@1848,registry:Incarnation@6143,registry:Incarnation@6207,registry:ServingSeq@1867,registry:ServingSeq@6234,registry:ServingSeq@6297,registry:Text@158,registry:path@207,registry:remote@55,registry:remote@87,whole:remoteClient@57,whole:remoteClient@89 a52e0bc25d555bbf22f35655c54c0fa3aca6cedec5f0b6b80157d9d95f921a29 |
| @legacy 5d46724aa4ebbec5cc075b3d28c1efd3fdd89e73abcb73ceaabc6bc2c68c36e5 internal/registry/registry.go Registry.migrate legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user), on every registry open; a box CLI verb that opens the registry directly runs it as whoever runs the verb: census-ruling-seeded-instances's body with two more columns added to routes (incarnation and serving_seq, INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule); self-serve moves 1 Task 7;rev3=census-ruling-rootfs-apps-2;basis=one more ALTER TABLE, routes ADD COLUMN runtime TEXT NOT NULL DEFAULT '', beside main's rate_limit, assets_off, asset_gen, incarnation and serving_seq (the last four from the merges of origin/main 3c33f2eb and 953b9fda); the same sixteen sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328/#329 plan 1 Task 4: three more ALTER TABLE statements in the existing loop, routes ADD COLUMN egress_allow, size and policy_expires_at, each TEXT NOT NULL DEFAULT '' and idempotent through the duplicate-column rule; the same sixteen sites, no read added.;rev3=census-ruling-region-ha-p1a;basis=one more ALTER TABLE in the existing loop: routes ADD COLUMN ha INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule; the same sixteen sites, no read added;rev3=census-ruling-ha-p1a-433;basis=the registry's SQLite side as carlos (agent, registry child; a box CLI verb that opens the registry directly runs it as whoever runs it), on every registry open: the ALTER TABLE routes statements are now built from the one migration definition routeAddedColumns (addedColumn name, type, default; review r1 P2): for each entry without the Claim mark, "ALTER TABLE routes ADD COLUMN " + spec(), byte for byte the statements main runs, in main's order, under the same duplicate-column rule. +registry:Claim is that mark, +whole:addedColumn the struct. Every name, type and default is an in-binary literal; no statement added, removed or changed; no read added.;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: one more CREATE TABLE IF NOT EXISTS regional_domains (host TEXT PRIMARY KEY, target, account, app, region TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL DEFAULT 0), beside wildcard_domains; the added sites are that statement (+file:Exec, +registry:sql), an in-binary literal; additive, no existing statement changed;rev3=census-ruling-region-ha-p1b3b-t;basis=Create local HA duty/replay tables and revision triggers in the existing registry connection; no new database path.;rev3=census-ruling-agent-start-demo-3;basis=Create moved-notice storage as a single (id, wire) row; fingerprints include the stored wire bytes. Census read-site delta: +file:Exec, +registry:sql.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: calls migrateLinks after migrateHADuties (one CREATE TABLE IF NOT EXISTS link_channels, an in-binary literal); additive, no existing statement changed; linked deployments slice 1 Task 7: also runs migrateHomeLink (CREATE TABLE IF NOT EXISTS home_link and home_link_apps) after migrateLinks; additive, the box's own registry database, as carlos;rev3=census-ruling-account-subdomains;basis=one more CREATE TABLE IF NOT EXISTS account_namespaces (name TEXT PRIMARY KEY, account TEXT NOT NULL), an in-binary literal (+file:Exec, +registry:sql); additive, no existing statement changed file:Exec@1124,file:Exec@1855,file:Exec@212,file:Exec@2409,file:Exec@3057,file:Exec@3822,file:Exec@4101,file:Exec@4964,file:Exec@51,file:Exec@5140,file:Exec@761,registry:Claim@686,registry:sql@1124,registry:sql@1855,registry:sql@212,registry:sql@2409,registry:sql@3057,registry:sql@3822,registry:sql@4101,registry:sql@4964,registry:sql@51,registry:sql@5140,registry:sql@761,whole:addedColumn@661 0c5fdaf1215e8f81c156a1fc1576cb075c2a52238bde75fc8320d49472fd117d |
| -deploy.go runDeploy legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-edge-asset-cache-1;basis=takes --assets and --no-assets, refuses both together and bad folders before anything runs (deployAssets), reads the folders saved in .carlos/config for the session's console through configAssets (the config walk the CLI already makes), and saves a new list there as it saves the other deploy settings; read site unchanged (1), none added;rev3=census-ruling-gated-deploy-watch-164;basis=the static-deploy branch passes its watch targets through passGatedTargets (a console POST for a gate pass per gated host) and passes the gated-host set to watchDeployed; no new local read, read site unchanged (1), none added;rev3=census-ruling-region-labels;basis=builds a host-to-label map (hostPlaces) from the instance list it already read and passes it to the static watch targets and watchDeployed, so the watch lines say where; no read added;rev3=census-ruling-first-deploy-493;basis=Sequences existing console APIs for confirmed-missing app and first instance creation, with repeatable environment values; local artifact preflight before these new writes. Existing config artifact stat read retained.;rev3=census-ruling-account-subdomains;basis=builds its watch targets with watchTargetsFor (host, watchOrigin(host), the instance list's public_host as Display, place, probe) from the instance list it already read, and passes them to watchDeployed; deployingLine prints the public host from that same list; the watch still dials and matches host; no read added, read site unchanged (1) file:Stat@9052 f011cacdfd05d9f422b530537a7b6bb1a65733ae76ee83464d6566540a9fcae6 |
| +deploy.go runDeploy legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-edge-asset-cache-1;basis=takes --assets and --no-assets, refuses both together and bad folders before anything runs (deployAssets), reads the folders saved in .carlos/config for the session's console through configAssets (the config walk the CLI already makes), and saves a new list there as it saves the other deploy settings; read site unchanged (1), none added;rev3=census-ruling-gated-deploy-watch-164;basis=the static-deploy branch passes its watch targets through passGatedTargets (a console POST for a gate pass per gated host) and passes the gated-host set to watchDeployed; no new local read, read site unchanged (1), none added;rev3=census-ruling-region-labels;basis=builds a host-to-label map (hostPlaces) from the instance list it already read and passes it to the static watch targets and watchDeployed, so the watch lines say where; no read added;rev3=census-ruling-first-deploy-493;basis=Sequences existing console APIs for confirmed-missing app and first instance creation, with repeatable environment values; local artifact preflight before these new writes. Existing config artifact stat read retained.;rev3=census-ruling-account-subdomains;basis=builds its watch targets with watchTargetsFor (host, watchOrigin(host), the instance list's public_host as Display, place, probe) from the instance list it already read, and passes them to watchDeployed; deployingLine prints the public host from that same list; the watch still dials and matches host; no read added, read site unchanged (1); fix round 1: a first static deploy keeps the create answer mintPlatformHost now returns (the whole record, not its host) and carries its public_host into the record it appends, for printing only; mintPlatformHost makes the same two console requests as before file:Stat@9052 272076ae95f6342e8bcba1d8e8a968b96c608ec0ec09650c7ecc57674438de3a |
| internal/edge/wildcard.go newWildcardFromEnv legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-agent-start-demo-1;basis=Includes the configured demo domain in the existing wildcard manager's explicit parent input.;rev3=census-ruling-region-ha-g2r-fixes;basis=W2a: on a gated box (issuer gate armed: store and mirror exist) with no DNS provider, builds a serve-only wildcard manager that loads and serves wildcard PEMs from the existing local cache/mirror and never orders (dns nil never reaches obtain). Ungated boxes still get nil. Same parent inputs; no new path or provider credential read.;rev3=census-ruling-account-subdomains;basis=with PLATFORM_APPS_DOMAIN set, also gives the wildcard manager a names reader: the edge's own registry handle's ListAccountNamespaces (the box's own registry database, as carlos, as ListWildcardDomains beside it), keeping the last good names on a read error; refresh() inverts them to sqid -> name and parentsFor adds <name>.<apps-domain> as a parent only beside a sqid parent it already derives from a route host, and only for a name in the subdomain shape; no apps domain, no reader; same read sites (body change only); no file, path, command or bucket read added registry:Host@6617,whole:WildcardDomain@6564,whole:WildcardDomain@6590 3fd6037048f31fdf43704ab87f43ab45a8aa8ad1a73b92bc656eeae367b4b225 |
| internal/host/agent.go aliasPassReportingComplete legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-g2-fixes;basis=Extract the existing serialized alias pass, add cancellable locking and routing-only alias/regional publication from its completeness report; existing deployment/claim/registry reads retained, new in-memory Route/RegionalDomain passes.;rev3=census-ruling-fix-incomplete-domains-pass;basis=gains a startup bool parameter that it copies into domains.AliasReport.StartupNoRemoval; runHAIngressStartup passes true, aliasPassReporting (the ordinary agent pass) passes false; same reads and calls, body change only; no root pass calls it; no root decision;rev3=census-ruling-account-subdomains;basis=sets AliasReport.AppsDomain from PLATFORM_APPS_DOMAIN (trimmed), the variable domainsTickConfig reads; same reads and calls otherwise; body change only whole:RegionalDomain@1778,whole:Route@1856,whole:Route@957,whole:Route@979,whole:Route@998 8a439cd701910b91d9bf8c39e96a56141c20c063f590dc26f557eb5337884ad6 |
| internal/domains/namespacealiases.go deriveNamespaceAliases legacy accepted-legacy accepted-legacy;rev3=census-ruling-account-subdomains;basis=new: derives <prefix>.<name>.<apps> -> <prefix>.<sqid>.<apps> alias rows from the routes, alias rows and claim listing the pass already read (Provisioned or Platform, not sidecar or replica, of the name's account), writes them "pointing" (fix round 1) with UpsertAlias, and SetAliasDNSStatus("pointing") for an existing one that is not, to the box's own registry, and HA names into the in-memory AliasIngress report; no file, path or bucket read registry:Account@1666,registry:Account@2867,registry:Alias@760,registry:App@1687,registry:App@1696,registry:App@1812,registry:DNSStatus@2137,registry:HA@2758,registry:Host@1238,registry:Host@1645,registry:Host@1655,registry:Host@1783,registry:Host@2740,registry:Host@2849,registry:Platform@1062,registry:Provisioned@1044,registry:Replica@1096,whole:Route@1028,whole:Route@1156,whole:Route@2412,whole:Route@2494,whole:Route@2532,whole:Route@2714,whole:Route@2769,whole:Route@3107,whole:Route@3172,whole:Route@3246,whole:Route@3302,whole:Route@3326,whole:Route@919,whole:RouteAlias@1617,whole:RouteAlias@712,whole:RouteAlias@742,whole:RouteAlias@755,whole:RouteAlias@771 c100c0ab8340ac352b4ccce7c6db7c572d5d54d4ba8924214d1cc097a7e39f21 |
| @@ -30,7 +30,7 @@ internal/domains/aliases.go deriveInstanceAliases legacy accepted-legacy accepte |
| internal/domains/reconcile.go StampHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-dns-fresh-lookup-724;basis=section 4 now computes every cached verdict first, then freshUpgrade gives up to 64 randomly ordered names that could have a public zone (not under the apps domain, not special-use like .internal) and whose verdict is "" or "elsewhere" an uncached lookup (30 s pass budget) that may only upgrade to "pointing", then stamps; the extra sites are the indexed loops over the same rows (#724);rev3=census-ruling-no-negative-prime-724;basis=section 4 now hands each route and alias, with its previous stamp (the two new registry:DNSStatus reads, rt.DNSStatus and a.DNSStatus, same rows already listed), to dnsVerdicts, which first hands the pass's hostnames to Config.FreshRetain (the resolver forgets its in-memory backoff and strike for names no longer carried) and then decides each hostname once per pass and applies the verdict to every row carrying it: a name not "pointing" before this pass and eligible for a fresh lookup (public name, not under the apps domain, ResolveFresh set) is looked at uncached first within the same 64-lookup/30 s budget (shared, with previously "pointing" names' upgrade looks serviced before any fresh-first name so new names cannot starve a published one) and stamped from it (edge address, A or AAAA, "pointing", other "elsewhere", authoritative not-found "", authoritative NODATA for A and AAAA with the zone's SOA "" with no cached query), falling back to the cached lookup past the budget or on the second fresh failure in a row; the first fresh failure in a row is held (stamp and check time untouched, the resolver forgives it so the next pass asks fresh again); a previously "pointing" name keeps cached-first plus the upgrade-only fresh look (ResolveUpgrade, nearest zones first), so the fresh path still never unpublishes; a fresh-first name that ends the pass "pointing" (fresh or cached) has its fresh failure backoff cleared through Config.FreshForget, so an onboarding failure never suppresses the upgrade look that keeps it published; new names are ordered never-checked first then oldest check, and lookups answered from the backoff do not count against the budget; StampHealth's own body is unchanged by the last round; no new file, path or command input; the dropped Alias/Host/Route/RouteAlias sites are the old indexed loops folded into the candidate build (#724);rev3=census-ruling-account-subdomains;basis=reads the box's own account_namespaces table (only when DNS stamping runs) and leaves out of the DNS loop the alias rows isNamespaceDerived names (an alias under a held name, of that name's account, pointing at its sqid twin); if that read fails it logs and leaves out every alias two or more labels under the apps domain, still stamping every other alias, every route and all TLS expiry (fix round 1); the added RouteAlias sites are that filter over rows already listed; stamps less, never more; TLS stamping unchanged registry:Alias@1972,registry:Alias@4450,registry:Alias@5039,registry:Alias@5129,registry:Alias@5563,registry:Alias@5627,registry:Alias@5715,registry:DNSCheckedAt@4325,registry:DNSCheckedAt@4472,registry:DNSStatus@4311,registry:DNSStatus@4459,registry:DNSStatus@4664,registry:DNSStatus@4963,registry:Host@4302,registry:Host@4736,registry:Host@4820,registry:Host@5332,registry:Host@5391,registry:Host@5473,whole:Route@199,whole:Route@236,whole:Route@4126,whole:Route@4242,whole:Route@4571,whole:Route@5286,whole:RouteAlias@1680,whole:RouteAlias@1906,whole:RouteAlias@2058,whole:RouteAlias@2106,whole:RouteAlias@2126,whole:RouteAlias@2138,whole:RouteAlias@4172,whole:RouteAlias@4386,whole:RouteAlias@4866,whole:RouteAlias@5516,whole:RouteAlias@780 5288387d1eac4611bc4b1acc30569011009192e7210127001c27174e1e1cfa43 |
| internal/registry/registry.go Registry.Fingerprint legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user); the remote arm, unchanged, in the process that holds a remote handle: census-ruling-seeded-instances's body with the row's lifetime pair (incarnation, serving_seq) folded into the edge's change poll, each only when non-zero, so a registry with no pair digests as before; self-serve moves 1 Task 7;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: hashes regional_domains (host, target, account, app, region; created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no regional rows digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; no file path read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): review R1 finding 1: the routes SELECT also reads host, kind, account, app, platform and fingerprintForwardInert (one CASE over the ForwardForbidden columns), and every row folds host, kind, account and app (tagged, quoted), platform when set, and forward_inert=0 for a forward row that is not inert, so a rowid reused by another hostname, an in-place account or app rewrite, or a stray forbidden column moves the edge's change poll. Same one SELECT per table on the same fresh connection to the box's own registry database, as carlos; no table, file or bucket read added; a digest, never a decision.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5): the SELECT also reads fleet_label and, only when it is set, hashes "fleet_label=<q>" into the digest, so labelling a row moves the edge's reload fingerprint. Read sites unchanged (33). Registry side, not root; an unlabelled registry's digest is byte-identical.;rev3=census-ruling-stateless-replicas-1;basis=Read the additive stateless projection in the existing registry SELECT and hash only when set; no new read source.;rev3=census-ruling-agent-start-demo-1;basis=Existing SELECT reads four more demo columns; only a marked row adds them to the hash, so ordinary hashes remain unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Four additive projection columns join the existing routes SELECT and hash only when nonzero; no new query or file read. merge of origin/main 6be08467: Union main demo identity and expiry with replica columns in the same SELECT and hash; merge-only body change.;rev3=census-ruling-agent-start-demo-3;basis=Hash moved-notice wire bytes so notice-only changes invalidate an edge route snapshot. Census read-site delta: +file:QueryRow.;rev3=census-ruling-edge-page-cache-1;basis=selects the new pages_off column with the rest and folds "pages_off=1" into the hash only when set, as assets_off, so a registry that never sets it fingerprints as before; same routes SELECT, no new table; read sites unchanged (34); no read added;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: hashes link_channels (link_id, account, token_hash, status, generation; connected, seen_at, seq and created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no links digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; a digest, never a decision; linked deployments slice 1 Task 7: also folds home_link (id, serving_url, tunnel_url, the token's sha256 never the token, account, apps_domain, box_label, conn_gen; state and created_at not) and home_link_apps (name, home_account, home_app, home_host) through fingerprintHomeLink over the same fresh connection, each section marker written only when a row exists, so a registry with no link digests as before; no file path read; a digest, never a decision;rev3=census-ruling-account-subdomains;basis=hashes account_namespaces (name, account) over the same fresh connection, with a section marker written only when a row exists, so a registry with no held names digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; a digest, never a decision file:Exec@284,file:Open@188,file:Query@10785,file:Query@11707,file:Query@12810,file:Query@368,file:Query@6655,file:Query@7134,file:Query@8120,file:Query@8816,file:Query@9728,file:QueryRow@13727,registry:ClaimIncarnation@1729,registry:ClaimIncarnation@5563,registry:ClaimIncarnation@5640,registry:ClaimOwner@1773,registry:ClaimOwner@5764,registry:ClaimOwner@5829,registry:ClaimRowID@1792,registry:ClaimRowID@5856,registry:ClaimRowID@5922,registry:ClaimStamp@1754,registry:ClaimStamp@5673,registry:ClaimStamp@5737,registry:Incarnation@1848,registry:Incarnation@6143,registry:Incarnation@6207,registry:ServingSeq@1867,registry:ServingSeq@6234,registry:ServingSeq@6297,registry:Text@158,registry:path@207,registry:remote@55,registry:remote@87,whole:remoteClient@57,whole:remoteClient@89 a52e0bc25d555bbf22f35655c54c0fa3aca6cedec5f0b6b80157d9d95f921a29 |
| internal/registry/registry.go Registry.migrate legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user), on every registry open; a box CLI verb that opens the registry directly runs it as whoever runs the verb: census-ruling-seeded-instances's body with two more columns added to routes (incarnation and serving_seq, INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule); self-serve moves 1 Task 7;rev3=census-ruling-rootfs-apps-2;basis=one more ALTER TABLE, routes ADD COLUMN runtime TEXT NOT NULL DEFAULT '', beside main's rate_limit, assets_off, asset_gen, incarnation and serving_seq (the last four from the merges of origin/main 3c33f2eb and 953b9fda); the same sixteen sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328/#329 plan 1 Task 4: three more ALTER TABLE statements in the existing loop, routes ADD COLUMN egress_allow, size and policy_expires_at, each TEXT NOT NULL DEFAULT '' and idempotent through the duplicate-column rule; the same sixteen sites, no read added.;rev3=census-ruling-region-ha-p1a;basis=one more ALTER TABLE in the existing loop: routes ADD COLUMN ha INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule; the same sixteen sites, no read added;rev3=census-ruling-ha-p1a-433;basis=the registry's SQLite side as carlos (agent, registry child; a box CLI verb that opens the registry directly runs it as whoever runs it), on every registry open: the ALTER TABLE routes statements are now built from the one migration definition routeAddedColumns (addedColumn name, type, default; review r1 P2): for each entry without the Claim mark, "ALTER TABLE routes ADD COLUMN " + spec(), byte for byte the statements main runs, in main's order, under the same duplicate-column rule. +registry:Claim is that mark, +whole:addedColumn the struct. Every name, type and default is an in-binary literal; no statement added, removed or changed; no read added.;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: one more CREATE TABLE IF NOT EXISTS regional_domains (host TEXT PRIMARY KEY, target, account, app, region TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL DEFAULT 0), beside wildcard_domains; the added sites are that statement (+file:Exec, +registry:sql), an in-binary literal; additive, no existing statement changed;rev3=census-ruling-region-ha-p1b3b-t;basis=Create local HA duty/replay tables and revision triggers in the existing registry connection; no new database path.;rev3=census-ruling-agent-start-demo-3;basis=Create moved-notice storage as a single (id, wire) row; fingerprints include the stored wire bytes. Census read-site delta: +file:Exec, +registry:sql.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: calls migrateLinks after migrateHADuties (one CREATE TABLE IF NOT EXISTS link_channels, an in-binary literal); additive, no existing statement changed; linked deployments slice 1 Task 7: also runs migrateHomeLink (CREATE TABLE IF NOT EXISTS home_link and home_link_apps) after migrateLinks; additive, the box's own registry database, as carlos;rev3=census-ruling-account-subdomains;basis=one more CREATE TABLE IF NOT EXISTS account_namespaces (name TEXT PRIMARY KEY, account TEXT NOT NULL), an in-binary literal (+file:Exec, +registry:sql); additive, no existing statement changed file:Exec@1124,file:Exec@1855,file:Exec@212,file:Exec@2409,file:Exec@3057,file:Exec@3822,file:Exec@4101,file:Exec@4964,file:Exec@51,file:Exec@5140,file:Exec@761,registry:Claim@686,registry:sql@1124,registry:sql@1855,registry:sql@212,registry:sql@2409,registry:sql@3057,registry:sql@3822,registry:sql@4101,registry:sql@4964,registry:sql@51,registry:sql@5140,registry:sql@761,whole:addedColumn@661 0c5fdaf1215e8f81c156a1fc1576cb075c2a52238bde75fc8320d49472fd117d |
| -@coverage . 724a5d9e8aef7202ca2d5a3f3ed0152e425b06a66458567d0627cfb2b725becb |
| +@coverage . 9f48591c10563712777c3d5d9dd870cc84909b9730c9f1b7f48e2de68374fc5e |
| @coverage internal/domains be259af4d007f9f06e6d827eb2fa775710788821cc1bbac3215ec1c9b67780fc |
| @coverage internal/edge 9b9f642f53505bd73aad991d29b75b68abba48b6eb9d242a6634bea069dc421c |
| @coverage internal/host aa8f6c1a0b8dd200cb7656622d1fb6004ea0e1bbac292459b4eafa463da7f9bb |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 43433e099..d66cfece6 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -173,4 +173,4 @@ plan14-root-reads-stats-prune-400.tsv 75b32391a24d2c9269fc579aae68ac80b7b1d4ccf0 |
| plan14-root-reads-group-observation-carry.tsv 587f6e92c5e594b9bb6436a2d0066849454407202e311f43483bed3be4591940 |
| plan14-root-reads-activator-settle-wait.tsv b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369 |
| plan14-root-reads-lease-checkpoint-no-compaction.tsv b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369 |
| -plan14-root-reads-account-subdomains.tsv 17d8c803e6d0930608c76963b82b5e6211734029d0c3651cbe86130db869e390 |
| +plan14-root-reads-account-subdomains.tsv 6d195fae0d02f91b496db73a8909227ae8587e09561973c8a44476c13cefc939 |