carlos deploy and canary watch a gated host through a gate pass (#164)
Prompts: <task-notification> <task-id>b4yr18lck</task-id> <tool-use-id>toolu_01Rr7pr2aQBRTS7fxMCQ5nDa</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/3e4769a0-0ce4-451b-bb60-70794f33ce39/tasks/b4yr18lck.output</output-file> <status>completed</status> <summary>Background command "Wait for copy review result" completed (exit code 0)</summary> </task-notification> Squashed from gated-deploy-watch-164 into main.
19 files changed,
+1,016
−15
apimode.go+46 −0canary.go+10 −4deploy.go+93 −2deploy_gate_test.go+305 −0deploywatch.go+108 −4deploywatch_test.go+2 −2docs/site/cli.md+2 −0docs/superpowers/notes/census-proposal-gated-deploy-watch-164.md+21 −0internal/console/apigatepass.go+134 −0internal/console/apigatepass_test.go+200 −0internal/console/authcli.go+9 −0internal/console/claim_invariant_fixtures_test.go+23 −0internal/console/deploydoors_test.go+3 −0internal/console/svcroutes_test.go+10 −0internal/console/testdata/claim-routes.txt+3 −2internal/provision/gated_deploy_watch_164_census_test.go+37 −0internal/provision/plan9_b8_census_test.go+1 −1internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-gated-deploy-watch-164.tsv+8 −0
CI passed — run details
landed from gated-deploy-watch-164
diff --git a/apimode.go b/apimode.go| index 138ecd6bb..46d6a20ae 100644 |
| --- a/apimode.go |
| +++ b/apimode.go |
| @@ -3749,6 +3749,52 @@ func (s *apiSession) instanceList(ctx context.Context, a apiAcct, app, match, he |
| return res.Instances, res.Truncated, res.Total, nil |
| } |
| +// errGateOpen is instanceGatePass's answer for a host with no gate left on it. |
| +var errGateOpen = errors.New("no password gate is set on this host") |
| + |
| +// gatePassRefused is instanceGatePass's answer when the console will not |
| +// issue a pass at all, as distinct from failing to. |
| +type gatePassRefused struct{ err error } |
| + |
| +func (e *gatePassRefused) Error() string { return e.err.Error() } |
| +func (e *gatePassRefused) Unwrap() error { return e.err } |
| + |
| +// instanceGatePass asks the console for a short-lived gate cookie for one |
| +// gated host (handleAPIInstanceGatePass), so the deploy watch can read the |
| +// version through the password page instead of timing out on it |
| +// (discussion #164). The answer is the whole Cookie header value, |
| +// name=value, ready to send. |
| +// |
| +// Two answers are typed, because the watch treats them differently from a |
| +// failure: a 409 is errGateOpen (the gate was cleared after the deploy |
| +// listed its hosts, so the host needs no pass), and a 404 or 403 is a |
| +// *gatePassRefused (a console that predates the door, or a credential it |
| +// will not give one to). Anything else, a 429 or a 502 or a network error, |
| +// is returned as it came. |
| +func (s *apiSession) instanceGatePass(ctx context.Context, a apiAcct, app, host string) (string, error) { |
| + status, body, err := s.postJSON(ctx, apiPath(a, app, "/instances/"+url.PathEscape(host)+"/gate-pass"), struct{}{}) |
| + if err != nil { |
| + return "", err |
| + } |
| + switch status { |
| + case http.StatusOK: |
| + case http.StatusConflict: |
| + return "", errGateOpen |
| + case http.StatusNotFound, http.StatusForbidden: |
| + return "", &gatePassRefused{apiErrorFromBody(status, body)} |
| + default: |
| + return "", apiErrorFromBody(status, body) |
| + } |
| + var pass struct { |
| + Name string `json:"name"` |
| + Value string `json:"value"` |
| + } |
| + if err := json.Unmarshal(body, &pass); err != nil || pass.Name == "" || pass.Value == "" { |
| + return "", fmt.Errorf("gate pass: unreadable response") |
| + } |
| + return (&http.Cookie{Name: pass.Name, Value: pass.Value}).String(), nil |
| +} |
| + |
| // apiRouteRow is one row of the console's routes answer |
| // (internal/console/apiroutes.go). Every field is additive on the wire: a |
| // console that predates one sends nothing and it decodes as the zero |
diff --git a/canary.go b/canary.go| index 9fe29e3ee..ff8b411de 100644 |
| --- a/canary.go |
| +++ b/canary.go |
| @@ -649,11 +649,17 @@ func runCanaryDeploy(args []string) { |
| } |
| fmt.Fprintf(stdout, "%s %s to %s\n", pal.ok("promoted"), *ver, channel) |
| - targets := []watchTarget{{Host: host, Origin: watchOrigin(host)}} |
| - if err = watchVersion(stdout, targets, *ver, *timeout, canaryWatchEvery, nil); err != nil { |
| - log.Fatalf("canary: %v", err) |
| + targets := passGatedTargets(stdout, []watchTarget{{Host: host, Origin: watchOrigin(host)}}, gatedHosts(recs), *ver, channel, |
| + func(h string) (string, error) { return sess.instanceGatePass(ctx, acct, app2, h) }) |
| + // Empty only when the host is gated and the console gave no pass, which |
| + // passGatedTargets has already said. "canary live at" would be a claim |
| + // nothing checked. |
| + if len(targets) > 0 { |
| + if err = watchVersion(stdout, targets, *ver, *timeout, canaryWatchEvery, nil); err != nil { |
| + log.Fatalf("canary: %v", err) |
| + } |
| + fmt.Fprintf(stdout, "\n%s https://%s\n", pal.ok("canary live at"), host) |
| } |
| - fmt.Fprintf(stdout, "\n%s https://%s\n", pal.ok("canary live at"), host) |
| mutedf(stdout, "promote it onward when you're happy — it costs no rung: carlos promote --app %s %s <channel>\n", app2, *ver) |
| } |
diff --git a/deploy.go b/deploy.go| index 1152ab2b9..553f7ec3f 100644 |
| --- a/deploy.go |
| +++ b/deploy.go |
| @@ -520,6 +520,8 @@ func runDeploy(args []string) { |
| for _, h := range hosts { |
| targets = append(targets, watchTarget{Host: h, Origin: watchOrigin(h), Probe: probe}) |
| } |
| + targets = passGatedTargets(stdout, targets, gatedHosts(recs), *ver, channel, |
| + func(host string) (string, error) { return sess.instanceGatePass(ctx, acct, *app, host) }) |
| if err := watchVersion(stdout, targets, *ver, *timeout, 2*time.Second, deployDiagnostics(ctx, sess, acct, *app)); err != nil { |
| if *hostFlag != "" && isConnectionClassFailure(err) { |
| failDeployDNSGuidance(ctx, sess, acct, *app, *hostFlag) |
| @@ -530,7 +532,7 @@ func runDeploy(args []string) { |
| } |
| // An instance deploy follows each box's rollout of the build (spec §9.1, |
| // deploywatch.go), and is today's URL watch when no box reports one. |
| - if err := watchDeployed(ctx, sess, acct, *app, *ver, channel, hosts, probe, *timeout); err != nil { |
| + if err := watchDeployed(ctx, sess, acct, *app, *ver, channel, hosts, gatedHosts(recs), probe, *timeout); err != nil { |
| log.Fatalf("deploy: %v", err) |
| } |
| } |
| @@ -1509,9 +1511,75 @@ func filterChannelHosts(recs []apiInstanceRecord, channel, hostFlag string) ([]s |
| // criterion at all: it goes green while the old binary is still serving. A |
| // probe path is answered by the app's OWN process, so its body is the only |
| // honest answer to "which build is running here". |
| +// |
| +// Cookie is a gate pass (name=value) for a host behind a password gate, sent |
| +// on every poll so the edge lets the watch through to the version it is |
| +// looking for; Gated says the host was gated when the deploy looked, so a |
| +// 401 from it can be named for what it is. PassErr is why a gated host has |
| +// no pass, when the console would not or could not give one. All three are |
| +// empty for an open host. |
| type watchTarget struct { |
| Host, Origin string |
| Probe string |
| + Cookie string |
| + Gated bool |
| + PassErr string |
| +} |
| + |
| +// gatedHosts is the set of instance hosts the console says carry a password |
| +// gate. A console that predates gates says nothing (Gated nil), which reads |
| +// as open here: such a console has no way to have set one. |
| +func gatedHosts(recs []apiInstanceRecord) map[string]bool { |
| + out := map[string]bool{} |
| + for _, r := range recs { |
| + if r.Gated != nil && *r.Gated { |
| + out[r.Host] = true |
| + } |
| + } |
| + return out |
| +} |
| + |
| +// passGatedTargets fetches a gate pass for each target behind a password |
| +// gate (discussion #164). Without one, the gate answers every poll with its |
| +// login page, and the watch used to time out on a deploy that had landed and |
| +// blame a wake or a route for it. |
| +// |
| +// What happens without a pass depends on why. A console that REFUSES one |
| +// (a *gatePassRefused: too old for the door, or a credential it will not |
| +// serve) drops the host from the watch with a line saying so: the ship and |
| +// the promote have landed, and nothing from outside the gate can say more. |
| +// A host whose gate has since been cleared (errGateOpen) is watched like any |
| +// open host. Any other failure, a busy or unreachable console, keeps the |
| +// host in the watch without a pass, so the deploy fails on the gate's 401 |
| +// rather than going green on a check it never made. |
| +func passGatedTargets(w io.Writer, targets []watchTarget, gated map[string]bool, ver, channel string, pass func(host string) (string, error)) []watchTarget { |
| + out := make([]watchTarget, 0, len(targets)) |
| + for _, t := range targets { |
| + if !gated[t.Host] { |
| + out = append(out, t) |
| + continue |
| + } |
| + cookie, err := pass(t.Host) |
| + var refused *gatePassRefused |
| + switch { |
| + case errors.Is(err, errGateOpen): |
| + out = append(out, t) |
| + continue |
| + case errors.As(err, &refused): |
| + mutedf(w, "%s has a password gate and the console could not give the watch a pass: %v\n %s is on %s. its version can't be checked from outside, so this host is not watched\n", |
| + t.Host, err, ver, channel) |
| + continue |
| + case err != nil: |
| + mutedf(w, "%s has a password gate and the console could not give the watch a pass: %v\n watching it anyway. the gate will answer until the pass comes through, so this is likely to time out\n", |
| + t.Host, err) |
| + out = append(out, t) |
| + continue |
| + } |
| + mutedf(w, "%s has a password gate. the watch checks the version with a 15-minute pass from the console\n", t.Host) |
| + t.Cookie, t.Gated = cookie, true |
| + out = append(out, t) |
| + } |
| + return out |
| } |
| // watchOrigin maps an instance host to the origin the watch dials. In |
| @@ -1647,10 +1715,33 @@ func checkTarget(client *http.Client, t watchTarget, ver string, n int64) (live |
| path = t.Probe |
| } |
| url := fmt.Sprintf("%s%s?carlos-deploy-probe=%d", t.Origin, path, n) |
| - resp, err := client.Get(url) |
| + req, err := http.NewRequest(http.MethodGet, url, nil) |
| + if err != nil { |
| + return false, "unreachable: " + err.Error() |
| + } |
| + if t.Cookie != "" { |
| + req.Header.Set("Cookie", t.Cookie) |
| + } |
| + resp, err := client.Do(req) |
| if err != nil { |
| return false, "unreachable: " + err.Error() |
| } |
| + // A 401 with no version header is the password gate's login page, on |
| + // either leg: the edge stamps X-Carlos-Version before it proxies, so an |
| + // app's own 401 carries the header, and only a response the edge wrote |
| + // itself, ahead of the app, lacks it. |
| + if resp.StatusCode == http.StatusUnauthorized && resp.Header.Get("X-Carlos-Version") == "" { |
| + io.CopyN(io.Discard, resp.Body, 4096) |
| + resp.Body.Close() |
| + switch { |
| + case t.Cookie != "": |
| + return false, "the password gate refused the watch's pass (HTTP 401). the password may have changed during the deploy, or the pass expired" |
| + case t.PassErr != "": |
| + return false, "a password gate is set on this host and the console could not give the watch a pass: " + t.PassErr |
| + default: |
| + return false, "HTTP 401 with no version header. a password gate may be set on this host. run `carlos gate list` to check" |
| + } |
| + } |
| if t.Probe != "" { |
| // The app's own process answers here, so the body IS the |
| // truth — no header/route-row disagreement to reconcile |
diff --git a/deploy_gate_test.go b/deploy_gate_test.go| new file mode 100644 |
| index 000000000..4be589717 |
| --- /dev/null |
| +++ b/deploy_gate_test.go |
| @@ -0,0 +1,305 @@ |
| +package main |
| + |
| +import ( |
| + "bytes" |
| + "context" |
| + "errors" |
| + "net/http" |
| + "net/http/httptest" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/gate" |
| +) |
| + |
| +// gatedEdge stands in for the edge in front of a gated static route: the |
| +// real internal/gate decides, and only an admitted request reaches the |
| +// handler that stamps the version (discussion #164). |
| +func gatedEdge(t *testing.T, host, hash, ver string) *httptest.Server { |
| + t.Helper() |
| + g := gate.New() |
| + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + if !g.Admit(w, r, host, hash) { |
| + return |
| + } |
| + w.Header().Set("X-Carlos-Version", ver) |
| + w.WriteHeader(http.StatusOK) |
| + })) |
| + t.Cleanup(srv.Close) |
| + return srv |
| +} |
| + |
| +func passFor(host, hash string) string { |
| + return (&http.Cookie{Name: gate.CookieName, Value: gate.Mint(host, hash, time.Now().Add(time.Minute))}).String() |
| +} |
| + |
| +// TestWatchVersionThroughGateWithPass: with the console's pass on every |
| +// poll, the gate lets the watch through and the deploy goes live, where it |
| +// used to time out on the login page. |
| +func TestWatchVersionThroughGateWithPass(t *testing.T) { |
| + const host, hash = "report.bab.test", "$2a$10$stand-in-hash" |
| + srv := gatedEdge(t, host, hash, "v2") |
| + var out bytes.Buffer |
| + err := watchVersion(&out, []watchTarget{{Host: host, Origin: srv.URL, Cookie: passFor(host, hash), Gated: true}}, |
| + "v2", 2*time.Second, 10*time.Millisecond, nil) |
| + if err != nil { |
| + t.Fatalf("a watch holding a valid pass must go live: %v", err) |
| + } |
| + if !strings.Contains(out.String(), host) { |
| + t.Fatalf("live line missing: %q", out.String()) |
| + } |
| +} |
| + |
| +// TestWatchVersionGatedDiagnostics: a gate's 401 is never reported as a wake |
| +// or route failure. Holding a pass it refuses, the report says the pass was |
| +// refused; holding none, it says a gate may be set and how to check. |
| +func TestWatchVersionGatedDiagnostics(t *testing.T) { |
| + const host, hash = "report.bab.test", "$2a$10$stand-in-hash" |
| + srv := gatedEdge(t, host, hash, "v2") |
| + for _, c := range []struct { |
| + name string |
| + target watchTarget |
| + want string |
| + }{ |
| + {"refused pass", watchTarget{Host: host, Origin: srv.URL, Cookie: passFor(host, "$2a$10$old-password"), Gated: true}, |
| + "the password gate refused the watch's pass (HTTP 401)"}, |
| + {"no pass", watchTarget{Host: host, Origin: srv.URL}, |
| + "HTTP 401 with no version header. a password gate may be set on this host"}, |
| + } { |
| + err := watchVersion(&bytes.Buffer{}, []watchTarget{c.target}, "v2", 50*time.Millisecond, 10*time.Millisecond, nil) |
| + if err == nil { |
| + t.Fatalf("%s: must time out", c.name) |
| + } |
| + if !strings.Contains(err.Error(), c.want) { |
| + t.Errorf("%s: report = %v, want it to contain %q", c.name, err, c.want) |
| + } |
| + if strings.Contains(err.Error(), "failing to wake") { |
| + t.Errorf("%s: a gate's 401 blamed on a wake: %v", c.name, err) |
| + } |
| + } |
| +} |
| + |
| +// TestWatchVersionAppOwn401IsNotTheGate: an app's own 401 carries the |
| +// version header (the edge stamps it before proxying), so it is judged by |
| +// the ordinary rules and never mistaken for the gate. |
| +func TestWatchVersionAppOwn401IsNotTheGate(t *testing.T) { |
| + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("X-Carlos-Version", "v2") |
| + w.WriteHeader(http.StatusUnauthorized) |
| + })) |
| + defer srv.Close() |
| + err := watchVersion(&bytes.Buffer{}, []watchTarget{{Host: "x.test", Origin: srv.URL}}, "v2", |
| + 50*time.Millisecond, 10*time.Millisecond, nil) |
| + if err == nil || !strings.Contains(err.Error(), "serving v2 but HTTP 401") { |
| + t.Fatalf("an app's own 401 must read as the app failing: %v", err) |
| + } |
| +} |
| + |
| +// TestPassGatedTargets: open hosts pass through untouched and never cost a |
| +// console call; a gated host gets its pass; a host the console REFUSES a |
| +// pass for leaves the watch with a line naming the host and why; a host |
| +// whose gate was cleared meanwhile is watched as open; and a console that |
| +// merely FAILED keeps the host in the watch, pass-less, so a blip can never |
| +// turn into a green deploy nobody checked. |
| +func TestPassGatedTargets(t *testing.T) { |
| + targets := []watchTarget{{Host: "open.test"}, {Host: "gated.test"}, {Host: "nopass.test"}, |
| + {Host: "cleared.test"}, {Host: "busy.test"}} |
| + gated := map[string]bool{"gated.test": true, "nopass.test": true, "cleared.test": true, "busy.test": true} |
| + var asked []string |
| + pass := func(host string) (string, error) { |
| + asked = append(asked, host) |
| + switch host { |
| + case "nopass.test": |
| + return "", &gatePassRefused{errors.New("404 page not found")} |
| + case "cleared.test": |
| + return "", errGateOpen |
| + case "busy.test": |
| + return "", errors.New("too many instance requests") |
| + } |
| + return "carlos_gate=v1.1.x", nil |
| + } |
| + var out bytes.Buffer |
| + got := passGatedTargets(&out, targets, gated, "v2", "edge", pass) |
| + var hosts []string |
| + for _, g := range got { |
| + hosts = append(hosts, g.Host) |
| + } |
| + if strings.Join(hosts, ",") != "open.test,gated.test,cleared.test,busy.test" { |
| + t.Fatalf("watched %v, want every host but nopass.test", hosts) |
| + } |
| + if got[0].Cookie != "" || got[0].Gated { |
| + t.Errorf("open host picked up a pass: %+v", got[0]) |
| + } |
| + if got[1].Cookie != "carlos_gate=v1.1.x" || !got[1].Gated { |
| + t.Errorf("gated host = %+v, want its pass", got[1]) |
| + } |
| + for _, g := range got[2:] { |
| + if g.Cookie != "" || g.Gated { |
| + t.Errorf("%s = %+v, want it watched with no pass", g.Host, g) |
| + } |
| + } |
| + if strings.Join(asked, ",") != "gated.test,nopass.test,cleared.test,busy.test" { |
| + t.Errorf("asked the console for %v, want only the gated hosts", asked) |
| + } |
| + for _, want := range []string{ |
| + "gated.test has a password gate. the watch checks the version", |
| + "nopass.test has a password gate and the console could not give the watch a pass: 404 page not found", |
| + "v2 is on edge. its version can't be checked from outside, so this host is not watched", |
| + "busy.test has a password gate and the console could not give the watch a pass: too many instance requests\n watching it anyway", |
| + } { |
| + if !strings.Contains(out.String(), want) { |
| + t.Errorf("output lacks %q:\n%s", want, out.String()) |
| + } |
| + } |
| +} |
| + |
| +// TestInstanceGatePassClassifiesAnswers: the console's answers map onto the |
| +// three outcomes passGatedTargets acts on, and a 200 comes back as a Cookie |
| +// header value ready to send. |
| +func TestInstanceGatePassClassifiesAnswers(t *testing.T) { |
| + for _, c := range []struct { |
| + status int |
| + body string |
| + check func(cookie string, err error) bool |
| + }{ |
| + {http.StatusOK, `{"name":"carlos_gate","value":"v1.9.abc","expires":"2026-09-26T21:00:00Z"}`, |
| + func(c string, err error) bool { return err == nil && c == "carlos_gate=v1.9.abc" }}, |
| + {http.StatusConflict, `{"error":"no password gate is set on h.test"}`, |
| + func(_ string, err error) bool { return errors.Is(err, errGateOpen) }}, |
| + {http.StatusNotFound, "404 page not found\n", |
| + func(_ string, err error) bool { var r *gatePassRefused; return errors.As(err, &r) }}, |
| + {http.StatusForbidden, `{"error":"this credential holds role \"operate\""}`, |
| + func(_ string, err error) bool { var r *gatePassRefused; return errors.As(err, &r) }}, |
| + {http.StatusTooManyRequests, `{"error":"too many instance requests"}`, |
| + func(_ string, err error) bool { |
| + var r *gatePassRefused |
| + return err != nil && !errors.As(err, &r) && !errors.Is(err, errGateOpen) |
| + }}, |
| + {http.StatusOK, `{}`, |
| + func(_ string, err error) bool { return err != nil }}, |
| + } { |
| + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + if r.Method != http.MethodPost || !strings.HasSuffix(r.URL.Path, "/instances/h.test/gate-pass") { |
| + t.Errorf("request = %s %s", r.Method, r.URL.Path) |
| + } |
| + w.WriteHeader(c.status) |
| + w.Write([]byte(c.body)) |
| + })) |
| + sess := &apiSession{c: newConsoleClient(ts.URL, "tok"), console: ts.URL} |
| + cookie, err := sess.instanceGatePass(context.Background(), apiAcct{Seg: "bab"}, "report", "h.test") |
| + ts.Close() |
| + if !c.check(cookie, err) { |
| + t.Errorf("status %d: got (%q, %v)", c.status, cookie, err) |
| + } |
| + } |
| +} |
| + |
| +// TestGatePassesLazy: the rollout watch's passes are fetched only for gated |
| +// hosts, once each; a pass, a refusal and a cleared gate are final, while a |
| +// failure is asked again no sooner than gatePassRetry. |
| +func TestGatePassesLazy(t *testing.T) { |
| + gated := map[string]bool{"gated.test": true, "refused.test": true, "cleared.test": true, "busy.test": true} |
| + asked := map[string]int{} |
| + g := newGatePasses(gated, func(host string) (string, error) { |
| + asked[host]++ |
| + switch host { |
| + case "refused.test": |
| + return "", &gatePassRefused{errors.New("deploy credential ci can't get a gate pass")} |
| + case "cleared.test": |
| + return "", errGateOpen |
| + case "busy.test": |
| + return "", errors.New("too many instance requests") |
| + } |
| + return "carlos_gate=v1.1.x", nil |
| + }) |
| + clock := time.Now() |
| + g.now = func() time.Time { return clock } |
| + |
| + for i := 0; i < 3; i++ { |
| + if got := g.apply(watchTarget{Host: "open.test"}); got.Gated || got.Cookie != "" || got.PassErr != "" { |
| + t.Fatalf("open host = %+v", got) |
| + } |
| + if got := g.apply(watchTarget{Host: "gated.test"}); !got.Gated || got.Cookie != "carlos_gate=v1.1.x" { |
| + t.Fatalf("gated host = %+v, want its pass", got) |
| + } |
| + if got := g.apply(watchTarget{Host: "refused.test"}); !got.Gated || got.Cookie != "" || !strings.Contains(got.PassErr, "can't get a gate pass") { |
| + t.Fatalf("refused host = %+v, want the refusal as its reason", got) |
| + } |
| + if got := g.apply(watchTarget{Host: "cleared.test"}); got.Gated || got.PassErr != "" { |
| + t.Fatalf("cleared host = %+v, want it treated as open", got) |
| + } |
| + g.apply(watchTarget{Host: "busy.test"}) |
| + } |
| + for _, h := range []string{"gated.test", "refused.test", "cleared.test", "busy.test"} { |
| + if asked[h] != 1 { |
| + t.Errorf("%s asked %d times inside the retry window, want 1", h, asked[h]) |
| + } |
| + } |
| + if asked["open.test"] != 0 { |
| + t.Error("an open host cost a console call") |
| + } |
| + clock = clock.Add(gatePassRetry) |
| + g.apply(watchTarget{Host: "busy.test"}) |
| + g.apply(watchTarget{Host: "refused.test"}) |
| + if asked["busy.test"] != 2 || asked["refused.test"] != 1 { |
| + t.Errorf("after the retry window: busy asked %d (want 2), refused asked %d (want 1)", asked["busy.test"], asked["refused.test"]) |
| + } |
| +} |
| + |
| +// TestCheckTargetNamesAMissingPass: a gated host the console gave no pass |
| +// for is reported with the console's reason, not as a wake failure. |
| +func TestCheckTargetNamesAMissingPass(t *testing.T) { |
| + const host, hash = "report.bab.test", "$2a$10$stand-in-hash" |
| + srv := gatedEdge(t, host, hash, "v2") |
| + live, diag := checkTarget(&http.Client{Timeout: time.Second}, |
| + watchTarget{Host: host, Origin: srv.URL, Gated: true, PassErr: "too many instance requests"}, "v2", 1) |
| + want := "a password gate is set on this host and the console could not give the watch a pass: too many instance requests" |
| + if live || diag != want { |
| + t.Fatalf("checkTarget = %v, %q; want false, %q", live, diag, want) |
| + } |
| +} |
| + |
| +// TestGatePassesRefreshBeforeExpiry: a pass is reused for gatePassReuse and |
| +// then fetched afresh, so a watch longer than the pass's lifetime never |
| +// polls with an expired one. |
| +func TestGatePassesRefreshBeforeExpiry(t *testing.T) { |
| + n := 0 |
| + g := newGatePasses(map[string]bool{"gated.test": true}, func(string) (string, error) { |
| + n++ |
| + return "carlos_gate=v1." + string(rune('0'+n)), nil |
| + }) |
| + clock := time.Now() |
| + g.now = func() time.Time { return clock } |
| + first := g.apply(watchTarget{Host: "gated.test"}).Cookie |
| + clock = clock.Add(gatePassReuse - time.Second) |
| + if got := g.apply(watchTarget{Host: "gated.test"}).Cookie; got != first || n != 1 { |
| + t.Fatalf("inside the reuse window: cookie %q after %d fetches, want %q after 1", got, n, first) |
| + } |
| + clock = clock.Add(time.Second) |
| + if got := g.apply(watchTarget{Host: "gated.test"}).Cookie; got == first || n != 2 { |
| + t.Fatalf("at the reuse window: cookie %q after %d fetches, want a fresh one after 2", got, n) |
| + } |
| +} |
| + |
| +// TestRolloutWatchFallbackCarriesThePass: when no box reports on the hosts |
| +// (here the console has no list for the app), the rollout watch falls back |
| +// to the plain URL watch, and that watch must carry the gate pass too. It |
| +// used not to, which was #164's failure all over again on that path. |
| +func TestRolloutWatchFallbackCarriesThePass(t *testing.T) { |
| + const host, hash = "report.bab.test", "$2a$10$stand-in-hash" |
| + srv := gatedEdge(t, host, hash, B) |
| + g := newGatePasses(map[string]bool{host: true}, func(string) (string, error) { return passFor(host, hash), nil }) |
| + rw := testWatch(&bytes.Buffer{}, |
| + func(time.Time) (watchList, error) { |
| + return watchList{}, &listStatusError{status: http.StatusNotFound, err: errors.New("no list")} |
| + }, |
| + func(t watchTarget, n int64) (bool, string) { |
| + return checkTarget(&http.Client{Timeout: time.Second}, g.apply(t), B, n) |
| + }) |
| + rw.timeout = 2 * time.Second |
| + rw.prep = g.apply |
| + if err := rw.run([]watchTarget{{Host: host, Origin: srv.URL}}); err != nil { |
| + t.Fatalf("the fallback watch must go live through the gate: %v", err) |
| + } |
| +} |
diff --git a/deploywatch.go b/deploywatch.go| index 1ddf397f9..33aceb59e 100644 |
| --- a/deploywatch.go |
| +++ b/deploywatch.go |
| @@ -269,6 +269,10 @@ type rolloutWatch struct { |
| check func(t watchTarget, n int64) (bool, string) |
| onURL func() |
| diag *watchDiagnostics |
| + // prep readies a target for the plain URL watch the rollout watch falls |
| + // back to (it carries the gate pass, #164); nil leaves targets as they |
| + // are. check does its own preparing. |
| + prep func(t watchTarget) watchTarget |
| } |
| func (rw rolloutWatch) run(targets []watchTarget) error { |
| @@ -300,6 +304,13 @@ func (rw rolloutWatch) run(targets []watchTarget) error { |
| if rw.onURL != nil { |
| rw.onURL() |
| } |
| + if rw.prep != nil { |
| + prepped := make([]watchTarget, len(targets)) |
| + for i, t := range targets { |
| + prepped[i] = rw.prep(t) |
| + } |
| + targets = prepped |
| + } |
| return watchVersion(rw.w, targets, rw.ver, time.Until(deadline), rw.interval, rw.diag) |
| } |
| var hosts []*watchedHost |
| @@ -679,18 +690,25 @@ func (rw rolloutWatch) timedOut(hosts []*watchedHost, boxes map[string][]*watche |
| // watchDeployed is the watch for an instance (non-static) deploy of ver onto |
| // channel. |
| -func watchDeployed(ctx context.Context, sess *apiSession, acct apiAcct, app, ver, channel string, hosts []string, probe string, timeout time.Duration) error { |
| +func watchDeployed(ctx context.Context, sess *apiSession, acct apiAcct, app, ver, channel string, hosts []string, gated map[string]bool, probe string, timeout time.Duration) error { |
| targets := make([]watchTarget, 0, len(hosts)) |
| for _, h := range hosts { |
| targets = append(targets, watchTarget{Host: h, Origin: watchOrigin(h), Probe: probe}) |
| } |
| - return newDeployWatch(ctx, sess, acct, app, ver, channel, probe, timeout).run(targets) |
| + return newDeployWatch(ctx, sess, acct, app, ver, channel, probe, timeout, gated).run(targets) |
| } |
| // newDeployWatch is watchDeployed's watch, built apart so a test can read |
| // its cadence without a console. |
| -func newDeployWatch(ctx context.Context, sess *apiSession, acct apiAcct, app, ver, channel, probe string, timeout time.Duration) rolloutWatch { |
| +func newDeployWatch(ctx context.Context, sess *apiSession, acct apiAcct, app, ver, channel, probe string, timeout time.Duration, gated map[string]bool) rolloutWatch { |
| client := &http.Client{Timeout: 10 * time.Second} |
| + passes := newGatePasses(gated, func(host string) (string, error) { |
| + // Bounded below the console client's own timeout, so a hung console |
| + // costs a poll round seconds rather than the watch its deadline. |
| + fctx, cancel := context.WithTimeout(ctx, 10*time.Second) |
| + defer cancel() |
| + return sess.instanceGatePass(fctx, acct, app, host) |
| + }) |
| return rolloutWatch{ |
| w: stdout, app: app, ver: ver, channel: channel, timeout: timeout, |
| interval: deployWatchPollEvery, listEvery: deployWatchListEvery, |
| @@ -699,12 +717,98 @@ func newDeployWatch(ctx context.Context, sess *apiSession, acct apiAcct, app, ve |
| defer cancel() |
| return sess.watchInstanceList(lctx, acct, app) |
| }, |
| - check: func(t watchTarget, n int64) (bool, string) { return checkTarget(client, t, ver, n) }, |
| + check: func(t watchTarget, n int64) (bool, string) { return checkTarget(client, passes.apply(t), ver, n) }, |
| + prep: passes.apply, |
| onURL: func() { printWatchNote(probe, false, app) }, |
| diag: deployDiagnostics(ctx, sess, acct, app), |
| } |
| } |
| +// gatePasses fetches the gate pass for a gated host the first time the |
| +// rollout watch polls it over HTTP (discussion #164). Lazily, unlike the |
| +// static watch's passGatedTargets, because here most hosts are followed |
| +// through their box's report and never requested at all, and a pass nobody |
| +// uses is still an audit row and a credential in flight. Safe for the |
| +// watch's concurrent polls. |
| +// |
| +// A refusal and a cleared gate are final for the watch. A pass is kept for |
| +// gatePassReuse, a minute short of the console's 15-minute lifetime, then |
| +// fetched afresh, so a long --timeout never polls with an expired one. Any |
| +// other failure is asked again, but no more often than gatePassRetry, so a |
| +// console that is shedding load is not polled at the watch's own cadence. |
| +// Each host has its own lock, so one host's slow fetch never holds up |
| +// another's. |
| +type gatePasses struct { |
| + gated map[string]bool |
| + fetch func(host string) (string, error) |
| + now func() time.Time |
| + mu sync.Mutex |
| + hosts map[string]*gatePassHost |
| +} |
| + |
| +type gatePassHost struct { |
| + mu sync.Mutex |
| + seen bool |
| + st gatePassState |
| +} |
| + |
| +type gatePassState struct { |
| + cookie, err string |
| + open, final bool |
| + tried time.Time |
| +} |
| + |
| +const ( |
| + gatePassRetry = 15 * time.Second |
| + gatePassReuse = 14 * time.Minute |
| +) |
| + |
| +func newGatePasses(gated map[string]bool, fetch func(host string) (string, error)) *gatePasses { |
| + return &gatePasses{gated: gated, fetch: fetch, now: time.Now, hosts: map[string]*gatePassHost{}} |
| +} |
| + |
| +// apply returns t carrying the host's pass, or the reason it has none. |
| +func (g *gatePasses) apply(t watchTarget) watchTarget { |
| + if !g.gated[t.Host] { |
| + return t |
| + } |
| + g.mu.Lock() |
| + h := g.hosts[t.Host] |
| + if h == nil { |
| + h = &gatePassHost{} |
| + g.hosts[t.Host] = h |
| + } |
| + g.mu.Unlock() |
| + |
| + h.mu.Lock() |
| + st := h.st |
| + stale := !h.seen || |
| + (!st.final && g.now().Sub(st.tried) >= gatePassRetry) || |
| + (st.cookie != "" && g.now().Sub(st.tried) >= gatePassReuse) |
| + if stale { |
| + cookie, err := g.fetch(t.Host) |
| + var refused *gatePassRefused |
| + st = gatePassState{tried: g.now(), final: true} |
| + switch { |
| + case err == nil: |
| + st.cookie = cookie |
| + case errors.Is(err, errGateOpen): |
| + st.open = true |
| + case errors.As(err, &refused): |
| + st.err = err.Error() |
| + default: |
| + st.err, st.final = err.Error(), false |
| + } |
| + h.st, h.seen = st, true |
| + } |
| + h.mu.Unlock() |
| + if st.open { |
| + return t |
| + } |
| + t.Gated, t.Cookie, t.PassErr = true, st.cookie, st.err |
| + return t |
| +} |
| + |
| // deployDiagnostics is the timeout report's help, moved out of runDeploy |
| // unchanged. |
| func deployDiagnostics(ctx context.Context, sess *apiSession, acct apiAcct, app string) *watchDiagnostics { |
diff --git a/deploywatch_test.go b/deploywatch_test.go| index 332dbb0c5..57834b7aa 100644 |
| --- a/deploywatch_test.go |
| +++ b/deploywatch_test.go |
| @@ -554,7 +554,7 @@ func TestWatchRolloutListsOnItsOwnCadence(t *testing.T) { |
| } |
| func TestDeployWatchCadence(t *testing.T) { |
| - rw := newDeployWatch(nil, nil, apiAcct{Seg: "acme"}, "shop", B, "edge", "", time.Minute) |
| + rw := newDeployWatch(nil, nil, apiAcct{Seg: "acme"}, "shop", B, "edge", "", time.Minute, nil) |
| if rw.listEvery != 5*time.Second || rw.interval != 2*time.Second { |
| t.Fatalf("list every %s, poll every %s: want 5s and 2s", rw.listEvery, rw.interval) |
| } |
| @@ -859,7 +859,7 @@ func TestDeployWatchReadsTheConsolesList(t *testing.T) { |
| })) |
| origin, hits := hitServer(t) |
| sess := &apiSession{c: newConsoleClient(console.URL, "tok"), console: console.URL} |
| - rw := newDeployWatch(context.Background(), sess, apiAcct{Seg: "acme"}, "shop", B, "edge", "", 300*time.Millisecond) |
| + rw := newDeployWatch(context.Background(), sess, apiAcct{Seg: "acme"}, "shop", B, "edge", "", 300*time.Millisecond, nil) |
| rw.w, rw.onURL, rw.diag = io.Discard, nil, nil |
| start := time.Now() |
| err := rw.run([]watchTarget{{Host: "x.test", Origin: origin}}) |
diff --git a/docs/site/cli.md b/docs/site/cli.md| index 8195ae215..0e166b77d 100644 |
| --- a/docs/site/cli.md |
| +++ b/docs/site/cli.md |
| @@ -281,6 +281,8 @@ binary, and it says so while it waits. Set one with |
| [carlos apps build-probe](/docs/cli#carlos-apps); it is a single command per |
| app. |
| +A host behind a password gate ([carlos gate](/docs/cli#carlos-gate)) is watched like any other. Deploy asks the console for a pass that lasts 15 minutes and checks the version through the gate with it. The console only hands one to someone who could already remove the gate, or to a deploy credential for a host on a channel it can deploy its own build to. Each one is recorded in the app's activity log. If the console refuses a pass for a static site, the host is left unchecked and the deploy still succeeds. Otherwise a deploy without a pass keeps waiting and will likely time out. |
| + |
| ```sh |
| carlos deploy --app hello ./hello |
| ``` |
diff --git a/docs/superpowers/notes/census-proposal-gated-deploy-watch-164.md b/docs/superpowers/notes/census-proposal-gated-deploy-watch-164.md| new file mode 100644 |
| index 000000000..6b7c6e96e |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-gated-deploy-watch-164.md |
| @@ -0,0 +1,21 @@ |
| +# Census approval: gated-deploy-watch-164 |
| + |
| +Ruling `census-ruling-gated-deploy-watch-164`. Every change below keeps the disposition it already has, so it needs an approval, not a decision. |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `deploy.go` `checkTarget` | body | unchanged (1) | builds the watch poll as a request so it can carry a gate pass cookie (#164), and names a 401 with no X-Carlos-Version as the password gate; same one HTTP GET of the target origin, read site unchanged (1), none added | |
| +| `deploy.go` `runDeploy` | body | unchanged (1) | 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 | |
| + |
| +Envelopes re-pinned: `.`, `internal/console`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Escalate if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. An escalation goes to the census owner as a decision. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `deploy.go` `checkTarget`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input |
| +- `deploy.go` `runDeploy`: legacy, task accepted-legacy. Basis: 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 |
| + |
| +Seal: `c71b2974cd929122afc730f22cb53c63f3fdefdb4b26f7ca60db76fface906de` → `c5d8767f883f4a8677330039f54aa556124f6dde888e0b4a36095a49b634e634`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-gated-deploy-watch-164.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/console/apigatepass.go b/internal/console/apigatepass.go| new file mode 100644 |
| index 000000000..82ba6f7f3 |
| --- /dev/null |
| +++ b/internal/console/apigatepass.go |
| @@ -0,0 +1,134 @@ |
| +package console |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "log" |
| + "net/http" |
| + "os" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/gate" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/release" |
| + "github.com/carlosframework/platform/internal/svcrole" |
| +) |
| + |
| +// gatePassLifetime is how long a watch pass lets its holder past a gated |
| +// host. Long enough to outlast `carlos deploy`'s default watch (two minutes) |
| +// several times over, short enough that a pass copied out of a CI log is |
| +// stale before anyone reads it. |
| +const gatePassLifetime = 15 * time.Minute |
| + |
| +// handleAPIInstanceGatePass mints a short-lived gate cookie for one gated |
| +// host, so `carlos deploy` can check the version it just promoted without |
| +// the gate answering its watch with the login page (discussion #164). |
| +// |
| +// The pass is a real gate cookie (gate.Mint), minted from the record's own |
| +// hash and bound to the record's own host, so the edge verifies it exactly |
| +// as it verifies a visitor's — nothing new is taught to the edge, and |
| +// changing or clearing the password kills every pass along with every |
| +// visitor's cookie. What it grants is read access to the host for |
| +// gatePassLifetime, and the door is registered for exactly the callers who |
| +// already hold more than that: a person who is a member, and an Instance |
| +// credential, both of which can clear the gate through the PATCH door |
| +// beside this one. A pass is therefore never a way past the password that |
| +// its holder did not already have. Publish is left out on purpose (see the |
| +// registration in authcli.go). |
| +// |
| +// A deploy credential is let in per host, not per door: it gets a pass only |
| +// for a host on a channel where it can put its own build in front of the |
| +// gate today (deployGatePassAllowed). There the pass shows it nothing new. A |
| +// host on stable, on any channel outside its rungs, or on a channel it can |
| +// promote to but not deploy its own build to, is refused, because a |
| +// credential that cannot change what that host serves must not read it. |
| +// |
| +// Refusals follow the instance family: principal first, then the |
| +// byte-identical 404 for a host that is badly shaped or names no record. |
| +func (s *Server) handleAPIInstanceGatePass(w http.ResponseWriter, r *http.Request) { |
| + principal, acct, app, ok := s.instanceGate(w, r) |
| + if !ok { |
| + return |
| + } |
| + // The control plane's rule, applied as the PATCH door applies it: a |
| + // service credential that cannot move the console by itself does not |
| + // get to read past a gate on it either. A person may. |
| + p, _ := principalFrom(r.Context()) |
| + if s.refuseServiceControlPlane(w, p, acct.ID, app, "get a gate pass for it") { |
| + return |
| + } |
| + host := r.PathValue("host") |
| + // Shape-checked before the key builder, as GET does it: {host} arrives |
| + // percent-decoded, and RecordKey would join a path with separators in it. |
| + if !provision.ValidHostShape(host) { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + ctx, cancel := context.WithTimeout(r.Context(), instanceStoreTimeout) |
| + defer cancel() |
| + rec, err := provision.GetRecord(ctx, s.cfg.Releases, acct.Sqid, app, host) |
| + if errors.Is(err, os.ErrNotExist) { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + if err != nil { |
| + log.Printf("console: api instances gate pass %s/%s/%s: %v", acct.Sqid, app, host, err) |
| + jsonError(w, http.StatusBadGateway, "could not read the instance") |
| + return |
| + } |
| + if rec.Gate == "" { |
| + jsonError(w, http.StatusConflict, "no password gate is set on "+host) |
| + return |
| + } |
| + if p.Kind == PrincipalService && p.Role == svcrole.Deploy { |
| + // Read as the promote door reads it: an unreadable pipeline is not |
| + // "no pipeline", or a pipelined app would fall back to the wider |
| + // scope it opted out of. |
| + pipe, perr := release.GetPipeline(ctx, s.cfg.Releases, s.cfg.ReleasePub, acct.Sqid, app) |
| + if perr != nil { |
| + log.Printf("console: api instances gate pass %s/%s: read pipeline: %v", acct.Sqid, app, perr) |
| + jsonError(w, http.StatusBadGateway, "could not read the pipeline for "+app) |
| + return |
| + } |
| + if !deployGatePassAllowed(p, pipe, rec.Channel) { |
| + jsonError(w, http.StatusForbidden, "deploy credential "+p.Name+" can't get a gate pass for "+rec.Host+ |
| + ". the host follows "+rec.Channel+", where this credential can't deploy its own build") |
| + return |
| + } |
| + } |
| + expires := time.Now().Add(gatePassLifetime) |
| + // rec.Host, not the path segment: the edge keys the MAC on the route |
| + // row's own host, which is the record's, and the two are the same string |
| + // only because GetRecord found the record by it. |
| + value := gate.Mint(rec.Host, rec.Gate, expires) |
| + s.audit(acct, app, principal, "gate-pass", "issued a 15-minute gate pass for "+rec.Host+" to watch a deploy (cli)") |
| + writeJSON(w, http.StatusOK, map[string]any{ |
| + "name": gate.CookieName, |
| + "value": value, |
| + "expires": expires.UTC().Format(time.RFC3339), |
| + }) |
| +} |
| + |
| +// deployGatePassAllowed says whether a deploy credential can already put a |
| +// build of its own in front of a host on channel, which is what makes a pass |
| +// for that host nothing new (discussion #164, option b). Being allowed to |
| +// PROMOTE there is necessary, not sufficient: |
| +// |
| +// - beta is entered only from edge (release.PromotionAllowed) and a deploy |
| +// credential cannot hotfix, so on beta it can only move a build someone |
| +// else already put on edge; |
| +// - a channel with a bake window holds a promote for that window, so |
| +// until it expires the host keeps serving what it served before. |
| +// |
| +// What is left is canary/<name> on any app and edge on an app without a |
| +// pipeline: the channels a deploy credential ships its own build straight |
| +// onto, with nothing in between. |
| +func deployGatePassAllowed(p Principal, pipe *release.Pipeline, channel string) bool { |
| + if deployScopeAllows(p, pipe != nil, channel, false) != nil { |
| + return false |
| + } |
| + if rung, _ := release.Rung(channel); rung == release.RungBeta { |
| + return false |
| + } |
| + return holdWindow(pipe, channel) == 0 |
| +} |
diff --git a/internal/console/apigatepass_test.go b/internal/console/apigatepass_test.go| new file mode 100644 |
| index 000000000..75cfb8c6c |
| --- /dev/null |
| +++ b/internal/console/apigatepass_test.go |
| @@ -0,0 +1,200 @@ |
| +package console |
| + |
| +import ( |
| + "context" |
| + "encoding/json" |
| + "net/http" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/gate" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/release" |
| + "github.com/carlosframework/platform/internal/svcrole" |
| +) |
| + |
| +// gatedInstance creates one instance and sets a password on it, returning |
| +// the gate-pass URL for it. |
| +func gatedInstance(t *testing.T, fx *consoleFixture, token, host string) string { |
| + t.Helper() |
| + return gatedInstanceOn(t, fx, token, host, "") |
| +} |
| + |
| +// gatedInstanceOn is gatedInstance with the record's channel named ("" for |
| +// the manifest's default). |
| +func gatedInstanceOn(t *testing.T, fx *consoleFixture, token, host, channel string) string { |
| + t.Helper() |
| + enableInstances(t, fx, "titogo", sharedPoolManifest()) |
| + body := `{"host":"` + host + `","region":"ie"` |
| + if channel != "" { |
| + body += `,"channel":"` + channel + `"` |
| + } |
| + if status, _, out := rawReq(t, http.MethodPost, instancesURL(fx, "bab", "titogo"), token, |
| + body+`}`); status != http.StatusCreated { |
| + t.Fatalf("create = %d %s", status, out) |
| + } |
| + if status, _, out := rawReq(t, http.MethodPatch, updateURL(fx, "bab", "titogo", host), token, |
| + `{"gate":"correct horse"}`); status != http.StatusOK { |
| + t.Fatalf("patch gate = %d %s", status, out) |
| + } |
| + return updateURL(fx, "bab", "titogo", host) + "/gate-pass" |
| +} |
| + |
| +// TestAPIInstanceGatePassMintsAVerifyingCookie: the pass is a real gate |
| +// cookie for the record's host under the record's hash — the edge's own |
| +// gate.Verify accepts it — and it stops verifying after gatePassLifetime. |
| +// The hash itself never appears in the answer, and each pass is audited. |
| +func TestAPIInstanceGatePassMintsAVerifyingCookie(t *testing.T) { |
| + fx, token := instanceFixture(t, "code-inst-gate-pass") |
| + const host = "pass.go.tito.io" |
| + pu := gatedInstance(t, fx, token, host) |
| + |
| + before := time.Now() |
| + status, _, out := rawReq(t, http.MethodPost, pu, token, "") |
| + if status != http.StatusOK { |
| + t.Fatalf("gate pass = %d %s, want 200", status, out) |
| + } |
| + var pass struct { |
| + Name, Value, Expires string |
| + } |
| + if err := json.Unmarshal([]byte(out), &pass); err != nil { |
| + t.Fatalf("gate pass body %s: %v", out, err) |
| + } |
| + if pass.Name != gate.CookieName { |
| + t.Fatalf("name = %q, want %q", pass.Name, gate.CookieName) |
| + } |
| + stored, err := provision.GetRecord(context.Background(), fx.rel, "bab", "titogo", host) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if !gate.Verify(pass.Value, host, stored.Gate, before) { |
| + t.Fatal("the pass does not verify against the record's gate") |
| + } |
| + if gate.Verify(pass.Value, host, stored.Gate, before.Add(gatePassLifetime+time.Minute)) { |
| + t.Fatal("the pass still verifies after its lifetime") |
| + } |
| + if gate.Verify(pass.Value, "other.go.tito.io", stored.Gate, before) { |
| + t.Fatal("the pass verifies for a different host") |
| + } |
| + exp, err := time.Parse(time.RFC3339, pass.Expires) |
| + if err != nil || exp.Before(before.Add(gatePassLifetime-time.Minute)) { |
| + t.Fatalf("expires = %q (%v), want about %v from now", pass.Expires, err, gatePassLifetime) |
| + } |
| + events, err := fx.st.Events(OpsAccountID, "titogo", 20) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var detail string |
| + for _, e := range events { |
| + if e.Action == "gate-pass" { |
| + detail = e.Detail |
| + break |
| + } |
| + } |
| + if want := "issued a 15-minute gate pass for " + host + " to watch a deploy (cli)"; detail != want { |
| + t.Fatalf("audit detail = %q, want %q", detail, want) |
| + } |
| +} |
| + |
| +// TestAPIInstanceGatePassRefusals: an ungated host is a 409 naming it, and a |
| +// host that names no record is the family's 404. |
| +func TestAPIInstanceGatePassRefusals(t *testing.T) { |
| + fx, token := instanceFixture(t, "code-inst-gate-pass-refuse") |
| + gatedInstance(t, fx, token, "gp.go.tito.io") |
| + if status, _, out := rawReq(t, http.MethodPost, instancesURL(fx, "bab", "titogo"), token, |
| + `{"host":"open.go.tito.io","region":"ie"}`); status != http.StatusCreated { |
| + t.Fatalf("create = %d %s", status, out) |
| + } |
| + status, _, out := rawReq(t, http.MethodPost, updateURL(fx, "bab", "titogo", "open.go.tito.io")+"/gate-pass", token, "") |
| + if status != http.StatusConflict { |
| + t.Fatalf("ungated host = %d %s, want 409", status, out) |
| + } |
| + status, _, out = rawReq(t, http.MethodPost, updateURL(fx, "bab", "titogo", "nobody.go.tito.io")+"/gate-pass", token, "") |
| + if status != http.StatusNotFound { |
| + t.Fatalf("unknown host = %d %s, want 404", status, out) |
| + } |
| +} |
| + |
| +// TestAPIInstanceGatePassRoles pins who holds a pass: Instance, which can |
| +// clear the gate through PATCH anyway. Publish cannot always change what a |
| +// host serves (a passkey rung makes its promote a proposal), so a pass would |
| +// be new access for it; Operate can do neither. Both are refused. |
| +func TestAPIInstanceGatePassRoles(t *testing.T) { |
| + fx, member := instanceFixture(t, "code-inst-gate-pass-roles") |
| + pu := gatedInstance(t, fx, member, "roles.go.tito.io") |
| + for _, c := range []struct { |
| + name string |
| + role svcrole.Role |
| + want int |
| + }{ |
| + {"hub", svcrole.Publish, http.StatusForbidden}, |
| + {"router", svcrole.Instance, http.StatusOK}, |
| + {"ops", svcrole.Operate, http.StatusForbidden}, |
| + } { |
| + tok := serviceToken(t, fx.st, OpsAccountID, c.name, "titogo", c.role) |
| + if status, _, out := rawReq(t, http.MethodPost, pu, tok, ""); status != c.want { |
| + t.Errorf("%s: gate pass = %d %s, want %d", c.role, status, out, c.want) |
| + } |
| + } |
| +} |
| + |
| +// TestAPIInstanceGatePassDeployScope: a deploy credential gets a pass only |
| +// for a host on a channel it could promote to itself (discussion #164, |
| +// option b). Edge is in its rungs; beta is too, but it cannot put its own |
| +// build there; stable never is; and once the app has a pipeline, its |
| +// promote is limited to canary/<name>, so edge is refused too. |
| +// A refusal mints nothing and writes no audit row. |
| +func TestAPIInstanceGatePassDeployScope(t *testing.T) { |
| + fx, member := instanceFixture(t, "code-inst-gate-pass-deploy") |
| + edge := gatedInstanceOn(t, fx, member, "edge.go.tito.io", "edge") |
| + beta := gatedInstanceOn(t, fx, member, "beta.go.tito.io", "beta") |
| + stable := gatedInstanceOn(t, fx, member, "stable.go.tito.io", "stable") |
| + tok, err := fx.st.NewServicePrincipalScoped(OpsAccountID, "ci", "titogo", svcrole.Deploy, |
| + []string{"edge", "beta"}, nil, "paul@keymail.dev", time.Now()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + passes := func() int { |
| + events, err := fx.st.Events(OpsAccountID, "titogo", 50) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + n := 0 |
| + for _, e := range events { |
| + if e.Action == "gate-pass" { |
| + n++ |
| + } |
| + } |
| + return n |
| + } |
| + |
| + if status, _, out := rawReq(t, http.MethodPost, edge, tok, ""); status != http.StatusOK { |
| + t.Fatalf("deploy credential, host on edge = %d %s, want 200", status, out) |
| + } |
| + before := passes() |
| + status, _, out := rawReq(t, http.MethodPost, stable, tok, "") |
| + if status != http.StatusForbidden || !strings.Contains(out, "stable.go.tito.io") || !strings.Contains(out, "follows stable") { |
| + t.Fatalf("deploy credential, host on stable = %d %s, want 403 naming the host and its channel", status, out) |
| + } |
| + if passes() != before { |
| + t.Fatal("a refused pass was audited as issued") |
| + } |
| + // beta is in this credential's rungs, but it can only move a build that |
| + // someone else put on edge, and beta bakes: no pass. |
| + if status, _, out := rawReq(t, http.MethodPost, beta, tok, ""); status != http.StatusForbidden || !strings.Contains(out, "follows beta") { |
| + t.Fatalf("deploy credential, host on beta = %d %s, want 403", status, out) |
| + } |
| + |
| + if _, err := release.SetPipeline(context.Background(), fx.rel, fx.priv, "bab", "titogo", |
| + []release.PipelineChannel{{Name: "edge"}, {Name: "stable"}}, "paul@keymail.dev"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if status, _, out := rawReq(t, http.MethodPost, edge, tok, ""); status != http.StatusForbidden { |
| + t.Fatalf("deploy credential, edge host on a pipelined app = %d %s, want 403", status, out) |
| + } |
| + // A person is not scoped by rungs: the member still gets one. |
| + if status, _, out := rawReq(t, http.MethodPost, stable, member, ""); status != http.StatusOK { |
| + t.Fatalf("member, host on stable = %d %s, want 200", status, out) |
| + } |
| +} |
diff --git a/internal/console/authcli.go b/internal/console/authcli.go| index 55aa45380..b5e17affb 100644 |
| --- a/internal/console/authcli.go |
| +++ b/internal/console/authcli.go |
| @@ -711,6 +711,15 @@ func (s *Server) registerCLIRoutes() { |
| // it shows the app's own records and what their homes published. |
| s.cliRoute("POST /api/cli/apps/{account}/{app}/assets/purge", svcrole.Allow(svcrole.Publish, svcrole.Deploy), s.handleAPIAssetsPurge) |
| s.cliRoute("GET /api/cli/apps/{account}/{app}/assets", svcrole.Allow(svcrole.Publish, svcrole.Deploy, svcrole.Instance, svcrole.Operate), s.handleAPIAssetsStatus) |
| + // The deploy watch's gate pass (discussion #164). Instance, because an |
| + // Instance credential can already clear the gate through the PATCH |
| + // above, so a pass gives it nothing new. Deploy, because CI runs |
| + // `carlos deploy` with it, but per host: the handler refuses a host on a |
| + // channel the credential could not promote to. Publish is deliberately |
| + // NOT here: a Publish credential cannot always change what a host serves |
| + // (a passkey or approval rung turns its promote into a proposal), and it |
| + // cannot list instances, so `carlos deploy` never reaches this with one. |
| + s.cliRoute("POST /api/cli/apps/{account}/{app}/instances/{host}/gate-pass", svcrole.Allow(svcrole.Instance, svcrole.Deploy), s.handleAPIInstanceGatePass) |
| // The residence-move doors (issue #331): requested by the tenant's |
| // ROUTER with the app-held instance token (titogo's residence design — |
| // never by an instance about itself... which the role system cannot yet |
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go| index ef1c6e510..90860cd11 100644 |
| --- a/internal/console/claim_invariant_fixtures_test.go |
| +++ b/internal/console/claim_invariant_fixtures_test.go |
| @@ -960,6 +960,29 @@ var claimFixtures = map[string]claimFixture{ |
| do: claimAPI(http.MethodPost, "/api/cli/apps/bab/titogo/assets/purge", `{}`), |
| }}, |
| + // The deploy watch's gate pass (#164): mints a cookie and writes nothing |
| + // to the store, but audits every pass as an activity row of the app, an |
| + // app-scoped SQL write that needs admission like the db download's. |
| + "route POST /api/cli/apps/{account}/{app}/instances/{host}/gate-pass": {door: &claimDoor{ |
| + apps: claimRefs("bab/titogo"), |
| + setup: func(t *testing.T, cx *claimCase) { |
| + cx.instanceWorld(t) |
| + cx.instance(t, `{"host":"gp.go.tito.io","region":"ie"}`) |
| + cx.mustAPI(t, http.MethodPatch, "/api/cli/apps/bab/titogo/instances/gp.go.tito.io", `{"gate":"correct horse"}`, http.StatusOK) |
| + }, |
| + do: claimAPI(http.MethodPost, "/api/cli/apps/bab/titogo/instances/gp.go.tito.io/gate-pass", `{}`), |
| + check: func(t *testing.T, cx *claimCase, open bool) string { |
| + n := cx.sqlCount(t, `SELECT COUNT(*) FROM audit WHERE action = ? AND app = ?`, "gate-pass", "titogo") |
| + switch { |
| + case open && n == 0: |
| + return "the pass wrote no gate-pass activity row: the handler never reached its audit" |
| + case !open && n != 0: |
| + return "a gate-pass activity row was written while the app was closed under a foreign exclusive operation" |
| + } |
| + return "" |
| + }, |
| + }}, |
| + |
| // ---- POST: browser, account level ---- |
| "route POST /a/{sqid}/analytics/setting": claimNonApp("the account-level analytics default (telemetry account record); each app's own setting is its own door"), |
| "route POST /a/{sqid}/apps/new": {door: &claimDoor{ |
diff --git a/internal/console/deploydoors_test.go b/internal/console/deploydoors_test.go| index d9ac2fce6..d4eadc724 100644 |
| --- a/internal/console/deploydoors_test.go |
| +++ b/internal/console/deploydoors_test.go |
| @@ -30,6 +30,9 @@ var deployDoors = []string{ |
| // and read where the purge has reached. |
| "POST /api/cli/apps/{account}/{app}/assets/purge", |
| "GET /api/cli/apps/{account}/{app}/assets", |
| + // #164: carlos deploy's watch through a password gate, refused per host |
| + // outside the credential's rungs (TestAPIInstanceGatePassDeployScope). |
| + "POST /api/cli/apps/{account}/{app}/instances/{host}/gate-pass", |
| } |
| func TestDeployReachesExactlyItsDoors(t *testing.T) { |
diff --git a/internal/console/svcroutes_test.go b/internal/console/svcroutes_test.go| index 7fff52c58..6f24f6db4 100644 |
| --- a/internal/console/svcroutes_test.go |
| +++ b/internal/console/svcroutes_test.go |
| @@ -563,6 +563,14 @@ func TestNoRoleReachesAMintFleetOrPolicyDoor(t *testing.T) { |
| // records, split off 2026-09-24. Before the split an instance credential |
| // read these very rows through GET .../errors, so granting it here widens |
| // nothing — refusing it would be the change. |
| +// |
| +// POST .../instances/{host}/gate-pass stands on the same footing |
| +// (discussion #164). It |
| +// did not exist before service principals, so listing it in `want` would |
| +// make the legacy map lie. The instance role reaches it DELIBERATELY: the |
| +// pass is fifteen minutes' read past one host's password gate, and an |
| +// instance credential can already clear that gate outright through the |
| +// PATCH door pinned in `want`. TestAPIInstanceGatePassRoles pins who gets in. |
| var exemptFromLegacyPin = map[string]bool{ |
| "GET /api/cli/apps": true, |
| "GET /api/cli/apps/{account}/{app}/errors": true, |
| @@ -581,6 +589,8 @@ var exemptFromLegacyPin = map[string]bool{ |
| "POST /api/cli/apps/{account}/{app}/instances/{host}/move": true, |
| "POST /api/cli/apps/{account}/{app}/instances/{host}/move/cut": true, |
| "DELETE /api/cli/apps/{account}/{app}/instances/{host}/move": true, |
| + // The gate pass, on the footing set out above the map. |
| + "POST /api/cli/apps/{account}/{app}/instances/{host}/gate-pass": true, |
| // The rate-limit read (#358) stands on the instance GET's footing: the |
| // record it reads is one the instance role already reads and PATCHes, |
| // and the counts are that host's own refusals. It did not exist before |
diff --git a/internal/console/testdata/claim-routes.txt b/internal/console/testdata/claim-routes.txt| index a526dc00c..6d5d70c3a 100644 |
| --- a/internal/console/testdata/claim-routes.txt |
| +++ b/internal/console/testdata/claim-routes.txt |
| @@ -64,6 +64,7 @@ route GET /api/cli/apps/{account}/{app}/instances/{host}/move/offline |
| route GET /api/cli/apps/{account}/{app}/instances/{host}/rate-limit |
| route GET /api/cli/apps/{account}/{app}/instances/{host}/runs |
| route GET /api/cli/apps/{account}/{app}/instances/{host}/runs/{id} |
| +route GET /api/cli/apps/{account}/{app}/instances/{host}/updates |
| route GET /api/cli/apps/{account}/{app}/ledgers |
| route GET /api/cli/apps/{account}/{app}/ledgers/{ledger}/head |
| route GET /api/cli/apps/{account}/{app}/logs |
| @@ -190,11 +191,10 @@ route POST /api/cli/apps/{account}/{app}/features |
| route POST /api/cli/apps/{account}/{app}/instance-token |
| route POST /api/cli/apps/{account}/{app}/instances |
| route POST /api/cli/apps/{account}/{app}/instances/{host}/channel |
| +route POST /api/cli/apps/{account}/{app}/instances/{host}/gate-pass |
| route POST /api/cli/apps/{account}/{app}/instances/{host}/import/abort |
| route POST /api/cli/apps/{account}/{app}/instances/{host}/import/commit |
| route POST /api/cli/apps/{account}/{app}/instances/{host}/import/stopped |
| -route GET /api/cli/apps/{account}/{app}/instances/{host}/updates |
| -route PUT /api/cli/apps/{account}/{app}/instances/{host}/updates |
| route POST /api/cli/apps/{account}/{app}/instances/{host}/move |
| route POST /api/cli/apps/{account}/{app}/instances/{host}/move/cut |
| route POST /api/cli/apps/{account}/{app}/instances/{host}/move/offline |
| @@ -284,6 +284,7 @@ route PUT /api/cli/apps/{account}/{app}/domains/{host}/paths |
| route PUT /api/cli/apps/{account}/{app}/email/events/push |
| route PUT /api/cli/apps/{account}/{app}/instances-manifest |
| route PUT /api/cli/apps/{account}/{app}/instances/{host}/import |
| +route PUT /api/cli/apps/{account}/{app}/instances/{host}/updates |
| route PUT /api/cli/apps/{account}/{app}/pipeline |
| route PUT /api/cli/apps/{account}/{app}/sidecars-manifest |
| route PUT /api/cli/apps/{account}/{app}/swap |
diff --git a/internal/provision/gated_deploy_watch_164_census_test.go b/internal/provision/gated_deploy_watch_164_census_test.go| new file mode 100644 |
| index 000000000..c0bb7177f |
| --- /dev/null |
| +++ b/internal/provision/gated_deploy_watch_164_census_test.go |
| @@ -0,0 +1,37 @@ |
| +package provision |
| + |
| +// Record-write census entries for gated-deploy-watch-164 (discussion #164, |
| +// carlos deploy through a password gate), layered on |
| +// edgeAssetCache1WriteCensusInventory (main's newest at the merge of |
| +// origin/main, e16095cc). Reviewed by the branch author; the root-read half |
| +// is the card docs/superpowers/notes/census-proposal-gated-deploy-watch-164.md. |
| +// No record write is added. |
| +// - Server.registerCLIRoutes gains POST .../instances/{host}/gate-pass |
| +// (handleAPIInstanceGatePass, svcrole Instance and Deploy). The handler |
| +// reads the record (provision.GetRecord), mints a gate cookie and writes |
| +// an audit row; it never writes the record. Its instance and sidecar |
| +// literals are unchanged: key-site. Digested on main's body as of |
| +// edge-asset-cache-1 plus this branch's one route line. |
| +// - apiSession.instanceGatePass is a new CLI client: it builds the |
| +// console's .../instances/<host>/gate-pass path and POSTs an empty body; |
| +// it writes nothing itself and the door writes no record. key-site, like |
| +// instanceGet. |
| +func gatedDeployWatch164WriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), edgeAssetCache1WriteCensusInventory()...) |
| + replacements := []censusEntry{ |
| + {"internal/console/authcli.go", "Server.registerCLIRoutes", "key-site", "lit:instances,lit:sidecars", "36562c042cff640c996262f115a5cb26228221775f98f627a42644f326258a09"}, |
| + {"apimode.go", "apiSession.instanceGatePass", "key-site", "lit:instances", "45e15cfda268dea92168fa6bd861859cda9eb0b54d6bf2bfcf3175a948b7b179"}, |
| + } |
| + for _, r := range replacements { |
| + found := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + entries = append(entries, r) |
| + } |
| + } |
| + return entries |
| +} |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index 1e88e3ae1..f4192730d 100644 |
| --- a/internal/provision/plan9_b8_census_test.go |
| +++ b/internal/provision/plan9_b8_census_test.go |
| @@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) { |
| if len(got) < 100 { |
| t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root) |
| } |
| - inventory := edgeAssetCache1WriteCensusInventory() |
| + inventory := gatedDeployWatch164WriteCensusInventory() |
| problems := append(censusDiff(inventory, got), censusPolicy(inventory)...) |
| if len(problems) > 0 { |
| t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n ")) |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 120ad9dbc..311a98103 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -32,3 +32,4 @@ plan14-root-reads-edge-asset-cache-1.tsv 1199c91ebbfb03869e89d06798176598526e818 |
| plan14-root-reads-hunt-account-root-hardening.tsv ed721c45bf1af12467439061137d8c7a0757bc5ca1c921616ff42d5a7672d743 |
| plan14-root-reads-plans-4c-units.tsv f6c05461d95d00fb468c5f580487de16370049b91963539546026cadadaa1c9d |
| plan14-root-reads-plans-4c-box-throttle.tsv c71b2974cd929122afc730f22cb53c63f3fdefdb4b26f7ca60db76fface906de |
| +plan14-root-reads-gated-deploy-watch-164.tsv c5d8767f883f4a8677330039f54aa556124f6dde888e0b4a36095a49b634e634 |
diff --git a/internal/provision/testdata/plan14-root-reads-gated-deploy-watch-164.tsv b/internal/provision/testdata/plan14-root-reads-gated-deploy-watch-164.tsv| new file mode 100644 |
| index 000000000..2eb64569b |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-gated-deploy-watch-164.tsv |
| @@ -0,0 +1,8 @@ |
| +# Census overlay gated-deploy-watch-164, written by census-propose (#369). census-ruling-gated-deploy-watch-164, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-gated-deploy-watch-164.md. |
| +# 2 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy e94cbee13358948b0329c826baeeb16ef1940d685cefcb7755f645e803b97e9f deploy.go checkTarget legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-gated-deploy-watch-164;basis=builds the watch poll as a request so it can carry a gate pass cookie (#164), and names a 401 with no X-Carlos-Version as the password gate; same one HTTP GET of the target origin, read site unchanged (1), none added file:ReadAll@1997 2c2a9fc8e7660a387c49480f831d31e44efe1b0792332420ca49d7fc1bf61996 |
| +@legacy 5ea913a69726cd96c078c7ead7d80041817ce46d381d2af71725609597620991 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 file:Stat@9232 ee7da2e20040f371716eba0639f44dc7eaef5307c7fe4d70117f45185e2ab5d6 |
| +deploy.go checkTarget legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-gated-deploy-watch-164;basis=builds the watch poll as a request so it can carry a gate pass cookie (#164), and names a 401 with no X-Carlos-Version as the password gate; same one HTTP GET of the target origin, read site unchanged (1), none added file:ReadAll@1997 2c2a9fc8e7660a387c49480f831d31e44efe1b0792332420ca49d7fc1bf61996 |
| +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 file:Stat@9232 ee7da2e20040f371716eba0639f44dc7eaef5307c7fe4d70117f45185e2ab5d6 |
| +@coverage . 1a587f0ac7e54184ae85e73e5a6b7b6cd9155edba1b431626a84c1d481858a8c |
| +@coverage internal/console 01abbba632a7513e204bb77ec915cd19421f0ce7770decd255a4fb1744d976d4 |