carlos / platform Public

interactive: the per-app setting and carlos apps set --interactive (rootfs plan 6)

Task 4. appconfig.Manifest gains Interactive (default bundle, omitempty;
off is the absent key), with GetInteractive and SetInteractive (the swap
policy's CAS write under WithAppMutation; an unchanged call writes
nothing). The console's PUT /api/cli/apps/{account}/{app}/interactive is
closed to every service role; turning it on needs an account owner
(RFS-6-C38), any member may turn it off; it audits (RFS-6-C40) and bumps
the serial. carlos apps set --interactive on|off reaches it, and
appsSetRun takes interactive *bool after change (PF-21).

appsSetNothing takes RFS-6-C47's approved text, and its three checked
records change with it: the deck row, zdd.apps-set.nothing and IP1-57.
RFS-6-C38 to C47 join rootfsCopyBuilt, their file cells now real paths
(PF-12). Census: policyDoors, closedDoors (74), claim-routes and a claim
door fixture; the write census adds claimRawSetInteractive (nonrecord)
and re-pins registerCLIRoutes; the root-read overlay re-pins the `.` and
internal/appconfig envelopes (no unit changed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 91271850c5fa295f065847126ddd383aad284dfb parent f49c43b
21 files changed, +777 −35
  • approved_rootfs_copy_test.go +3 −0
  • apps_policy_test.go +8 −8
  • apps_swap.go +61 −4
  • apps_swap_test.go +68 −0
  • apps_updates.go +29 −4
  • apps_updates_test.go +62 −7
  • docs/superpowers/notes/census-proposal-rootfs-apps-6.md +1 −1
  • docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json +1 −1
  • docs/superpowers/plans/2026-10-21-instance-policy-copy.json +1 −1
  • docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md +5 −5
  • internal/appconfig/appconfig.go +12 −0
  • internal/appconfig/interactive.go +68 −0
  • internal/appconfig/interactive_test.go +166 −0
  • internal/console/apiinteractivesetting.go +77 −0
  • internal/console/apiinteractivesetting_test.go +176 −0
  • internal/console/authcli.go +5 −0
  • internal/console/claim_invariant_fixtures_test.go +11 −0
  • internal/console/svcroutes_test.go +11 −3
  • internal/console/testdata/claim-routes.txt +1 −0
  • internal/provision/rootfs_apps_6_census_test.go +8 −0
  • internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv +3 −1

Intent

Human

<task-notification> <task-id>a16630208021d5baa</task-id> <tool-use-id>toolu_01Gjqt4PiEWJemBtWj6rNaWM</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/a16630208021d5baa.output</output-file> <status>completed</status> <summary>Agent "Review #471 Task 2" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Spec compliance:** ✅ Spec compliant. Two items can't be checked from this diff: the 502 at the hub is Task 5's, and wrapping the refusal body so its `Close` releases the reservation is Task 3/5's. **Task quality:** Approved. No Critical or Important findings. I re-ran no tests. Findings: - **Minor, marker on any status (Concern 2).** At `upgrade.go:442` the hub reads any marked response as an upgrade, whatever its status. I found no way an app can make one: the box's raw header copies all use canonical keys, and the shim's strip catches them. As a cheap extra guard, honour the marker only on a 200, pass a marked non-200 through as a refusal, and test it with a raw handler without `Mark`. A separate "exactly 101 in-band" rule isn't needed, because the in-band check already requires 101. - **Minor, handshake headers not pinned.** Spec §8.1 case 1 says `Sec-WebSocket-*` arrive unchanged. The test checks only `Sec-WebSocket-Key` on the request side, and `Sec-WebSocket-Extensions` never in either direction. They do pass through unchanged, but nothing pins them (`upgrade_hub_test.go:97`, `:120-125`). - **Minor, timer precedence not pinned.** No mutation pins the rule at `upgrade.go:468` that a fired timer beats a read that got through. A one-line comment or a seam would cover it. - **Minor, note for Task 3 (Concern 3).** Accepted for this task: `Close` can wait on a stuck tunnel, the same as plain bodies today. Task 3's `release()` must cancel the stream context before it closes the body, because x/net's `Close` returns at once only when that context has ended. It can still wait on the connection's write lock when unread bytes are left (x/net `transport.go:2292-2315`). - **Minor, no action (Concern 4).** Closing the pipe at once on a refusal is fine, and dropping it would be harmless. - **Concern 1 is in scope, not extra.** x/net doesn't watch the context while the request body is open. So the context reset is the only way the spec's reservation cancel can reach the handshake read. Mutation M8 pins it. - **The test-only hook is safe.** It is unexported, nil in production, and costs one nil check. - **All 9 mutations pin what they claim.** - **No leaks found.** I traced cleanup on every path: bad token, transport error, refusal, in-band failure, context ending before and after the 101, and tunnel loss. The review is in `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-tunnel-websockets-471/.superpowers/sdd/2026-10-30-tunnel-websockets/task-2-review.md`.</result> <usage><subagent_tokens>124655</subagent_tokens><tool_uses>18</tool_uses><duration_ms>342710</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>ab617b622cabab4ae</task-id> <tool-use-id>toolu_01XxVMNkM1aanjAWjhUpnHQ6</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/ab617b622cabab4ae.output</output-file> <status>completed</status> <summary>Agent "#471 Task 3: hub registry, reservation" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Status:** DONE_WITH_CONCERNS. None of the concerns blocks this task. **Commit:** `0fe483db` on `design-tunnel-websockets-471` (base `249b38f4`), not pushed. Git printed its usual `packed-refs.lock` error, but the commit landed. **Tests:** all 10 new edge tests and the new tunnelclient test pass, the edge ones also 10 times over under `-race`. The tests of the other `NewTunnelHub`/`EnableTunnels` callers pass: 62 more in `internal/edge`, plus `fleetapi`, `host` and the root package. Build, vet, gofmt and the darwin, windows and linux/arm64 builds are clean. 14 mutations each fail a named test, including the brief's two (drop the tenancy check, drop the `Once`). The test pinning today's 502 passes. All three Task 2 carries are done: - `release` cancels the stream context before closing the body. A real HTTP/2 test on a stuck tunnel shows the wrong order blocks for 2 s. - The marker counts only on a 200. A raw-handler test (no `Mark`) shows a marked 302 coming back as an ordinary refusal. - `reserveUpgrade` returns the stream context. A test shows that releasing it ends the in-band handshake read and resets the stream. `conn` became `channel`, and its two callers (`State`, `transportFor`) are migrated. The census card shows `Edge.ServeHTTP` as `body` and `Edge.Reload` as `reads` (`+registry:Account/App/Tunnel`): these are the `-tunnel` arm's tenancy copied from a row `Reload` already reads, with no new query and no file read. Spec §7 is reconciled in the same commit and the seal is unchanged. **Concerns:** 1. **`k3x` in a test:** the brief names account `k3x` for the `-tunnel` row, which conflicts with common.md's "never k3x". I followed the brief. 2. **No platform alias of a forward row:** that can't exist, because a platform alias needs a source with a socket and a forward row can't have one. I showed that fold on a fleet-placed row instead, and gave the forward row an attached alias. Both folds are covered. 3. **One delete is redundant at the hub:** the `Rewrite` delete of `Carlos-Tunnel-Upgrade` is already done by `Edge.ServeHTTP`. I added a direct `Rewrite` unit test to pin it. 4. **The marker passes through on a refusal:** a marked non-200 keeps the header, so the browser would see an inert header. Only a box breaking the shim's contract could send one, so I left it rather than change the "unchanged" contract. 5. **One check beyond the brief:** `reserveUpgrade` also refuses an admission with an empty tenancy. It is pinned by a mutation. Notes for Tasks 4 and 5 are in the report. The full report (RED/GREEN, mutations, callers, census card) is at `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-tunnel-websockets-471/.superpowers/sdd/2026-10-30-tunnel-websockets/task-3-report.md`.</result> <usage><subagent_tokens>233372</subagent_tokens><tool_uses>68</tool_uses><duration_ms>1219739</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>b10lq158w</task-id> <tool-use-id>toolu_011MYLYz6oBYqSao9Nkj6H6g</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/b10lq158w.output</output-file> <status>completed</status> <summary>Background command "Package #471 Task 3 and run its Astra review" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 57.4 g CO₂e (7,523,905 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on rootfs-apps-6-interactive, 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/approved_rootfs_copy_test.go b/approved_rootfs_copy_test.go
index 24b488143..b059abbe7 100644
--- a/approved_rootfs_copy_test.go
+++ b/approved_rootfs_copy_test.go
@@ -253,6 +253,9 @@ var rootfsCopyBuilt = []string{
"RFS-4-C111", "RFS-4-C112", "RFS-4-C113", "RFS-4-C114", "RFS-4-C115", "RFS-4-C116", "RFS-4-C117", "RFS-4-C118",
"RFS-4-C119", "RFS-4-C120", "RFS-4-C121", "RFS-4-C122", "RFS-4-C123", "RFS-4-C124", "RFS-4-C125", "RFS-4-C126",
"RFS-4-C131", "RFS-4-C132", "RFS-4-C133", "RFS-4-C134", "RFS-4-C135", "RFS-4-C145",
+ // Plan 6 Task 4: the interactive sessions setting
+ // (internal/console/apiinteractivesetting.go, apps_swap.go)
+ "RFS-6-C38", "RFS-6-C39", "RFS-6-C40", "RFS-6-C41", "RFS-6-C42", "RFS-6-C43", "RFS-6-C44", "RFS-6-C45", "RFS-6-C46", "RFS-6-C47",
}
func mustParseRootfsRecord(t *testing.T) []copyRow {
diff --git a/apps_policy_test.go b/apps_policy_test.go
index 573ee2161..190a68d16 100644
--- a/apps_policy_test.go
+++ b/apps_policy_test.go
@@ -316,7 +316,7 @@ func TestAppsSetPrintsNotChecked(t *testing.T) {
}
c := &policyConsole{getBody: `{"policy":{"v":1},"etag":""}`,
putBody: `{"policy":{"v":1,"egress_allow":["10.0.5.20"]},"etag":"e1","not_checked":["box-c"]}`}
- if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change); err != nil {
+ if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change, nil); err != nil {
t.Fatal(err)
}
want := fmt.Sprintf(appsSetEgressDone+"\n", "shop", "10.0.5.20") + fmt.Sprintf(appsSetEgressNotChecked+"\n", "box-c")
@@ -331,7 +331,7 @@ func TestAppsSetPrintsNotChecked(t *testing.T) {
out.Reset()
c = &policyConsole{getBody: `{"policy":{"v":1},"etag":""}`,
putBody: `{"policy":{"v":1,"egress_allow":["10.0.5.20"]},"etag":"e1",` + nc + `}`}
- if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change); err != nil {
+ if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change, nil); err != nil {
t.Fatal(err)
}
want := fmt.Sprintf(appsSetEgressDone+"\n", "shop", "10.0.5.20")
@@ -348,7 +348,7 @@ func TestAppsSetWithoutPolicyFlagsSendsNoPolicyRequest(t *testing.T) {
captureStdout(t)
var d doorLog
hold := "hold"
- if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop", &swapPolicyReq{Swap: &hold}, nil, nil); err != nil {
+ if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop", &swapPolicyReq{Swap: &hold}, nil, nil, nil); err != nil {
t.Fatal(err)
}
if want := []string{"PUT /api/cli/apps/bab/shop/swap"}; !reflect.DeepEqual(d.got(), want) {
@@ -366,7 +366,7 @@ func TestAppsSetRunPolicyChangePrintsWhatTheConsoleStored(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change); err != nil {
+ if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change, nil); err != nil {
t.Fatal(err)
}
want := fmt.Sprintf(appsSetEgressDone+"\n", "shop", "10.0.5.20, fd00:5::20") + fmt.Sprintf(appsSetSizeDone+"\n", "shop", "large") + sizeTakesEffectLine + "\n"
@@ -381,7 +381,7 @@ func TestAppsSetRunPolicyChangePrintsWhatTheConsoleStored(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change); err != nil {
+ if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change, nil); err != nil {
t.Fatal(err)
}
want = fmt.Sprintf(appsSetEgressCleared+"\n", "shop") + fmt.Sprintf(appsSetSizeCleared+"\n", "shop") + sizeTakesEffectLine + "\n"
@@ -391,7 +391,7 @@ func TestAppsSetRunPolicyChangePrintsWhatTheConsoleStored(t *testing.T) {
// A refused change is the console's words under the verb.
c = &policyConsole{getBody: `{"policy":{"v":1},"etag":"e1"}`, putStatus: http.StatusPreconditionFailed, putBody: `{"error":"x"}`}
- err = appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change)
+ err = appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change, nil)
if err == nil || err.Error() != fmt.Sprintf(appsSetError, appsPolicyChanged) {
t.Fatalf("err = %v", err)
}
@@ -416,7 +416,7 @@ func TestAppPolicyResolvesAnAccountNameToItsSqid(t *testing.T) {
c = &policyConsole{accounts: accounts, getBody: `{"policy":{"v":1},"etag":""}`, putBody: `{"policy":{"v":1,"default_size":"large"},"etag":"e1"}`}
large := "large"
- if err := appsSetRun(ctx, c.session(t), apiAcct{Seg: "shop-team"}, "shop", nil, nil, &policyChange{DefaultSize: &large}); err != nil {
+ if err := appsSetRun(ctx, c.session(t), apiAcct{Seg: "shop-team"}, "shop", nil, nil, &policyChange{DefaultSize: &large}, nil); err != nil {
t.Fatal(err)
}
if want := []string{"GET /api/cli/apps/bab/shop/policy", "PUT /api/cli/apps/bab/shop/policy"}; !reflect.DeepEqual(c.calls, want) {
@@ -479,7 +479,7 @@ func TestSizeChangePrintsCommitted(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change); err != nil {
+ if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change, nil); err != nil {
t.Fatal(err)
}
if want := fmt.Sprintf(appsSetSizeDone+"\n", "shop", "large") + line + sizeTakesEffectLine + "\n"; out.String() != want {
diff --git a/apps_swap.go b/apps_swap.go
index 083bd53ee..96dda0700 100644
--- a/apps_swap.go
+++ b/apps_swap.go
@@ -38,7 +38,7 @@ const (
appsSetFlagApp = "app whose swap or instance policy to set"
appsSetFlagSwap = "overlap or hold: how a running instance takes a new build"
appsSetFlagConcurrency = "how many instances of the app may swap at once on one box (1 or more)"
- appsSetNothing = "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow or --size"
+ appsSetNothing = "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow, --size or --interactive"
appsSetBadSwap = "apps set: --swap is overlap or hold, not %q"
appsSetBadConcurrency = "apps set: --swap-concurrency must be 1 or more"
appsSetTwoApps = "apps set: name the app once, either first or with --app"
@@ -52,6 +52,24 @@ const (
appsSetOldConsole = "not found: either %s is not an app in this account, or this console predates carlos apps set (deploy a console built from current main)"
)
+// The interactive sessions setting (rootfs apps spec §5.10; deck
+// 2026-10-24-rootfs-apps-copy.md, RFS-6-C41 to C46). The usage line is
+// indented where it is printed, like the --swap lines above it: the deck's
+// table cell cannot hold its two leading spaces.
+const (
+ appsSetInteractiveUsage = "--interactive on|off whether members may open a terminal session on the app's instances, with carlos run -it or carlos console. it is off until an owner turns it on. a session can read and change everything the instance can"
+ appsSetFlagInteractive = "on or off: whether members may open terminal sessions on the app's instances"
+ appsSetBadInteractive = "apps set: --interactive is on or off, not %q"
+ appsSetInteractiveOn = "%s: interactive sessions are on. any member can open a terminal on its instances with carlos run -it"
+ appsSetInteractiveOff = "%s: interactive sessions are off"
+ appsSetInteractiveMismatch = "apps set: the change did not stick (the console stored interactive %s). run it again"
+)
+
+// apiInteractiveSetting is the interactive door's body and its echo.
+type apiInteractiveSetting struct {
+ Interactive bool `json:"interactive"`
+}
+
// swapPolicyReq is the door's body: an absent half is left as it is.
type swapPolicyReq struct {
Swap *string `json:"swap,omitempty"`
@@ -116,6 +134,20 @@ func appsSetRequest(swap string, concurrency int, swapGiven, concurrencyGiven bo
return req, nil
}
+// appsSetInteractiveRequest reads --interactive: on or off, and nothing
+// else, checked here so a word the door cannot take costs no round trip.
+func appsSetInteractiveRequest(v string) (*bool, error) {
+ switch strings.TrimSpace(v) {
+ case "on":
+ on := true
+ return &on, nil
+ case "off":
+ off := false
+ return &off, nil
+ }
+ return nil, fmt.Errorf(appsSetBadInteractive, v)
+}
+
// appsSetStuck compares the echo with what was asked: a write that half
// landed must be loud (build-probe's discipline).
func appsSetStuck(req swapPolicyReq, got apiSwapPolicy) error {
@@ -139,8 +171,9 @@ func runAppsSet(args []string) {
defMajor := fs.String("default-major", "", updatewords.Text("settings.cli.apps-set-flag-major"))
egress := fs.String("egress-allow", "", appsSetFlagEgress)
size := fs.String("size", "", appsSetFlagSize)
+ interactiveF := fs.String("interactive", "", appsSetFlagInteractive)
consoleFlag := consoleOption(fs, "console to act through (default: the only logged-in one)")
- fs.Usage = flagUsage(fs, appsSetUsage+"\n\n"+updatewords.Text("settings.cli.apps-set-usage")+"\n\n"+appsSetPolicyUsage)
+ fs.Usage = flagUsage(fs, appsSetUsage+"\n\n "+appsSetInteractiveUsage+"\n\n"+updatewords.Text("settings.cli.apps-set-usage")+"\n\n"+appsSetPolicyUsage)
fs.Parse(args)
app, err := appsSetApp(lead, *appF, fs.Args())
if err != nil {
@@ -165,7 +198,13 @@ func runAppsSet(args []string) {
if err != nil {
log.Fatal(err)
}
- if swapReq == nil && policy == nil && change == nil {
+ var interactive *bool
+ if flagWasSet(fs, "interactive") {
+ if interactive, err = appsSetInteractiveRequest(*interactiveF); err != nil {
+ log.Fatal(err)
+ }
+ }
+ if swapReq == nil && policy == nil && change == nil && interactive == nil {
log.Fatal(appsSetNothing)
}
sess, err := resolveMode(*consoleFlag)
@@ -176,7 +215,7 @@ func runAppsSet(args []string) {
log.Fatal(appsSetDirectMode)
}
acct := resolvedAccount(sess, acctRaw, acctIDRaw)
- if err := appsSetRun(context.Background(), sess, acct, app, swapReq, policy, change); err != nil {
+ if err := appsSetRun(context.Background(), sess, acct, app, swapReq, policy, change, interactive); err != nil {
log.Fatal(err)
}
}
@@ -201,3 +240,21 @@ func (s *apiSession) setSwapPolicy(ctx context.Context, a apiAcct, app string, r
}
return out, nil
}
+
+// setInteractive is the interactive half of `carlos apps set`. The console
+// refuses with its own words (a member turning it on, RFS-6-C38), and they
+// are returned as they came.
+func (s *apiSession) setInteractive(ctx context.Context, a apiAcct, app string, on bool) (bool, error) {
+ status, body, err := s.putJSON(ctx, apiPath(a, app, "/interactive"), apiInteractiveSetting{Interactive: on})
+ if err != nil {
+ return false, err
+ }
+ if status != http.StatusOK {
+ return false, apiErrorFromBody(status, body)
+ }
+ var out apiInteractiveSetting
+ if err := json.Unmarshal(body, &out); err != nil {
+ return false, fmt.Errorf(appsSetUnreadable, err)
+ }
+ return out.Interactive, nil
+}
diff --git a/apps_swap_test.go b/apps_swap_test.go
index ac0afcbc1..010a55921 100644
--- a/apps_swap_test.go
+++ b/apps_swap_test.go
@@ -6,6 +6,8 @@ import (
"io"
"net/http"
"net/http/httptest"
+ "reflect"
+ "strings"
"testing"
)
@@ -110,3 +112,69 @@ func TestAPISessionSetSwapPolicyOldConsole(t *testing.T) {
t.Fatalf("err = %v", err)
}
}
+
+// Rootfs plan 6 Task 4: --interactive takes on or off and nothing else; the
+// request carries the bool; the run prints the line for what the console
+// stored, and says so when the console stored something else.
+func TestAppsSetInteractive(t *testing.T) {
+ for _, tc := range []struct {
+ in string
+ want bool
+ }{{"on", true}, {"off", false}, {" on ", true}} {
+ got, err := appsSetInteractiveRequest(tc.in)
+ if err != nil || got == nil || *got != tc.want {
+ t.Errorf("appsSetInteractiveRequest(%q) = %v, %v; want %v", tc.in, got, err, tc.want)
+ }
+ }
+ for _, bad := range []string{"yes", "", "true", "ON"} {
+ if got, err := appsSetInteractiveRequest(bad); err == nil || err.Error() != fmt.Sprintf(appsSetBadInteractive, bad) {
+ t.Errorf("appsSetInteractiveRequest(%q) = %v, %v; want %q", bad, got, err, fmt.Sprintf(appsSetBadInteractive, bad))
+ }
+ }
+ if err := appsSetRun(context.Background(), newTestSession("http://127.0.0.1:1"), apiAcct{Seg: "bah"}, "shop", nil, nil, nil, nil); err == nil || err.Error() != appsSetNothing {
+ t.Errorf("nothing given: %v, want %q", err, appsSetNothing)
+ }
+ if appsSetNothing != "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow, --size or --interactive" {
+ t.Errorf("appsSetNothing = %q, not RFS-6-C47", appsSetNothing)
+ }
+
+ var sent []string
+ stored := ""
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ b, _ := io.ReadAll(r.Body)
+ sent = append(sent, r.Method+" "+r.URL.Path+" "+string(b))
+ w.Header().Set("Content-Type", "application/json")
+ if stored != "" {
+ io.WriteString(w, stored)
+ return
+ }
+ io.WriteString(w, strings.Replace(string(b), " ", "", -1))
+ }))
+ defer ts.Close()
+ for _, tc := range []struct {
+ on bool
+ body string
+ line string
+ }{
+ {true, `{"interactive":true}`, fmt.Sprintf(appsSetInteractiveOn+"\n", "shop")},
+ {false, `{"interactive":false}`, fmt.Sprintf(appsSetInteractiveOff+"\n", "shop")},
+ } {
+ sent = nil
+ out := captureStdout(t)
+ on := tc.on
+ if err := appsSetRun(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bah"}, "shop", nil, nil, nil, &on); err != nil {
+ t.Fatalf("on=%v: %v", tc.on, err)
+ }
+ if want := []string{"PUT /api/cli/apps/bah/shop/interactive " + tc.body}; !reflect.DeepEqual(sent, want) {
+ t.Fatalf("on=%v sent %q, want %q", tc.on, sent, want)
+ }
+ if out.String() != tc.line {
+ t.Fatalf("on=%v stdout = %q, want %q", tc.on, out.String(), tc.line)
+ }
+ }
+ stored = `{"interactive":false}`
+ on := true
+ if err := appsSetRun(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bah"}, "shop", nil, nil, nil, &on); err == nil || err.Error() != fmt.Sprintf(appsSetInteractiveMismatch, "off") {
+ t.Fatalf("a mismatched echo: %v, want %q", err, fmt.Sprintf(appsSetInteractiveMismatch, "off"))
+ }
+}
diff --git a/apps_updates.go b/apps_updates.go
index 96e9ce572..7cfff7f55 100644
--- a/apps_updates.go
+++ b/apps_updates.go
@@ -88,9 +88,10 @@ func (s *apiSession) setUpdatePolicy(ctx context.Context, a apiAcct, app string,
// appsSetRun is `carlos apps set` once its flags are checked and its session
// resolved: the swap door when a swap flag was given, then the update policy
// door when a policy flag was, then the app policy door when --egress-allow
-// or --size was, with lines for each. The first failure stops it.
-func appsSetRun(ctx context.Context, sess *apiSession, acct apiAcct, app string, swap *swapPolicyReq, policy updatePolicyReq, change *policyChange) error {
- if swap == nil && policy == nil && change == nil {
+// or --size was, then the interactive door when --interactive was, with
+// lines for each. The first failure stops it.
+func appsSetRun(ctx context.Context, sess *apiSession, acct apiAcct, app string, swap *swapPolicyReq, policy updatePolicyReq, change *policyChange, interactive *bool) error {
+ if swap == nil && policy == nil && change == nil && interactive == nil {
return errors.New(appsSetNothing)
}
if swap != nil {
@@ -133,7 +134,31 @@ func appsSetRun(ctx context.Context, sess *apiSession, acct apiAcct, app string,
or(strings.Join(got.InstanceControl, ", ")), updates, or(got.DefaultChannel), major)
}
if change != nil {
- return appsSetPolicyRun(ctx, sess, acct, app, *change)
+ if err := appsSetPolicyRun(ctx, sess, acct, app, *change); err != nil {
+ return err
+ }
+ }
+ if interactive != nil {
+ got, err := sess.setInteractive(ctx, acct, app, *interactive)
+ if err != nil {
+ return fmt.Errorf(appsSetError, err)
+ }
+ if got != *interactive {
+ return fmt.Errorf(appsSetInteractiveMismatch, onOff(got))
+ }
+ if got {
+ fmt.Fprintf(stdout, appsSetInteractiveOn+"\n", app)
+ } else {
+ fmt.Fprintf(stdout, appsSetInteractiveOff+"\n", app)
+ }
}
return nil
}
+
+// onOff is --interactive's own value word for b.
+func onOff(b bool) string {
+ if b {
+ return "on"
+ }
+ return "off"
+}
diff --git a/apps_updates_test.go b/apps_updates_test.go
index afa786341..e9614b2ee 100644
--- a/apps_updates_test.go
+++ b/apps_updates_test.go
@@ -150,6 +150,9 @@ func appsSetConsole(t *testing.T, d *doorLog) *apiSession {
switch {
case strings.HasSuffix(r.URL.Path, "/swap"):
io.WriteString(w, `{"swap":"hold","swap_concurrency":2}`)
+ case strings.HasSuffix(r.URL.Path, "/interactive"):
+ b, _ := io.ReadAll(r.Body)
+ w.Write(b)
case strings.HasSuffix(r.URL.Path, "/updates"):
io.WriteString(w, `{"instance_control":["updates","pin"],"default_updates":"manual","default_channel":"stable","default_major":3}`)
default:
@@ -164,7 +167,7 @@ func TestAppsSetRunPolicyFlagsOnlyCallOnlyTheUpdatesDoor(t *testing.T) {
out := captureStdout(t)
var d doorLog
policy := updatePolicyReq{"default_updates": "manual"}
- if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop", nil, policy, nil); err != nil {
+ if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop", nil, policy, nil, nil); err != nil {
t.Fatal(err)
}
if want := []string{"PUT /api/cli/apps/bab/shop/updates"}; !reflect.DeepEqual(d.got(), want) {
@@ -180,7 +183,7 @@ func TestAppsSetRunSwapFlagsOnlyCallOnlyTheSwapDoor(t *testing.T) {
out := captureStdout(t)
var d doorLog
hold := "hold"
- if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop", &swapPolicyReq{Swap: &hold}, nil, nil); err != nil {
+ if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop", &swapPolicyReq{Swap: &hold}, nil, nil, nil); err != nil {
t.Fatal(err)
}
if want := []string{"PUT /api/cli/apps/bab/shop/swap"}; !reflect.DeepEqual(d.got(), want) {
@@ -196,7 +199,7 @@ func TestAppsSetRunBothCallSwapThenUpdates(t *testing.T) {
var d doorLog
hold := "hold"
if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop",
- &swapPolicyReq{Swap: &hold}, updatePolicyReq{"default_major": 3}, nil); err != nil {
+ &swapPolicyReq{Swap: &hold}, updatePolicyReq{"default_major": 3}, nil, nil); err != nil {
t.Fatal(err)
}
if want := []string{"PUT /api/cli/apps/bab/shop/swap", "PUT /api/cli/apps/bab/shop/updates"}; !reflect.DeepEqual(d.got(), want) {
@@ -220,7 +223,7 @@ func TestAppsSetRunSwapFailureSkipsPolicy(t *testing.T) {
defer ts.Close()
hold := "hold"
err := appsSetRun(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop",
- &swapPolicyReq{Swap: &hold}, updatePolicyReq{"default_major": 3}, nil)
+ &swapPolicyReq{Swap: &hold}, updatePolicyReq{"default_major": 3}, nil, nil)
if err == nil || err.Error() != fmt.Sprintf(appsSetError, errors.New("no")) {
t.Fatalf("err = %v", err)
}
@@ -235,7 +238,7 @@ func TestAppsSetRunPolicyFailureCarriesTheConsoleWords(t *testing.T) {
io.WriteString(w, `{"error":"the console says no"}`)
}))
defer ts.Close()
- err := appsSetRun(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop", nil, updatePolicyReq{"default_channel": ""}, nil)
+ err := appsSetRun(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop", nil, updatePolicyReq{"default_channel": ""}, nil, nil)
if err == nil || err.Error() != "apps set: the console says no" {
t.Fatalf("err = %v", err)
}
@@ -243,7 +246,7 @@ func TestAppsSetRunPolicyFailureCarriesTheConsoleWords(t *testing.T) {
func TestAppsSetRunNothingToSet(t *testing.T) {
var d doorLog
- err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop", nil, nil, nil)
+ err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bab"}, "shop", nil, nil, nil, nil)
if err == nil || err.Error() != appsSetNothing {
t.Fatalf("err = %v", err)
}
@@ -262,7 +265,7 @@ func TestAppsSetPolicyDoneSaysAutoForUnsetDefaultUpdates(t *testing.T) {
}))
t.Cleanup(ts.Close)
out := captureStdout(t)
- if err := appsSetRun(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop", nil, updatePolicyReq{"default_updates": ""}, nil); err != nil {
+ if err := appsSetRun(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, "shop", nil, updatePolicyReq{"default_updates": ""}, nil, nil); err != nil {
t.Fatal(err)
}
none := updatewords.Text("settings.cli.none")
@@ -271,3 +274,55 @@ func TestAppsSetPolicyDoneSaysAutoForUnsetDefaultUpdates(t *testing.T) {
t.Fatalf("stdout = %q, want %q", out.String(), want)
}
}
+
+// Rootfs plan 6 Task 4 (PF-21): --interactive alone is something to set. It
+// reaches the interactive door and only that door; with all four halves nil
+// the run is RFS-6-C47 and sends nothing. A refusal comes back in the
+// console's own words.
+func TestAppsSetInteractiveAloneIsSomethingToSet(t *testing.T) {
+ var d doorLog
+ on := true
+ out := captureStdout(t)
+ if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bah"}, "shop", nil, nil, nil, &on); err != nil {
+ t.Fatalf("interactive alone: %v", err)
+ }
+ if want := []string{"PUT /api/cli/apps/bah/shop/interactive"}; !reflect.DeepEqual(d.got(), want) {
+ t.Fatalf("doors = %v, want %v", d.got(), want)
+ }
+ if want := fmt.Sprintf(appsSetInteractiveOn+"\n", "shop"); out.String() != want {
+ t.Fatalf("stdout = %q, want %q", out.String(), want)
+ }
+
+ var none doorLog
+ err := appsSetRun(context.Background(), appsSetConsole(t, &none), apiAcct{Seg: "bah"}, "shop", nil, nil, nil, nil)
+ if err == nil || err.Error() != "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow, --size or --interactive" {
+ t.Fatalf("all four nil: %v, want exactly RFS-6-C47", err)
+ }
+ if len(none.got()) != 0 {
+ t.Fatalf("a request went out: %v", none.got())
+ }
+
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusForbidden)
+ io.WriteString(w, `{"error":"only an owner of the account can turn interactive sessions on"}`)
+ }))
+ defer ts.Close()
+ err = appsSetRun(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bah"}, "shop", nil, nil, nil, &on)
+ if err == nil || err.Error() != "apps set: only an owner of the account can turn interactive sessions on" {
+ t.Fatalf("a member's refusal: %v", err)
+ }
+}
+
+// The swap and interactive halves together call both doors, swap first.
+func TestAppsSetRunSwapThenInteractive(t *testing.T) {
+ captureStdout(t)
+ var d doorLog
+ hold, off := "hold", false
+ if err := appsSetRun(context.Background(), appsSetConsole(t, &d), apiAcct{Seg: "bah"}, "shop", &swapPolicyReq{Swap: &hold}, nil, nil, &off); err != nil {
+ t.Fatal(err)
+ }
+ if want := []string{"PUT /api/cli/apps/bah/shop/swap", "PUT /api/cli/apps/bah/shop/interactive"}; !reflect.DeepEqual(d.got(), want) {
+ t.Fatalf("doors = %v", d.got())
+ }
+}
diff --git a/docs/superpowers/notes/census-proposal-rootfs-apps-6.md b/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
index 6749b970d..b487624d0 100644
--- a/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
+++ b/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
@@ -6,7 +6,7 @@ Ruling `census-ruling-rootfs-apps-6`. The independent reviewer approves or rejec
|---|---|---|---|
| `internal/provision/reconcile.go` `Reconcile` | body | unchanged (178) | rootfs Plan 6 Task 3: in the per-record loop, beside the RunSeen call, calls cfg.InteractiveSeen(rec) when the hook is set and the in-scope record carries an interactive-session marker (rec.Interactive != nil), once per record per pass, before the pass acts on it; the hook is the box worker's non-blocking note (Task 12). Same record keys and literal; no read added (registry read sites unchanged, 178); nothing written by the call |
-Envelopes re-pinned: `internal/provision`.
+Envelopes re-pinned: `.`, `internal/appconfig`, `internal/provision`.
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. Reject 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. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
diff --git a/docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json b/docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json
index 1b14fb26f..4c5f6706b 100644
--- a/docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json
+++ b/docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json
@@ -50,7 +50,7 @@
{"id": "zdd.apps-set.flag-swap", "file": "apps_swap.go", "text": "overlap or hold: how a running instance takes a new build"},
{"id": "zdd.apps-set.flag-concurrency", "file": "apps_swap.go", "text": "how many instances of the app may swap at once on one box (1 or more)"},
{"id": "zdd.apps-set.flag-app", "file": "apps_swap.go", "text": "app whose swap or instance policy to set"},
- {"id": "zdd.apps-set.nothing", "file": "apps_swap.go", "text": "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow or --size"},
+ {"id": "zdd.apps-set.nothing", "file": "apps_swap.go", "text": "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow, --size or --interactive"},
{"id": "zdd.apps-set.bad-swap", "file": "apps_swap.go", "text": "apps set: --swap is overlap or hold, not %q"},
{"id": "zdd.apps-set.bad-concurrency", "file": "apps_swap.go", "text": "apps set: --swap-concurrency must be 1 or more"},
{"id": "zdd.apps-set.two-apps", "file": "apps_swap.go", "text": "apps set: name the app once, either first or with --app"},
diff --git a/docs/superpowers/plans/2026-10-21-instance-policy-copy.json b/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
index dd36fd272..ac85b4684 100644
--- a/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
+++ b/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
@@ -79,7 +79,7 @@
{"id": "IP2-31", "file": "apps_policy.go", "text": "!"},
{"id": "IP1-55", "file": "apps.go", "text": " show <app> the app's egress allow and sizes. system operators only\n"},
{"id": "IP1-56", "file": "apps.go", "text": "usage: carlos apps <create|place|build-probe|set|show|delete|restore|ttl|keep|list> [flags] <app>"},
- {"id": "IP1-57", "file": "apps_swap.go", "text": "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow or --size"},
+ {"id": "IP1-57", "file": "apps_swap.go", "text": "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow, --size or --interactive"},
{"id": "GAP-1", "file": "internal/updatewords/words_surfaces.go", "text": "usage: carlos instances set <host> [--app <a>] [--updates auto|manual] [--channel <c>] [--major <n>] [--pin <build>] [--size small|standard|large|xlarge|default] (an empty value clears an update setting)"},
{"id": "GAP-2", "file": "apps_swap.go", "text": "usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]\n"},
{"id": "GAP-3", "file": "apps_swap.go", "text": "app whose swap or instance policy to set"},
diff --git a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
index cf7ac774e..61c59e190 100644
--- a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
+++ b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
@@ -508,11 +508,11 @@ From the plan: Every string is human text the plan introduces. Existing approved
| RFS-6-C35 | console doors, host-claim | interactive sessions are not available on this console yet. they need the host-claim launch protocol | approved |
| RFS-6-C36 | console door | the session request is malformed | approved |
| RFS-6-C37 | console door | could not open the session. try again | approved |
-| RFS-6-C38 | setting door | only an owner of the account can turn interactive sessions on | approved |
-| RFS-6-C39 | setting door | say whether interactive sessions are on or off | approved |
-| RFS-6-C40 | setting door audit detail | turned interactive sessions %s for %s (%s) | approved |
-| RFS-6-C41 | `apps_swap.go` usage | --interactive on\|off whether members may open a terminal session on the app's instances, with carlos run -it or carlos console. it is off until an owner turns it on. a session can read and change everything the instance can | approved |
-| RFS-6-C42 | flag `--interactive` | on or off: whether members may open terminal sessions on the app's instances | approved |
+| RFS-6-C38 | internal/console/apiinteractivesetting.go (setting door) | only an owner of the account can turn interactive sessions on | approved |
+| RFS-6-C39 | internal/console/apiinteractivesetting.go (setting door) | say whether interactive sessions are on or off | approved |
+| RFS-6-C40 | internal/console/apiinteractivesetting.go (setting door audit detail) | turned interactive sessions %s for %s (%s) | approved |
+| RFS-6-C41 | apps_swap.go (usage) | --interactive on\|off whether members may open a terminal session on the app's instances, with carlos run -it or carlos console. it is off until an owner turns it on. a session can read and change everything the instance can | approved |
+| RFS-6-C42 | apps_swap.go (flag `--interactive`) | on or off: whether members may open terminal sessions on the app's instances | approved |
| RFS-6-C43 | apps_swap.go | apps set: --interactive is on or off, not %q | approved |
| RFS-6-C44 | apps_swap.go | %s: interactive sessions are on. any member can open a terminal on its instances with carlos run -it | approved |
| RFS-6-C45 | apps_swap.go | %s: interactive sessions are off | approved |
diff --git a/internal/appconfig/appconfig.go b/internal/appconfig/appconfig.go
index e5fb0bb29..b2b0ab46a 100644
--- a/internal/appconfig/appconfig.go
+++ b/internal/appconfig/appconfig.go
@@ -87,6 +87,18 @@ type Manifest struct {
Swap string `json:"swap,omitempty"`
SwapConcurrency int `json:"swap_concurrency,omitempty"`
+ // Interactive is the app's setting that allows interactive sessions
+ // (rootfs apps spec §5.10, C9): `carlos run -it` and `carlos console`
+ // open a terminal on an instance only while it is true. Off by default,
+ // and off is the ABSENT key. App-level, like Swap: written into and read
+ // from the DEFAULT bundle only (SetInteractive, GetInteractive), never a
+ // named environment. Additive to schema 1 and omitted when false, so a
+ // manifest without it marshals byte for byte as before. It is never
+ // rendered into an instance's config file, so changing it restarts
+ // nothing. A binary from before it drops the key when it rewrites the
+ // bundle, which turns the setting off: the safe direction.
+ Interactive bool `json:"interactive,omitempty"`
+
// OwnerScope marks a named environment as OWNED by a team credential's
// scope (implementation/team-scoped-credentials.md §3). An owned
// environment is STANDALONE: LoadMerged renders it from itself alone and
diff --git a/internal/appconfig/interactive.go b/internal/appconfig/interactive.go
new file mode 100644
index 000000000..ae98af9d3
--- /dev/null
+++ b/internal/appconfig/interactive.go
@@ -0,0 +1,68 @@
+package appconfig
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+
+ "github.com/carlosframework/platform/internal/release"
+)
+
+// GetInteractive reads whether the app allows interactive sessions (rootfs
+// apps spec §5.10, C9). No config.json is off, not an error (Get's own
+// convention). The console's session door and the box both read it.
+func GetInteractive(ctx context.Context, s release.Store, acct, app string) (bool, error) {
+ m, err := Get(ctx, s, acct, app)
+ if err != nil {
+ return false, err
+ }
+ return m != nil && m.Interactive, nil
+}
+
+// SetInteractive writes the setting into the default bundle by the CAS
+// read-modify-write SetSwapPolicy uses, and returns what is stored. Off is
+// stored as the ABSENT key. A call that changes nothing writes nothing and
+// touches nothing: turning it off on an app with no config.json never
+// creates one. Turning it on for such an app creates a bundle with no vars,
+// which config sync leaves alone (renderExecConfig's keepAbsent), so no
+// instance restarts.
+func SetInteractive(ctx context.Context, s release.Store, acct, app string, on bool) (claimResult0 bool, claimResult1 error) {
+ claimResult1 = release.WithAppMutation(ctx, s, acct, app, "appconfig.SetInteractive", func(claimContext context.Context) error {
+ claimResult0, claimResult1 = claimRawSetInteractive(claimContext, s, acct, app, on)
+ return claimResult1
+ })
+ return
+}
+
+// claimRawSetInteractive is the unwrapped implementation of SetInteractive,
+// called from within the WithAppMutation wrapper.
+func claimRawSetInteractive(ctx context.Context, s release.Store, acct, app string, on bool) (bool, error) {
+ if !release.ValidAccount(acct) {
+ return false, fmt.Errorf("config: invalid account %q", acct)
+ }
+ if !release.ValidApp(app) {
+ return false, fmt.Errorf("config: invalid app %q", app)
+ }
+ key := Key(acct, app)
+ m, etag, _, err := getForWriteAt(ctx, s, key, app)
+ if err != nil {
+ return false, err
+ }
+ if m.Interactive == on {
+ return on, nil
+ }
+ next := m
+ next.Interactive = on
+ next.Schema, next.App = manifestSchema(&next), app
+ raw, err := json.MarshalIndent(next, "", " ")
+ if err != nil {
+ return false, err
+ }
+ if _, err := s.Put(ctx, key, raw, etag); err != nil {
+ return false, err
+ }
+ // A config change for the fast loop, as SetSwapPolicy's is:
+ // best-effort, since the write above has landed.
+ touchLogged(ctx, s, acct, app)
+ return on, nil
+}
diff --git a/internal/appconfig/interactive_test.go b/internal/appconfig/interactive_test.go
new file mode 100644
index 000000000..e7eb02adb
--- /dev/null
+++ b/internal/appconfig/interactive_test.go
@@ -0,0 +1,166 @@
+package appconfig
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "errors"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/release"
+)
+
+// Rootfs plan 6 Task 4 (spec §5.10): an app that has never had config is
+// off, and turning it off creates nothing, so no box sees a change.
+func TestInteractiveDefaultsOffAndWritesNothing(t *testing.T) {
+ ctx := context.Background()
+ s := release.NewDirStore(t.TempDir())
+ on, err := GetInteractive(ctx, s, "bah", "shop")
+ if err != nil || on {
+ t.Fatalf("GetInteractive on no config.json = %v, %v; want false", on, err)
+ }
+ got, err := SetInteractive(ctx, s, "bah", "shop", false)
+ if err != nil || got {
+ t.Fatalf("SetInteractive(false) = %v, %v; want false", got, err)
+ }
+ if _, _, err := s.Get(ctx, Key("bah", "shop")); !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("turning it off created config.json: %v", err)
+ }
+ if _, _, err := s.Get(ctx, GenKey("bah", "shop")); !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("turning it off touched the config generation: %v", err)
+ }
+}
+
+func TestInteractiveOnKeepsTheRestOfTheBundle(t *testing.T) {
+ ctx := context.Background()
+ s := release.NewDirStore(t.TempDir())
+ if err := SetEnv(ctx, s, "bah", "shop", map[string]string{"A": "1"}); err != nil {
+ t.Fatal(err)
+ }
+ if err := SetExecDelivery(ctx, s, "bah", "shop", ExecDeliveryFile); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := SetSwapPolicy(ctx, s, "bah", "shop", SwapHold, 3); err != nil {
+ t.Fatal(err)
+ }
+ before, _, err := s.Get(ctx, Key("bah", "shop"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, genBefore, _ := s.Get(ctx, GenKey("bah", "shop"))
+ got, err := SetInteractive(ctx, s, "bah", "shop", true)
+ if err != nil || !got {
+ t.Fatalf("SetInteractive(true) = %v, %v; want true", got, err)
+ }
+ m, err := Get(ctx, s, "bah", "shop")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !m.Interactive || m.Vars["A"].Value != "1" || m.ExecDelivery != ExecDeliveryFile || m.Swap != SwapHold || m.SwapConcurrency != 3 {
+ t.Fatalf("manifest after set = %+v", m)
+ }
+ raw, _, err := s.Get(ctx, Key("bah", "shop"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ var keys map[string]json.RawMessage
+ if err := json.Unmarshal(raw, &keys); err != nil {
+ t.Fatal(err)
+ }
+ if string(keys["interactive"]) != "true" {
+ t.Fatalf("config.json = %s, want \"interactive\": true", raw)
+ }
+ if _, genAfter, err := s.Get(ctx, GenKey("bah", "shop")); err != nil || genAfter == genBefore {
+ t.Fatalf("a real change must touch the config generation: %q -> %q, %v", genBefore, genAfter, err)
+ }
+ if on, err := GetInteractive(ctx, s, "bah", "shop"); err != nil || !on {
+ t.Fatalf("GetInteractive = %v, %v; want true", on, err)
+ }
+
+ // Setting it again writes nothing.
+ _, etag, _ := s.Get(ctx, Key("bah", "shop"))
+ if got, err := SetInteractive(ctx, s, "bah", "shop", true); err != nil || !got {
+ t.Fatalf("SetInteractive(true) again = %v, %v", got, err)
+ }
+ if _, etag2, _ := s.Get(ctx, Key("bah", "shop")); etag2 != etag {
+ t.Fatalf("an unchanged setting rewrote config.json: %q -> %q", etag, etag2)
+ }
+
+ // Off is the absent key: the bundle has the bytes it had before.
+ if got, err := SetInteractive(ctx, s, "bah", "shop", false); err != nil || got {
+ t.Fatalf("SetInteractive(false) = %v, %v", got, err)
+ }
+ after, _, err := s.Get(ctx, Key("bah", "shop"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Equal(before, after) {
+ t.Fatalf("off is not the absent key:\nbefore %s\nafter %s", before, after)
+ }
+}
+
+func TestInteractiveRefusesBadNames(t *testing.T) {
+ ctx := context.Background()
+ s := release.NewDirStore(t.TempDir())
+ if _, err := SetInteractive(ctx, s, "BAH", "shop", true); err == nil {
+ t.Error("a bad account was accepted")
+ }
+ if _, err := SetInteractive(ctx, s, "bah", "../shop", true); err == nil {
+ t.Error("a bad app was accepted")
+ }
+}
+
+// The setting is read by the console and the box, never rendered: config
+// sync renders the same bytes for a route before and after it is turned on
+// (renderExecConfig), so it writes nothing and restarts nothing.
+func TestSettingInteractiveRestartsNothing(t *testing.T) {
+ ctx, s, reg, dd, priv, _ := execKit(t)
+ pk, err := ParsePrivateKey(priv, "test")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := reg.Upsert(registry.Route{
+ Host: "shop.example.com", Kind: "instance", App: "shop", Account: "bah",
+ Status: "ready", Socket: "/run/carlos/shop.sock",
+ }); err != nil {
+ t.Fatal(err)
+ }
+ var bounced []string
+ pass := func() {
+ t.Helper()
+ bounced = nil
+ if err := SyncExec(ctx, reg, s, pk, dd, func(h string) error { bounced = append(bounced, h); return nil }, "", nil); err != nil {
+ t.Fatalf("SyncExec: %v", err)
+ }
+ }
+ path := filepath.Join(dd, "shop.example.com.config.env")
+ if err := SetEnv(ctx, s, "bah", "shop", map[string]string{"LOG_LEVEL": "debug"}); err != nil {
+ t.Fatal(err)
+ }
+ pass()
+ before, err := os.ReadFile(path)
+ if err != nil || string(before) != "LOG_LEVEL=debug\n" || len(bounced) != 1 {
+ t.Fatalf("the first var: file %q, %v, bounced %v", before, err, bounced)
+ }
+ info, err := os.Stat(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := SetInteractive(ctx, s, "bah", "shop", true); err != nil {
+ t.Fatal(err)
+ }
+ pass()
+ after, err := os.ReadFile(path)
+ if err != nil || !bytes.Equal(before, after) {
+ t.Fatalf("the render changed: %q -> %q, %v", before, after, err)
+ }
+ if info2, err := os.Stat(path); err != nil || !info2.ModTime().Equal(info.ModTime()) {
+ t.Fatalf("config sync rewrote the file: %v", err)
+ }
+ if len(bounced) != 0 {
+ t.Fatalf("turning interactive on restarted %v", bounced)
+ }
+}
diff --git a/internal/console/apiinteractivesetting.go b/internal/console/apiinteractivesetting.go
new file mode 100644
index 000000000..5f77f3553
--- /dev/null
+++ b/internal/console/apiinteractivesetting.go
@@ -0,0 +1,77 @@
+// The interactive sessions setting (rootfs apps spec §5.10, C9): `carlos
+// apps set --interactive on|off`. While it is off, no member can open a
+// terminal on the app's instances with `carlos run -it` or `carlos console`.
+//
+// GATE: apiAccountApp proves membership, and the route is registered with
+// the ZERO role set: a session is a live shell into production data, so a
+// credential the app holds must not open that door for itself. Turning it
+// ON is an account owner's act; any member may turn it OFF, since off only
+// takes authority away.
+package console
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "time"
+
+ "github.com/carlosframework/platform/internal/appconfig"
+)
+
+const (
+ // RFS-6-C38: a member asked to turn it on.
+ apiInteractiveOwnerOnly = "only an owner of the account can turn interactive sessions on"
+ // RFS-6-C39: the body did not say on or off.
+ apiInteractiveMissing = "say whether interactive sessions are on or off"
+ // RFS-6-C40: "on" or "off", the app, then "cli".
+ apiInteractiveAudit = "turned interactive sessions %s for %s (%s)"
+)
+
+func (s *Server) handleAPIInteractivePut(w http.ResponseWriter, r *http.Request) {
+ addr, acct, app, ok := s.apiAccountApp(w, r)
+ if !ok {
+ return
+ }
+ p, _ := principalFrom(r.Context())
+ if !s.allowWrite(p, time.Now()) {
+ jsonError(w, http.StatusTooManyRequests, apiSwapLimited)
+ return
+ }
+ // A pointer, so an absent field is refused rather than read as off. The
+ // strict reader refuses a misspelt key by name.
+ var req struct {
+ Interactive *bool `json:"interactive"`
+ }
+ if !readJSONStrictLimit(w, r, &req, 8<<10) {
+ return
+ }
+ if req.Interactive == nil {
+ jsonError(w, http.StatusBadRequest, apiInteractiveMissing)
+ return
+ }
+ on := *req.Interactive
+ if on && acct.Role != RoleOwner {
+ jsonError(w, http.StatusForbidden, apiInteractiveOwnerOnly)
+ return
+ }
+ ctx, cancel := context.WithTimeout(r.Context(), configStoreTimeout)
+ defer cancel()
+ got, err := appconfig.SetInteractive(ctx, s.cfg.Releases, acct.Sqid, app, on)
+ if err != nil {
+ s.configStoreError(w, fmt.Sprintf("api interactive %s/%s", acct.Sqid, app), err)
+ return
+ }
+ s.audit(acct, app, addr, "interactive", fmt.Sprintf(apiInteractiveAudit, onOff(got), app, "cli"))
+ // The box reads the setting with the app's config: the serial makes the
+ // fast loop read it within seconds.
+ s.bumpSerial(ctx)
+ writeJSON(w, http.StatusOK, map[string]any{"interactive": got})
+}
+
+// onOff is the setting's own value word.
+func onOff(on bool) string {
+ if on {
+ return "on"
+ }
+ return "off"
+}
diff --git a/internal/console/apiinteractivesetting_test.go b/internal/console/apiinteractivesetting_test.go
new file mode 100644
index 000000000..ee6fa043e
--- /dev/null
+++ b/internal/console/apiinteractivesetting_test.go
@@ -0,0 +1,176 @@
+package console
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "net/http"
+ "os"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/appconfig"
+ "github.com/carlosframework/platform/internal/domains"
+ "github.com/carlosframework/platform/internal/svcrole"
+)
+
+// interactiveFx is the console fixture with the app shop in a non-ops
+// account (bah or baj), owned by paul@keymail.dev, with alice@keymail.dev a
+// member, and a CLI token for each.
+type interactiveFx struct {
+ *consoleFixture
+ acctID int64
+ acct string
+ owner, alice string
+}
+
+func newInteractiveFx(t *testing.T, acctID int64, code string) *interactiveFx {
+ t.Helper()
+ fx := newConsoleFixture(t)
+ now := time.Now()
+ sqid := domains.Sqid(acctID)
+ if err := fx.st.CreateAccount(acctID, sqid, "Shop", "paul@keymail.dev", now); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := fx.st.CreateAppIn(acctID, "shop", "paul@keymail.dev", now); err != nil {
+ t.Fatal(err)
+ }
+ if err := WriteAccountManifest(context.Background(), fx.rel, acctID, sqid, "Shop", now); err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.st.AddMember(acctID, "alice@keymail.dev", RoleMember, now); err != nil {
+ t.Fatal(err)
+ }
+ return &interactiveFx{
+ consoleFixture: fx, acctID: acctID, acct: sqid,
+ owner: cliToken(t, fx, "paul@keymail.dev", code+"-owner"),
+ alice: cliToken(t, fx, "alice@keymail.dev", code+"-member"),
+ }
+}
+
+func (fx *interactiveFx) put(t *testing.T, token, body string) (int, string) {
+ t.Helper()
+ code, _, out := rawReq(t, http.MethodPut, fx.ts.URL+"/api/cli/apps/"+fx.acct+"/shop/interactive", token, body)
+ return code, out
+}
+
+func (fx *interactiveFx) stored(t *testing.T) bool {
+ t.Helper()
+ on, err := appconfig.GetInteractive(context.Background(), fx.rel, fx.acct, "shop")
+ if err != nil {
+ t.Fatal(err)
+ }
+ return on
+}
+
+func (fx *interactiveFx) events(t *testing.T) []Event {
+ t.Helper()
+ evs, err := fx.st.Events(fx.acctID, "shop", 100)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var out []Event
+ for _, e := range evs {
+ if e.Action == "interactive" {
+ out = append(out, e)
+ }
+ }
+ return out
+}
+
+func interactiveError(t *testing.T, body string) string {
+ t.Helper()
+ var e struct{ Error string }
+ if err := json.Unmarshal([]byte(body), &e); err != nil {
+ t.Fatalf("body %q: %v", body, err)
+ }
+ return e.Error
+}
+
+func TestInteractiveSettingNeedsAnOwnerToTurnOn(t *testing.T) {
+ fx := newInteractiveFx(t, 7, "code-interactive-on")
+ if fx.acct != "bah" {
+ t.Fatalf("account %q, want bah", fx.acct)
+ }
+ before := serial(t, fx.consoleFixture)
+ code, out := fx.put(t, fx.alice, `{"interactive":true}`)
+ if code != http.StatusForbidden || interactiveError(t, out) != apiInteractiveOwnerOnly {
+ t.Fatalf("member on = %d %s, want 403 %q", code, out, apiInteractiveOwnerOnly)
+ }
+ if _, _, err := fx.rel.Get(context.Background(), appconfig.Key(fx.acct, "shop")); !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("a refused request wrote config.json: %v", err)
+ }
+ if evs := fx.events(t); len(evs) != 0 || serial(t, fx.consoleFixture) != before {
+ t.Fatalf("a refused request audited %+v or bumped the serial", evs)
+ }
+
+ code, out = fx.put(t, fx.owner, `{"interactive":true}`)
+ if code != http.StatusOK || strings.TrimSpace(out) != `{"interactive":true}` {
+ t.Fatalf("owner on = %d %q, want 200 {\"interactive\":true}", code, out)
+ }
+ if !fx.stored(t) {
+ t.Fatal("the owner's request did not store interactive on")
+ }
+ evs := fx.events(t)
+ if want := "turned interactive sessions on for shop (cli)"; len(evs) != 1 || evs[0].Detail != want {
+ t.Fatalf("audit = %+v, want one row %q", evs, want)
+ }
+ if got := serial(t, fx.consoleFixture); got != before+1 {
+ t.Fatalf("serial = %d, want %d: boxes act on the serial", got, before+1)
+ }
+}
+
+func TestInteractiveSettingAnyMemberTurnsOff(t *testing.T) {
+ fx := newInteractiveFx(t, 8, "code-interactive-off")
+ if fx.acct != "baj" {
+ t.Fatalf("account %q, want baj", fx.acct)
+ }
+ if code, out := fx.put(t, fx.owner, `{"interactive":true}`); code != http.StatusOK {
+ t.Fatalf("owner on = %d %s", code, out)
+ }
+ code, out := fx.put(t, fx.alice, `{"interactive":false}`)
+ if code != http.StatusOK || strings.TrimSpace(out) != `{"interactive":false}` {
+ t.Fatalf("member off = %d %q, want 200 {\"interactive\":false}", code, out)
+ }
+ if fx.stored(t) {
+ t.Fatal("the member's request left interactive on")
+ }
+ evs := fx.events(t)
+ if want := "turned interactive sessions off for shop (cli)"; len(evs) != 2 || evs[0].Detail != want && evs[1].Detail != want {
+ t.Fatalf("audit = %+v, want a row %q", evs, want)
+ }
+}
+
+func TestInteractiveSettingRefusesServiceCredentials(t *testing.T) {
+ fx := newInteractiveFx(t, 7, "code-interactive-svc")
+ for _, role := range []svcrole.Role{svcrole.Admin, svcrole.Publish, svcrole.Instance} {
+ tok := serviceToken(t, fx.st, fx.acctID, "ci-"+string(role), "shop", role)
+ code, out := fx.put(t, tok, `{"interactive":true}`)
+ if code != http.StatusForbidden || !strings.Contains(out, "closed to service credentials") {
+ t.Errorf("%s credential = %d %s, want the closed-door 403", role, code, out)
+ }
+ }
+ if fx.stored(t) {
+ t.Fatal("a service credential turned interactive on")
+ }
+}
+
+func TestInteractiveSettingRefusesAMissingField(t *testing.T) {
+ fx := newInteractiveFx(t, 7, "code-interactive-missing")
+ for _, body := range []string{`{}`, `{"interactive":null}`} {
+ code, out := fx.put(t, fx.owner, body)
+ if code != http.StatusBadRequest || interactiveError(t, out) != apiInteractiveMissing {
+ t.Errorf("%s = %d %s, want 400 %q", body, code, out, apiInteractiveMissing)
+ }
+ }
+ // A misspelt key or a word for a bool is refused, not read as off.
+ for _, body := range []string{`{"interactiv":true}`, `{"interactive":"on"}`} {
+ if code, out := fx.put(t, fx.owner, body); code != http.StatusBadRequest {
+ t.Errorf("%s = %d %s, want 400", body, code, out)
+ }
+ }
+ if _, _, err := fx.rel.Get(context.Background(), appconfig.Key(fx.acct, "shop")); !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("a refused request wrote config.json: %v", err)
+ }
+}
diff --git a/internal/console/authcli.go b/internal/console/authcli.go
index ea30fe561..5dcb8deec 100644
--- a/internal/console/authcli.go
+++ b/internal/console/authcli.go
@@ -981,6 +981,11 @@ func (s *Server) registerCLIRoutes() {
// §11 says only app members change it, and a credential the app holds
// must not choose what its own migrations run beside.
s.cliRoute("PUT /api/cli/apps/{account}/{app}/swap", svcrole.Set{}, s.handleAPISwapPut)
+ // The interactive sessions setting (rootfs apps spec §5.10,
+ // apiinteractivesetting.go). The ZERO Set: a session is a live shell
+ // into production data, and a credential the app holds must not open
+ // that door for itself. Turning it on is an owner's act, in the handler.
+ s.cliRoute("PUT /api/cli/apps/{account}/{app}/interactive", svcrole.Set{}, s.handleAPIInteractivePut)
// The app policy (instance sizes and egress spec §6, apipolicy.go): the
// private addresses an app's instances may reach and the sizes they run
// at. The ZERO Set at the mux, so no service credential reaches either
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go
index 03b99df60..c38d66586 100644
--- a/internal/console/claim_invariant_fixtures_test.go
+++ b/internal/console/claim_invariant_fixtures_test.go
@@ -2116,6 +2116,17 @@ var claimFixtures = map[string]claimFixture{
apps: claimRefs("bab/titogo"),
do: claimAPI(http.MethodPut, "/api/cli/apps/bab/titogo/swap", `{"swap":"hold"}`),
}},
+ // The interactive sessions setting (apiinteractivesetting.go): the swap
+ // door's shape, turned on by the harness's owner. The world enrolls only
+ // kass and titogo, so the setup enrolls shop.
+ "route PUT /api/cli/apps/{account}/{app}/interactive": {door: &claimDoor{
+ apps: claimRefs("bab/shop"),
+ setup: func(t *testing.T, cx *claimCase) {
+ t.Helper()
+ cx.enroll(t, "bab", "shop")
+ },
+ do: claimAPI(http.MethodPut, "/api/cli/apps/bab/shop/interactive", `{"interactive":true}`),
+ }},
// The app policy door (apipolicy.go). The claim case carries a Bucket, so
// its console takes the writer lease: the setup gives it Task 8's fake
// leaser, the server's own field and not process-wide state, so the door
diff --git a/internal/console/svcroutes_test.go b/internal/console/svcroutes_test.go
index 7e95bdbcb..6b39bda5c 100644
--- a/internal/console/svcroutes_test.go
+++ b/internal/console/svcroutes_test.go
@@ -55,6 +55,9 @@ import (
// §6): the private addresses an app's instances may reach and the sizes they
// run at. The same fact about its subject: an app's credential must never
// widen what its own instances may reach.
+// /{app}/interactive is the interactive sessions setting (rootfs apps spec
+// §5.10): whether members may open a live shell on the app's instances. An
+// app's credential must never open that door onto itself.
//
// The email family adds one entry to each list, and both are facts about the
// door's subject rather than about any role:
@@ -82,7 +85,7 @@ import (
var (
mintDoors = []string{"/instance-token", "/door-keys", "/api/cli/services/", "/email/credentials"}
fleetDoors = []string{"/api/cli/fleets/"}
- policyDoors = []string{"/instances-manifest", "/{app}/updates", "/{app}/routes", "/email/pause", "/build-probe", "/{app}/swap", "/{app}/policy"}
+ policyDoors = []string{"/instances-manifest", "/{app}/updates", "/{app}/routes", "/email/pause", "/build-probe", "/{app}/swap", "/{app}/policy", "/{app}/interactive"}
systemDoors = []string{"/api/cli/system/"}
)
@@ -255,6 +258,11 @@ var closedDoors = []string{
// app members": a credential the app holds must not choose what its own
// migrations run beside.
"PUT /api/cli/apps/{account}/{app}/swap",
+ // The interactive sessions setting (rootfs apps spec §5.10): whether
+ // members may open a live shell into production data on the app's
+ // instances. A credential the app holds must not open that for itself;
+ // turning it on is an account owner's act, in the handler.
+ "PUT /api/cli/apps/{account}/{app}/interactive",
// The app policy (instance sizes and egress spec §6): operator-only, both
// the read and the write. Its egress allow opens private addresses to an
// app's instances, so a credential the app holds must never widen it, and
@@ -1134,8 +1142,8 @@ func TestEveryClosedDoorRefusesAServiceCredential(t *testing.T) {
}
seen++
}
- if seen != len(closedDoors) || seen != 73 {
- t.Errorf("walked %d closed doors, want all %d (and 73 today: three environment ownership doors, instance-token, three door-key doors, the routes door, the regional placements write, instances-manifest, the app update policy, sidecars-manifest, the route-channel move, three instance update settings doors, two db replica doors, the forwarded db read, six fleets, the fleet secrets key door, four services, two email credentials, email pause, the build probe, the swap policy, two app policy doors, two app region doors, the live tenancy read, the layout read, the activation-cancel door, ten system doors, three deployment-wide antivirus, three platform geoip doors, two pointer digest doors, the hostname history status, the channel resign, two release authorize doors, four store-entitlement doors, two account plan doors, two billing problem doors, and the billing house door)",
+ if seen != len(closedDoors) || seen != 74 {
+ t.Errorf("walked %d closed doors, want all %d (and 74 today: three environment ownership doors, instance-token, three door-key doors, the routes door, the regional placements write, instances-manifest, the app update policy, sidecars-manifest, the route-channel move, three instance update settings doors, two db replica doors, the forwarded db read, six fleets, the fleet secrets key door, four services, two email credentials, email pause, the build probe, the swap policy, the interactive setting, two app policy doors, two app region doors, the live tenancy read, the layout read, the activation-cancel door, ten system doors, three deployment-wide antivirus, three platform geoip doors, two pointer digest doors, the hostname history status, the channel resign, two release authorize doors, four store-entitlement doors, two account plan doors, two billing problem doors, and the billing house door)",
seen, len(closedDoors))
}
}
diff --git a/internal/console/testdata/claim-routes.txt b/internal/console/testdata/claim-routes.txt
index f750d19fb..60e241907 100644
--- a/internal/console/testdata/claim-routes.txt
+++ b/internal/console/testdata/claim-routes.txt
@@ -318,6 +318,7 @@ 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}/interactive
route PUT /api/cli/apps/{account}/{app}/pipeline
route PUT /api/cli/apps/{account}/{app}/policy
route PUT /api/cli/apps/{account}/{app}/region
diff --git a/internal/provision/rootfs_apps_6_census_test.go b/internal/provision/rootfs_apps_6_census_test.go
index b9174ebb1..17363b7c2 100644
--- a/internal/provision/rootfs_apps_6_census_test.go
+++ b/internal/provision/rootfs_apps_6_census_test.go
@@ -11,10 +11,17 @@ package provision
// - Task 3: Reconcile calls cfg.InteractiveSeen beside cfg.RunSeen on a
// record with a marker; the same record keys and literal, nothing
// written.
+// - Task 4: Server.registerCLIRoutes registers PUT
+// /api/cli/apps/{account}/{app}/interactive beside the swap door; the
+// same record literals, no record touched. claimRawSetInteractive is the
+// interactive setting's CAS write of the app's config.json
+// (apps/<acct>/<app>/config.json), claimRawSetSwapPolicy's shape: not a
+// record, nonrecord.
func rootfsApps6WriteCensusInventory() []censusEntry {
entries := append([]censusEntry(nil), fleetPublicRoutesWriteCensusInventory()...)
replacements := []censusEntry{
{"internal/provision/reconcile.go", "Reconcile", "key-site", "key:ParseRecordKey,key:RecordKey,lit:instances", "be1b699f14a2f8d6935d959dee168bdf6fb556cd78da458f5ba8a1c0e8512a17"},
+ {"internal/console/authcli.go", "Server.registerCLIRoutes", "key-site", "lit:instances,lit:sidecars", "93f090dcda4e5364f3cff993cebfc1385550039316a59aacaba72ba933ba14b3"},
}
for _, r := range replacements {
found := false
@@ -32,6 +39,7 @@ func rootfsApps6WriteCensusInventory() []censusEntry {
}
added := []censusEntry{
{"internal/provision/interactive.go", "SetRecordInteractive", "record-writer", "key:SetRecordInteractive,key:updateRecord", "f2f8c0ad8647cc048a0be0fa3edc051ddd8e3157eba038123f9e5bab79f4530e"},
+ {"internal/appconfig/interactive.go", "claimRawSetInteractive", "nonrecord", "sel:Put", "d4c768601d1b9bdb44c0fd0c2c6f058c18c1434856e357f00628d2f600ce039b"},
}
for _, a := range added {
for _, e := range entries {
diff --git a/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
index a0b3c1e62..ce24f3163 100644
--- a/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
+++ b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
@@ -1,5 +1,7 @@
# Census overlay rootfs-apps-6, written by census-propose (#369). census-ruling-rootfs-apps-6, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-rootfs-apps-6.md.
-# 1 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 body, 0 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
@legacy 438a9858d01281800b89923ab2c4bf47bba5c3eab23e07fe43af9a5e3a9ae755 internal/provision/reconcile.go Reconcile legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), from its reconcile loops: each listed record is observed through the box's lifetime judge (ObserveWith: the record, then its host incarnation slot) before the shape, channel and scope checks, a stale record is left out and an unjudgeable one protected; the removal phase observes a row's own record key when the pass holds none for it under that key, and deletes a held row whose record is gone or stale through DeleteIfHold; a nil judge (claims on) is main's body; registry read sites unchanged, offsets moved; fix round 1: the removal phase observes a row's own key only under an account the listing trusts, so a retired or unmaterialised account's row keeps record gone, and the pass arms its own context with the judge; Task 7: under a judge an existing provisioned row of the record's own app and account follows the existing-row rules (heldByVanishedPredecessor and retireHeldPredecessor's DeleteIfHold first, the record then minted on the same pass; the hold; installRowLifetime), each a separate write under the host's hold lock; registry read sites unchanged, offsets moved;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=#328/#329 plan 1 Task 7: the pass reads its apps' policy objects (control/app-policy/<sqid>/<app>.json in the bucket) through the agent's PolicyCache, each verified with ReleasePub by apppolicy.VerifyKey (ed25519 over the policy's own domain line, bound to the account and app, unexpired, not future-dated; anything else is no policy), and carries the columns into its rows. New kinds registry:EgressAllow, registry:Size and registry:PolicyExpiresAt, one site each, all the assignment of a fresh row's columns (nr) from policies.cols; plus one whole:Route site, the existing row handed to policies.forRow. Other read sites unchanged, offsets moved; the agent's own pass, no root decision;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos, from its reconcile loops: after the scan, hands the in-scope records to cfg.Lifetimes (the box's lifetime index): Merge after a failed read or partial listing, Replace after a complete one, nothing on a dry run or with no index; the scan, judge and removal phases unchanged; the same 166 sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 2 and 5 (D5, spec §5.0): a seeded record over a row with a runtime is skipped and logged; a row with a runtime (or a new record with one) takes no seed; runtime and a rootfs row's hibernation are never converged from a record (a mismatch is logged; a record claiming a runtime its row lacks is not applied); reads Runtime of the record and the row; the box writes less; fix wave 1 (ceea6353, whole-branch P1-2): before minting a row for a record with no runtime and no row (both mint paths), the pass reads the app's kind marker once per app per pass (release.ReadAppKindMarker: one GET of the create-only kind.json from the release store s, through freshStore, validated by readAppKindMarker); a rootfs marker leaves the record unmaterialized and logged (an older console stripped its runtime), and a marker that cannot be read defers the mint this pass; a refusal before minting only, registry read sites unchanged, the box writes less; fix wave 2 (whole-branch r2 P1): the kind-marker read and its refusal apply only to a socket-backed instance record (DerivesPaths), so a static or upstream-backed record of a rootfs app, which carries no runtime by design, is minted as before with no read; fewer reads, registry read sites unchanged;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 10: the forward phase on the hub (FleetOwners set): the scan keeps the fleet-placed records it skips and counts records per host; a trash-only marker prefetch; disputed (failed-GET) hosts; armed, a host an in-scope and a fleet record both name is given neither, its journal waits and the removal phase keeps its row (+registry:Account, +registry:App, +registry:Host x2: the collision guard, its log line and report mark); the instance loop leaves a forward host; retirable excludes forward rows. Same record keys; writes only the registry (PutForward, DeleteForward); no bucket write.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 3: in the per-record loop, beside the RunSeen call, calls cfg.InteractiveSeen(rec) when the hook is set and the in-scope record carries an interactive-session marker (rec.Interactive != nil), once per record per pass, before the pass acts on it; the hook is the box worker's non-blocking note (Task 12). Same record keys and literal; no read added (registry read sites unchanged, 178); nothing written by the call registry:Account@36233,registry:Account@37498,registry:Account@55577,registry:Account@55623,registry:Account@56467,registry:Account@56844,registry:Account@57070,registry:Account@57137,registry:Account@57183,registry:Account@57276,registry:Account@57318,registry:Account@57966,registry:Account@58224,registry:Account@58764,registry:Account@58812,registry:Account@59185,registry:Account@59231,registry:Account@59476,registry:Account@59901,registry:Account@60389,registry:Account@61125,registry:Account@61318,registry:Account@61664,registry:Account@62229,registry:App@36206,registry:App@37471,registry:App@55597,registry:App@55635,registry:App@56479,registry:App@56856,registry:App@57082,registry:App@57157,registry:App@57195,registry:App@57296,registry:App@57978,registry:App@58236,registry:App@58776,registry:App@58824,registry:App@59205,registry:App@59243,registry:App@59488,registry:App@59913,registry:App@60401,registry:App@61137,registry:App@61330,registry:App@61676,registry:App@62241,registry:ClaimOwnership@36820,registry:DBPath@45677,registry:DBPath@45692,registry:DBPath@45938,registry:DBPath@46541,registry:DBPath@46554,registry:EgressAllow@35319,registry:Gate@42022,registry:Gate@42162,registry:Gate@42449,registry:Hibernate@40694,registry:Hibernate@40892,registry:Hibernate@40957,registry:Hibernate@41296,registry:Hibernate@41647,registry:Hibernate@41957,registry:HoldOp@60870,registry:HoldOp@60961,registry:HoldOp@61096,registry:HoldOp@61472,registry:Host@26327,registry:Host@55556,registry:Host@56443,registry:Host@56820,registry:Host@56984,registry:Host@57090,registry:Host@57986,registry:Host@58192,registry:Host@59068,registry:Host@59340,registry:Host@59455,registry:Host@59778,registry:Host@59875,registry:Host@60266,registry:Host@60363,registry:Host@60577,registry:Host@60952,registry:Host@61087,registry:Host@61291,registry:Host@61364,registry:Host@61463,registry:Host@61638,registry:Host@61713,registry:Host@61799,registry:Host@62206,registry:Kind@36962,registry:Kind@37225,registry:Kind@45595,registry:Kind@45608,registry:Kind@45718,registry:Kind@45731,registry:Kind@46452,registry:Kind@46463,registry:Kind@54680,registry:Kind@60568,registry:Kind@61078,registry:Kind@61454,registry:Kind@61629,registry:Kind@61790,registry:PolicyExpiresAt@35344,registry:Pool@54766,registry:Provisioned@36182,registry:Provisioned@37447,registry:Provisioned@54725,registry:RateLimit@42535,registry:RateLimit@42686,registry:RateLimit@42973,registry:Region@54755,registry:Replication@41381,registry:Replication@41508,registry:Runtime@28984,registry:Runtime@29162,registry:Runtime@31367,registry:Runtime@40061,registry:Runtime@40115,registry:Runtime@40319,registry:Seed@44075,registry:SeedSource@43558,registry:Size@35335,registry:Socket@45643,registry:Socket@45658,registry:Socket@45955,registry:Socket@46511,registry:Socket@46524,registry:Unit@45561,registry:Unit@45574,registry:Unit@46478,registry:Unit@46489,whole:ClaimOwnership@36823,whole:ClaimOwnership@36840,whole:Route@26309,whole:Route@26320,whole:Route@26338,whole:Route@27619,whole:Route@29479,whole:Route@29486,whole:Route@29526,whole:Route@29887,whole:Route@30225,whole:Route@30672,whole:Route@30723,whole:Route@30760,whole:Route@32432,whole:Route@32641,whole:Route@32980,whole:Route@32989,whole:Route@33035,whole:Route@35268,whole:Route@35827,whole:Route@36298,whole:Route@36308,whole:Route@36665,whole:Route@36672,whole:Route@36740,whole:Route@37063,whole:Route@38096,whole:Route@41047,whole:Route@45787,whole:Route@47373,whole:Route@47418,whole:Route@47428,whole:Route@48298,whole:Route@49325,whole:Route@54791,whole:Route@54939,whole:Route@56036,whole:Route@56395,whole:Route@56777,whole:Route@61551,whole:Route@62136,whole:Route@62186 be1b699f14a2f8d6935d959dee168bdf6fb556cd78da458f5ba8a1c0e8512a17
internal/provision/reconcile.go Reconcile legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), from its reconcile loops: each listed record is observed through the box's lifetime judge (ObserveWith: the record, then its host incarnation slot) before the shape, channel and scope checks, a stale record is left out and an unjudgeable one protected; the removal phase observes a row's own record key when the pass holds none for it under that key, and deletes a held row whose record is gone or stale through DeleteIfHold; a nil judge (claims on) is main's body; registry read sites unchanged, offsets moved; fix round 1: the removal phase observes a row's own key only under an account the listing trusts, so a retired or unmaterialised account's row keeps record gone, and the pass arms its own context with the judge; Task 7: under a judge an existing provisioned row of the record's own app and account follows the existing-row rules (heldByVanishedPredecessor and retireHeldPredecessor's DeleteIfHold first, the record then minted on the same pass; the hold; installRowLifetime), each a separate write under the host's hold lock; registry read sites unchanged, offsets moved;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=#328/#329 plan 1 Task 7: the pass reads its apps' policy objects (control/app-policy/<sqid>/<app>.json in the bucket) through the agent's PolicyCache, each verified with ReleasePub by apppolicy.VerifyKey (ed25519 over the policy's own domain line, bound to the account and app, unexpired, not future-dated; anything else is no policy), and carries the columns into its rows. New kinds registry:EgressAllow, registry:Size and registry:PolicyExpiresAt, one site each, all the assignment of a fresh row's columns (nr) from policies.cols; plus one whole:Route site, the existing row handed to policies.forRow. Other read sites unchanged, offsets moved; the agent's own pass, no root decision;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos, from its reconcile loops: after the scan, hands the in-scope records to cfg.Lifetimes (the box's lifetime index): Merge after a failed read or partial listing, Replace after a complete one, nothing on a dry run or with no index; the scan, judge and removal phases unchanged; the same 166 sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 2 and 5 (D5, spec §5.0): a seeded record over a row with a runtime is skipped and logged; a row with a runtime (or a new record with one) takes no seed; runtime and a rootfs row's hibernation are never converged from a record (a mismatch is logged; a record claiming a runtime its row lacks is not applied); reads Runtime of the record and the row; the box writes less; fix wave 1 (ceea6353, whole-branch P1-2): before minting a row for a record with no runtime and no row (both mint paths), the pass reads the app's kind marker once per app per pass (release.ReadAppKindMarker: one GET of the create-only kind.json from the release store s, through freshStore, validated by readAppKindMarker); a rootfs marker leaves the record unmaterialized and logged (an older console stripped its runtime), and a marker that cannot be read defers the mint this pass; a refusal before minting only, registry read sites unchanged, the box writes less; fix wave 2 (whole-branch r2 P1): the kind-marker read and its refusal apply only to a socket-backed instance record (DerivesPaths), so a static or upstream-backed record of a rootfs app, which carries no runtime by design, is minted as before with no read; fewer reads, registry read sites unchanged;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 10: the forward phase on the hub (FleetOwners set): the scan keeps the fleet-placed records it skips and counts records per host; a trash-only marker prefetch; disputed (failed-GET) hosts; armed, a host an in-scope and a fleet record both name is given neither, its journal waits and the removal phase keeps its row (+registry:Account, +registry:App, +registry:Host x2: the collision guard, its log line and report mark); the instance loop leaves a forward host; retirable excludes forward rows. Same record keys; writes only the registry (PutForward, DeleteForward); no bucket write.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 3: in the per-record loop, beside the RunSeen call, calls cfg.InteractiveSeen(rec) when the hook is set and the in-scope record carries an interactive-session marker (rec.Interactive != nil), once per record per pass, before the pass acts on it; the hook is the box worker's non-blocking note (Task 12). Same record keys and literal; no read added (registry read sites unchanged, 178); nothing written by the call registry:Account@36233,registry:Account@37498,registry:Account@55577,registry:Account@55623,registry:Account@56467,registry:Account@56844,registry:Account@57070,registry:Account@57137,registry:Account@57183,registry:Account@57276,registry:Account@57318,registry:Account@57966,registry:Account@58224,registry:Account@58764,registry:Account@58812,registry:Account@59185,registry:Account@59231,registry:Account@59476,registry:Account@59901,registry:Account@60389,registry:Account@61125,registry:Account@61318,registry:Account@61664,registry:Account@62229,registry:App@36206,registry:App@37471,registry:App@55597,registry:App@55635,registry:App@56479,registry:App@56856,registry:App@57082,registry:App@57157,registry:App@57195,registry:App@57296,registry:App@57978,registry:App@58236,registry:App@58776,registry:App@58824,registry:App@59205,registry:App@59243,registry:App@59488,registry:App@59913,registry:App@60401,registry:App@61137,registry:App@61330,registry:App@61676,registry:App@62241,registry:ClaimOwnership@36820,registry:DBPath@45677,registry:DBPath@45692,registry:DBPath@45938,registry:DBPath@46541,registry:DBPath@46554,registry:EgressAllow@35319,registry:Gate@42022,registry:Gate@42162,registry:Gate@42449,registry:Hibernate@40694,registry:Hibernate@40892,registry:Hibernate@40957,registry:Hibernate@41296,registry:Hibernate@41647,registry:Hibernate@41957,registry:HoldOp@60870,registry:HoldOp@60961,registry:HoldOp@61096,registry:HoldOp@61472,registry:Host@26327,registry:Host@55556,registry:Host@56443,registry:Host@56820,registry:Host@56984,registry:Host@57090,registry:Host@57986,registry:Host@58192,registry:Host@59068,registry:Host@59340,registry:Host@59455,registry:Host@59778,registry:Host@59875,registry:Host@60266,registry:Host@60363,registry:Host@60577,registry:Host@60952,registry:Host@61087,registry:Host@61291,registry:Host@61364,registry:Host@61463,registry:Host@61638,registry:Host@61713,registry:Host@61799,registry:Host@62206,registry:Kind@36962,registry:Kind@37225,registry:Kind@45595,registry:Kind@45608,registry:Kind@45718,registry:Kind@45731,registry:Kind@46452,registry:Kind@46463,registry:Kind@54680,registry:Kind@60568,registry:Kind@61078,registry:Kind@61454,registry:Kind@61629,registry:Kind@61790,registry:PolicyExpiresAt@35344,registry:Pool@54766,registry:Provisioned@36182,registry:Provisioned@37447,registry:Provisioned@54725,registry:RateLimit@42535,registry:RateLimit@42686,registry:RateLimit@42973,registry:Region@54755,registry:Replication@41381,registry:Replication@41508,registry:Runtime@28984,registry:Runtime@29162,registry:Runtime@31367,registry:Runtime@40061,registry:Runtime@40115,registry:Runtime@40319,registry:Seed@44075,registry:SeedSource@43558,registry:Size@35335,registry:Socket@45643,registry:Socket@45658,registry:Socket@45955,registry:Socket@46511,registry:Socket@46524,registry:Unit@45561,registry:Unit@45574,registry:Unit@46478,registry:Unit@46489,whole:ClaimOwnership@36823,whole:ClaimOwnership@36840,whole:Route@26309,whole:Route@26320,whole:Route@26338,whole:Route@27619,whole:Route@29479,whole:Route@29486,whole:Route@29526,whole:Route@29887,whole:Route@30225,whole:Route@30672,whole:Route@30723,whole:Route@30760,whole:Route@32432,whole:Route@32641,whole:Route@32980,whole:Route@32989,whole:Route@33035,whole:Route@35268,whole:Route@35827,whole:Route@36298,whole:Route@36308,whole:Route@36665,whole:Route@36672,whole:Route@36740,whole:Route@37063,whole:Route@38096,whole:Route@41047,whole:Route@45787,whole:Route@47373,whole:Route@47418,whole:Route@47428,whole:Route@48298,whole:Route@49325,whole:Route@54791,whole:Route@54939,whole:Route@56036,whole:Route@56395,whole:Route@56777,whole:Route@61551,whole:Route@62136,whole:Route@62186 be1b699f14a2f8d6935d959dee168bdf6fb556cd78da458f5ba8a1c0e8512a17
+@coverage . fbc28f10f89cd03cac31bae0d798ae7f707eb7671284a6115abd8c1c214369b6
+@coverage internal/appconfig cac8d8ef7538a456d034801c95ce6508a4983e5516b3bbbd302bec0fbafdd479
@coverage internal/provision e1ecfdc3d169773ac6dd9dc09a6d0feea768ceb1b80195199c5ef74b2f0e6f5c