provision: the interactive session marker and reconcile's hook (rootfs plan 6)
Record.Interactive (beside ActiveRun) is written only by InteractiveAdmit and InteractiveClear through SetRecordInteractive, which is updateRecord as SetRecordRun is, so it reads and writes under the lifetime judge when the context carries one. Admission order: malformed, a move in flight (ErrRunMoving), a live marker (*InteractiveOpenError), an uncommitted import (ErrRunImport); a dead marker is replaced. Sessions refuse neither runs nor moves. ReconcileConfig.InteractiveSeen is called beside RunSeen. Census: root-read overlay plan14-root-reads-rootfs-apps-6.tsv (Reconcile body, provision envelope; card in docs/superpowers/notes), awaiting the reviewer's approval on #280. Record-write census: SetRecordInteractive listed as a typed writer and in censusKeyExact; Reconcile re-pinned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/census-proposal-rootfs-apps-6.md+19 −0internal/provision/interactive.go+89 −0internal/provision/interactive_test.go+311 −0internal/provision/plan9_b8_census_test.go+2 −2internal/provision/provision.go+7 −0internal/provision/reconcile.go+7 −0internal/provision/rootfs_apps_6_census_test.go+44 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv+5 −0
Intent
<task-notification> <task-id>a6df1701ef5c7b658</task-id> <tool-use-id>toolu_015GZu1HB9Ctams4BW8hLWMi</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/a6df1701ef5c7b658.output</output-file> <status>completed</status> <summary>Agent "Write the Plan 6 amendment" 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>Rev 4 and Paul's copy review are both applied and pushed. The tip is `de4246b9e3a2f0b2ae794cb3232c376bbf2d2b49`, confirmed with `ls-remote`. There are two commits: `084289de` (plan rev 4, with Astra's round 3 findings file) and `de4246b9` (the copy). The plan has an "Amendment rev 4" section recording the one P1 with one cause (the test harness), fixed without a fourth round by the platform-60 ruling. The copy gate passes now, including the two tests that were red. I ran `TestRootfsCopy*`, `TestRootfsBuilt*`, `TestPlan3CopyGroups`, `TestZeroDowntimeCopyIsApplied` and `TestInstancePolicyCopyIsApplied`. **Round 3 findings** - **P1, the real-CLI expiry witnesses couldn't compile where the plan put them: fixed with Astra's narrower remedy.** - The two witnesses move into the root package (`run_cutover_witness_test.go`, `package main`), because that's where `followRun` lives. They build the console the way `auth_e2e_test.go` already does. - They reach the console through three controls in `internal/console/cutover_witness_controls.go`, one each for the gate's clock, a watch pass and a sweep pass. Each only forwards to the production function. - Both files carry the build tag `carlos_cutover_witness`, which nothing else uses. - The controls reuse the existing `UseSQLInstanceIdentityForTest` pattern in `internal/console/claim_sql_instance.go`: an exported `…ForTest` function that panics outside a test binary. - Task 16 also adds one job to `.amadan/test-gate.sh`. The gate passes no build tags, so without that job the tagged witnesses would never run. That script counts as a census unit. - A new test, `TestCutoverWitnessControlsAreTagged`, holds the tag and checks each control only forwards. - Both winner cases stay deterministic: the sweep wins while the CLI's expire request is held, and the CLI wins when no sweep runs before it. - **P2, Task 16's budget: fixed.** It now includes the relay's `request.json` read, so a fleet run costs 13 requests with lifetimes on and 11 with them off, beyond its output chunks. The run traffic that already exists (admission, the CLI's polls, expire, cancel and ack, and audit rows) is named as outside that count. - **P2, Task 10's no-redial claim: corrected, and the existing guarantee made explicit.** The agent's memory of which sessions it has dialled is lost on restart, so before the pickup deadline a restarted agent can dial again. What stops a second launch is the console's box door. It only connects a box to a session that is still open and not already attached; an ended or unknown session gets a 404, so the box never receives the open request and never starts the command. I chose to state and test that guarantee rather than add persisted agent state, because it already holds across both agent and console restarts. New tests: `TestBoxDoorRefusesAnEndedSessionBeforeItsPickupBy` (Task 11) and `TestARestartedWorkerCannotRelaunchAnEndedSession` (Task 12). **Copy** - RFS-6-C47 and RFS-6-C65 are now approved in the deck, unchanged. The deck's header and counts and the plan's string table say so. - The gate's id list `rootfsCopyIDs` in `approved_rootfs_copy_test.go` gains "RFS-6-C65". That is the only code change, as instructed. Neither row is built yet: Task 4 builds C47 and Task 13 builds C65.</result> <usage><subagent_tokens>574565</subagent_tokens><tool_uses>26</tool_uses><duration_ms>240022</duration_ms></usage> </task-notification>
<task-notification> <task-id>acc20219576b7e9f3</task-id> <tool-use-id>toolu_018H2N96Wt6K4wtrJrdZHWWx</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/acc20219576b7e9f3.output</output-file> <status>completed</status> <summary>Agent "#471 Task 2: hub RoundTripUpgrade" 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. The concerns are notes for Tasks 3 and 5; none blocks Task 2. Commit: `0e59cb97`, "tunnelclient: the hub half of tunnel WebSockets (#471 Task 2)". Not pushed. It changes `internal/tunnelclient/upgrade.go`, adds `internal/tunnelclient/upgrade_hub_test.go`, and reconciles spec §7 with the census card. Nothing calls `RoundTripUpgrade` yet, so upgrades stay refused at the hub until Task 5. Tests: all 23 tests in `internal/tunnelclient` pass with `-race` (7 of them new), and the new ones pass 30 times in a row under `-race`. Every new test failed first. Nine mutations each make a test fail, including the brief's (skip the token check on the in-band 101, and the `h2c` case fails). The edge tests `TestTunnel` and `TestFleet` still pass, and build, vet, gofmt and the darwin, windows and linux/arm64 cross-builds are clean. Task 1's carry is tested: the box writes 5 MiB that the hub never reads, and after the hub's `Close` that blocked write fails within 1 s and the box handler returns. The census card adds one unit, `UpgradeConn.Read`. Like Task 1's `upgradedConn.Read`, the scanner flags it only because of the name `Read`; the seal is unchanged. Concerns (full detail in `task-2-report.md`): 1. **I added context handling the brief did not ask for.** x/net does not watch the request's context while the request body is still open, so cancelling the context after the 101, or during the in-band read, did nothing. Spec §4.6.2 has the reservation's release cancel the stream context, so I made `RoundTripUpgrade` reset the stream itself when its context ends. A new test covers it (`TestRoundTripUpgradeEndsWithItsContext`), with a mutation that makes it fail. It needed one test-only hook, `hookHandshake`, which is nil in production. Task 3 should pass the reservation's context in. 2. **A marker on a non-200 response is still read as an upgrade.** The brief only says to look for the marker, and the box shim only ever marks a 200, so I added no stricter status check. 3. **`Close` can wait on a stuck tunnel.** It waits for x/net to finish the stream, so on a stuck tunnel it can take about 10 s, until the ping kills the connection. Ordinary request bodies behave the same today. 4. **On a refusal, the pipe is closed straight away**, which sends end-of-stream to the box. The response itself comes back unchanged. Report: `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-tunnel-websockets-471/.superpowers/sdd/2026-10-30-tunnel-websockets/task-2-report.md`</result> <usage><subagent_tokens>153285</subagent_tokens><tool_uses>43</tool_uses><duration_ms>1078372</duration_ms></usage> </task-notification>
Attributed to this commit: 63.9 g CO₂e (8,332,250 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/docs/superpowers/notes/census-proposal-rootfs-apps-6.md b/docs/superpowers/notes/census-proposal-rootfs-apps-6.md| new file mode 100644 |
| index 000000000..6749b970d |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-rootfs-apps-6.md |
| @@ -0,0 +1,19 @@ |
| +# Census approval: rootfs-apps-6 |
| + |
| +Ruling `census-ruling-rootfs-apps-6`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `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`. |
| + |
| +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. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/provision/reconcile.go` `Reconcile`: legacy, task accepted-legacy. Basis: 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. |
| + |
| +Seal: `1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7` → `d62fb15b639f48fde409606adcd630322d8c4b8cc5937ea9a257a4969ddc8f5a`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/provision/interactive.go b/internal/provision/interactive.go| new file mode 100644 |
| index 000000000..5961ca1db |
| --- /dev/null |
| +++ b/internal/provision/interactive.go |
| @@ -0,0 +1,89 @@ |
| +package provision |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "fmt" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +// InteractiveState is the record's interactive-session marker (rootfs apps |
| +// spec §5.10, C9): the one session open on the instance, the caller who |
| +// opened it, the console process that admitted it and the time by which a |
| +// box must pick it up. Only the Interactive* transitions below write it; |
| +// ordinary writers carry it through unchanged. |
| +type InteractiveState struct { |
| + ID string `json:"id"` |
| + By string `json:"by,omitempty"` |
| + Console string `json:"console"` // the admitting console process's boot id |
| + PickupBy time.Time `json:"pickup_by"` |
| +} |
| + |
| +// InteractiveAdmission is what the console decided for a new session. |
| +type InteractiveAdmission struct { |
| + ID, By, Console string |
| + PickupBy time.Time |
| + // Live reports whether an existing marker is a session this console |
| + // still holds. nil means every existing marker is live. |
| + Live func(InteractiveState) bool |
| +} |
| + |
| +var ( |
| + // ErrInteractiveOpen: a session is open on the instance. An |
| + // InteractiveOpenError carries it. |
| + ErrInteractiveOpen = errors.New("provision: an interactive session is open on the instance") |
| + // ErrInteractiveConflict: the admission is malformed, or the record's |
| + // marker is not the session the transition names. |
| + ErrInteractiveConflict = errors.New("provision: interactive session state conflict") |
| +) |
| + |
| +// InteractiveOpenError is a refusal because State holds the instance. |
| +type InteractiveOpenError struct{ State InteractiveState } |
| + |
| +func (e *InteractiveOpenError) Error() string { return ErrInteractiveOpen.Error() + ": " + e.State.ID } |
| +func (e *InteractiveOpenError) Is(target error) bool { return target == ErrInteractiveOpen } |
| + |
| +// SetRecordInteractive applies one session transition under the record's |
| +// ETag, with updateRecord's one retry, as SetRecordRun does: the transition |
| +// re-checks the marker on the fresh read, so a lost race refuses rather than |
| +// overwrites. Under provision.WithLifetimes the read and the write go |
| +// through the lifetime judge. |
| +func SetRecordInteractive(ctx context.Context, s release.Store, acct, app, host string, mut func(*Record) error) (*Record, error) { |
| + return updateRecord(ctx, s, acct, app, host, mut) |
| +} |
| + |
| +// InteractiveAdmit sets the marker for a new session. In order: a malformed |
| +// admission is ErrInteractiveConflict; a move in flight is ErrRunMoving; a |
| +// live marker is *InteractiveOpenError; an uncommitted import is |
| +// ErrRunImport. Otherwise the marker is set, replacing a dead one. An open |
| +// run does not refuse a session. |
| +func InteractiveAdmit(p InteractiveAdmission) func(*Record) error { |
| + return func(rec *Record) error { |
| + switch { |
| + case p.ID == "" || p.Console == "" || p.PickupBy.IsZero(): |
| + return fmt.Errorf("%w: malformed admission", ErrInteractiveConflict) |
| + case rec.Move != nil: |
| + return ErrRunMoving |
| + case rec.Interactive != nil && (p.Live == nil || p.Live(*rec.Interactive)): |
| + return &InteractiveOpenError{State: *rec.Interactive} |
| + case rec.ImportUncommitted(): |
| + return ErrRunImport |
| + } |
| + rec.Interactive = &InteractiveState{ID: p.ID, By: p.By, Console: p.Console, PickupBy: p.PickupBy.UTC()} |
| + return nil |
| + } |
| +} |
| + |
| +// InteractiveClear removes the marker when it names id, and is |
| +// ErrInteractiveConflict otherwise (absent, or another session's). |
| +func InteractiveClear(id string) func(*Record) error { |
| + return func(rec *Record) error { |
| + if id == "" || rec.Interactive == nil || rec.Interactive.ID != id { |
| + return ErrInteractiveConflict |
| + } |
| + rec.Interactive = nil |
| + return nil |
| + } |
| +} |
diff --git a/internal/provision/interactive_test.go b/internal/provision/interactive_test.go| new file mode 100644 |
| index 000000000..509983b5f |
| --- /dev/null |
| +++ b/internal/provision/interactive_test.go |
| @@ -0,0 +1,311 @@ |
| +package provision |
| + |
| +import ( |
| + "bytes" |
| + "context" |
| + "encoding/json" |
| + "errors" |
| + "os" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/release" |
| + "github.com/carlosframework/platform/internal/seeds" |
| +) |
| + |
| +const ( |
| + ttyA = "tty_aaaaaaaaaaaaaaaaaaaaaaaaaa" |
| + ttyB = "tty_bbbbbbbbbbbbbbbbbbbbbbbbbb" |
| +) |
| + |
| +func interactiveTestRecord(t *testing.T, s release.Store) Record { |
| + t.Helper() |
| + rec := Record{Schema: 1, Host: "a.shop.example.com", Slug: "a", App: "shop", Account: "bah", Region: "ie", Channel: "stable", CreatedAt: time.Now().UTC()} |
| + if err := CreateRecord(context.Background(), s, rec); err != nil { |
| + t.Fatal(err) |
| + } |
| + return rec |
| +} |
| + |
| +func setInteractive(t *testing.T, s release.Store, rec Record, mut func(*Record) error) (*Record, error) { |
| + t.Helper() |
| + return SetRecordInteractive(context.Background(), s, rec.Account, rec.App, rec.Host, mut) |
| +} |
| + |
| +func admission(id string) InteractiveAdmission { |
| + return InteractiveAdmission{ID: id, By: "alice@example.com", Console: "boot-1", PickupBy: time.Date(2026, 10, 30, 13, 0, 0, 0, time.FixedZone("CET", 3600))} |
| +} |
| + |
| +// recordField is the record's raw JSON for key, "" when absent. |
| +func recordField(t *testing.T, s release.Store, rec Record, key string) string { |
| + t.Helper() |
| + raw, _, err := s.Get(context.Background(), RecordKey(rec.Account, rec.App, rec.Host)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var m map[string]json.RawMessage |
| + if err := json.Unmarshal(raw, &m); err != nil { |
| + t.Fatal(err) |
| + } |
| + return string(m[key]) |
| +} |
| + |
| +func TestInteractiveAdmitAndClear(t *testing.T) { |
| + s := release.NewDirStore(t.TempDir()) |
| + rec := interactiveTestRecord(t, s) |
| + got, err := setInteractive(t, s, rec, InteractiveAdmit(admission(ttyA))) |
| + if err != nil || got.Interactive == nil || got.Interactive.ID != ttyA || got.Interactive.Console != "boot-1" { |
| + t.Fatalf("admit: %+v, %v", got, err) |
| + } |
| + want := `{"id":"` + ttyA + `","by":"alice@example.com","console":"boot-1","pickup_by":"2026-10-30T12:00:00Z"}` |
| + if f := recordField(t, s, rec, "interactive"); f != want { |
| + t.Fatalf("interactive = %s, want %s", f, want) |
| + } |
| + if _, err := setInteractive(t, s, rec, InteractiveClear(ttyB)); !errors.Is(err, ErrInteractiveConflict) { |
| + t.Fatalf("clearing another session's marker: %v, want ErrInteractiveConflict", err) |
| + } |
| + if f := recordField(t, s, rec, "interactive"); f != want { |
| + t.Fatalf("a refused clear changed the marker: %s", f) |
| + } |
| + if _, err := setInteractive(t, s, rec, InteractiveClear(ttyA)); err != nil { |
| + t.Fatalf("clear: %v", err) |
| + } |
| + if f := recordField(t, s, rec, "interactive"); f != "" { |
| + t.Fatalf("interactive after clear = %s, want absent", f) |
| + } |
| + if _, err := setInteractive(t, s, rec, InteractiveClear(ttyA)); !errors.Is(err, ErrInteractiveConflict) { |
| + t.Fatalf("clearing an absent marker: %v, want ErrInteractiveConflict", err) |
| + } |
| + for name, p := range map[string]InteractiveAdmission{ |
| + "no id": {By: "alice@example.com", Console: "boot-1", PickupBy: time.Now()}, |
| + "no console": {ID: ttyA, By: "alice@example.com", PickupBy: time.Now()}, |
| + "no pickup by": {ID: ttyA, By: "alice@example.com", Console: "boot-1"}, |
| + } { |
| + if _, err := setInteractive(t, s, rec, InteractiveAdmit(p)); !errors.Is(err, ErrInteractiveConflict) { |
| + t.Errorf("%s: %v, want ErrInteractiveConflict", name, err) |
| + } |
| + } |
| + if f := recordField(t, s, rec, "interactive"); f != "" { |
| + t.Fatalf("a malformed admission wrote %s", f) |
| + } |
| +} |
| + |
| +func TestInteractiveAdmitRefusesALiveMarkerAndReplacesADeadOne(t *testing.T) { |
| + s := release.NewDirStore(t.TempDir()) |
| + rec := interactiveTestRecord(t, s) |
| + if _, err := setInteractive(t, s, rec, InteractiveAdmit(admission(ttyA))); err != nil { |
| + t.Fatal(err) |
| + } |
| + var asked []string |
| + live := func(v bool) func(InteractiveState) bool { |
| + return func(st InteractiveState) bool { asked = append(asked, st.ID); return v } |
| + } |
| + for name, l := range map[string]func(InteractiveState) bool{"nil Live": nil, "Live true": live(true)} { |
| + p := admission(ttyB) |
| + p.Live = l |
| + _, err := setInteractive(t, s, rec, InteractiveAdmit(p)) |
| + var open *InteractiveOpenError |
| + if !errors.Is(err, ErrInteractiveOpen) || !errors.As(err, &open) || open.State.ID != ttyA || open.State.By != "alice@example.com" { |
| + t.Fatalf("%s: %v, want *InteractiveOpenError naming %s and its caller", name, err, ttyA) |
| + } |
| + } |
| + if len(asked) != 1 || asked[0] != ttyA { |
| + t.Fatalf("Live was asked about %q", asked) |
| + } |
| + if got, _, err := GetRecordETag(context.Background(), s, rec.Account, rec.App, rec.Host); err != nil || got.Interactive.ID != ttyA { |
| + t.Fatalf("a refused admission changed the marker: %+v, %v", got.Interactive, err) |
| + } |
| + p := admission(ttyB) |
| + p.By, p.Console = "bob@example.com", "boot-2" |
| + p.Live = live(false) |
| + got, err := setInteractive(t, s, rec, InteractiveAdmit(p)) |
| + if err != nil || got.Interactive.ID != ttyB || got.Interactive.By != "bob@example.com" || got.Interactive.Console != "boot-2" { |
| + t.Fatalf("replacing a dead marker: %+v, %v", got, err) |
| + } |
| + if f := recordField(t, s, rec, "interactive"); !strings.Contains(f, `"id":"`+ttyB+`"`) { |
| + t.Fatalf("stored marker %s, want %s", f, ttyB) |
| + } |
| +} |
| + |
| +func TestInteractiveAdmitRefusesMovesAndImports(t *testing.T) { |
| + s := release.NewDirStore(t.TempDir()) |
| + rec := interactiveTestRecord(t, s) |
| + if _, err := SetRecordMove(context.Background(), s, rec.Account, rec.App, rec.Host, MoveRequest("uk", time.Now())); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := setInteractive(t, s, rec, InteractiveAdmit(admission(ttyA))); !errors.Is(err, ErrRunMoving) { |
| + t.Fatalf("admit while moving: %v, want ErrRunMoving", err) |
| + } |
| + // A malformed admission is refused as malformed first, whatever the record says. |
| + if _, err := setInteractive(t, s, rec, InteractiveAdmit(InteractiveAdmission{ID: ttyA})); !errors.Is(err, ErrInteractiveConflict) { |
| + t.Fatalf("malformed admission while moving: %v, want ErrInteractiveConflict", err) |
| + } |
| + |
| + // An import walks its path by the seed transitions; admission is tried |
| + // at each state on the way, and the committed state is the control. |
| + s2 := release.NewDirStore(t.TempDir()) |
| + seedID, err := seeds.NewID() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + imp := Record{Schema: 1, Host: "a.shop.example.com", Slug: "a", App: "shop", Account: "bah", Region: "ie", Channel: "stable", CreatedAt: time.Now().UTC(), |
| + Seed: &SeedSource{ID: seedID, Kind: seeds.KindImport, State: seeds.StateAwaitingUpload}} |
| + if err := CreateRecord(context.Background(), s2, imp); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := setInteractive(t, s2, imp, InteractiveAdmit(admission(ttyA))); !errors.Is(err, ErrRunImport) { |
| + t.Errorf("import awaiting upload: %v, want ErrRunImport", err) |
| + } |
| + for _, step := range []struct { |
| + mut func(*Record) error |
| + state string |
| + refused bool |
| + }{ |
| + {SeedUploaded(seedID), seeds.StateUploaded, true}, |
| + {SeedStopped(seedID), seeds.StateReady, true}, |
| + {SeedSwapped(seedID), seeds.StateSwapped, true}, |
| + {SeedPlace(seedID), seeds.StatePlaced, true}, |
| + {SeedCommit(seedID), seeds.StateCommitted, false}, |
| + } { |
| + if _, err := SetRecordSeed(context.Background(), s2, imp.Account, imp.App, imp.Host, step.mut); err != nil { |
| + t.Fatalf("to %s: %v", step.state, err) |
| + } |
| + _, err := setInteractive(t, s2, imp, InteractiveAdmit(admission(ttyA))) |
| + if step.refused != errors.Is(err, ErrRunImport) || (!step.refused && err != nil) { |
| + t.Errorf("import %s: err %v, refused want %v", step.state, err, step.refused) |
| + } |
| + } |
| +} |
| + |
| +// Sessions do not refuse runs or moves: an open run does not refuse a |
| +// session, and a marker does not refuse a move. |
| +func TestInteractiveDoesNotBlockAnOpenRunOrAMove(t *testing.T) { |
| + s := release.NewDirStore(t.TempDir()) |
| + rec := interactiveTestRecord(t, s) |
| + if _, err := SetRecordRun(context.Background(), s, rec.Account, rec.App, rec.Host, RunAdmit(RunAdmission{ID: "run_a", Deadline: time.Now().Add(time.Minute)})); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := setInteractive(t, s, rec, InteractiveAdmit(admission(ttyA))); err != nil { |
| + t.Fatalf("admit beside a queued run: %v", err) |
| + } |
| + if _, err := SetRecordRun(context.Background(), s, rec.Account, rec.App, rec.Host, RunExpire("run_a")); err != nil { |
| + t.Fatal(err) |
| + } |
| + got, err := SetRecordMove(context.Background(), s, rec.Account, rec.App, rec.Host, MoveRequest("uk", time.Now())) |
| + if err != nil || got.Move == nil { |
| + t.Fatalf("a move with a marker present: %+v, %v", got, err) |
| + } |
| + if got.Interactive == nil || got.Interactive.ID != ttyA { |
| + t.Fatalf("the move dropped the marker: %+v", got.Interactive) |
| + } |
| +} |
| + |
| +// Ordinary record writers carry the marker through unchanged, as they carry |
| +// the run (TestOrdinaryWritersCarryActiveRun). |
| +func TestOrdinaryWritersCarryInteractive(t *testing.T) { |
| + s := release.NewDirStore(t.TempDir()) |
| + rec := interactiveTestRecord(t, s) |
| + if _, err := setInteractive(t, s, rec, InteractiveAdmit(admission(ttyA))); err != nil { |
| + t.Fatal(err) |
| + } |
| + want := recordField(t, s, rec, "interactive") |
| + if !strings.Contains(want, `"id":"`+ttyA+`"`) { |
| + t.Fatalf("interactive = %s", want) |
| + } |
| + if err := SetRecordRegion(context.Background(), s, rec.Account, rec.App, rec.Host, "uk"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if got := recordField(t, s, rec, "interactive"); got != want { |
| + t.Fatalf("SetRecordRegion: interactive %s, want %s", got, want) |
| + } |
| + cur, etag, err := GetRecordETag(context.Background(), s, rec.Account, rec.App, rec.Host) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + cur.Channel = "beta" |
| + if err := UpdateRecord(context.Background(), s, *cur, etag); err != nil { |
| + t.Fatal(err) |
| + } |
| + if got := recordField(t, s, rec, "interactive"); got != want { |
| + t.Fatalf("UpdateRecord: interactive %s, want %s", got, want) |
| + } |
| + if got := recordField(t, s, rec, "channel"); got != `"beta"` { |
| + t.Fatalf("control: UpdateRecord did not write: channel %s", got) |
| + } |
| +} |
| + |
| +// SetRecordInteractive reads and writes through the lifetime judge when the |
| +// context carries one: a record its host incarnation slot no longer vouches |
| +// for is refused as TestUpdateRecordRefusesAStaleRecordUnderAJudge refuses |
| +// it, and its bytes are unchanged. A vouched record and an unjudged context |
| +// are the controls. |
| +func TestSetRecordInteractiveIsJudged(t *testing.T) { |
| + for _, mode := range []string{"stale", "vouched", "legacy"} { |
| + t.Run(mode, func(t *testing.T) { |
| + base := release.NewDirStore(t.TempDir()) |
| + rec := Record{Schema: 1, Account: "bah", App: "shop", Host: judgeHost, Channel: "edge", Environment: "production", Incarnation: 1} |
| + raw, tag := judgePut(t, base, RecordKey("bah", "shop", judgeHost), rec) |
| + slot := HostIncarnation{Account: "bah", App: "shop", Incarnation: 1, State: SlotLive} |
| + if mode != "vouched" { |
| + slot.Incarnation = 2 |
| + } |
| + judgePut(t, base, HostIncarnationKey(judgeHost), slot) |
| + s := &judgeStore{Store: base} |
| + ctx := context.Background() |
| + if mode != "legacy" { |
| + ctx = WithLifetimes(ctx, NewLifetimeJudge()) |
| + } |
| + got, err := SetRecordInteractive(ctx, s, "bah", "shop", judgeHost, InteractiveAdmit(admission(ttyA))) |
| + after, afterTag, _ := base.Get(context.Background(), RecordKey("bah", "shop", judgeHost)) |
| + if mode == "stale" { |
| + if !errors.Is(err, os.ErrNotExist) || s.puts != 0 || !bytes.Equal(after, raw) || afterTag != tag { |
| + t.Fatalf("stale record mutated: %v puts %d", err, s.puts) |
| + } |
| + return |
| + } |
| + if err != nil || s.puts != 1 || got.Interactive == nil || got.Interactive.ID != ttyA || bytes.Equal(after, raw) { |
| + t.Fatalf("%s: %+v, %v, puts %d", mode, got, err, s.puts) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// Reconcile's pass hands each in-scope record that carries a marker to |
| +// InteractiveSeen once, and no other record. |
| +func TestReconcileCallsInteractiveSeen(t *testing.T) { |
| + s, sqid := setup(t) |
| + shopRecord := func(host, slug string) Record { |
| + rec := acmeRecord(sqid) |
| + rec.Host, rec.Slug, rec.App, rec.Pool = host, slug, "shop", "shared" |
| + return rec |
| + } |
| + marker := &InteractiveState{ID: ttyA, Console: "boot-1", PickupBy: time.Now().Add(time.Minute).UTC()} |
| + withMarker := shopRecord("acme.example.com", "acme") |
| + withMarker.Interactive = marker |
| + plain := shopRecord("plain.example.com", "plain") |
| + withRun := shopRecord("run.example.com", "run") |
| + withRun.ActiveRun = &RunState{ID: "run_abcdefghijklmnopqrstuvwxyz", State: RunQueued, Deadline: time.Now().Add(time.Minute)} |
| + away := shopRecord("away.example.com", "away") |
| + away.Region = "uk" |
| + away.Interactive = marker |
| + for _, rec := range []Record{withMarker, plain, withRun, away} { |
| + if err := CreateRecord(ctx, s, rec); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + var seen, runs []string |
| + cfg := ReconcileConfig{Region: "ie", Pools: []string{"shared"}, DataDir: "/data", |
| + InteractiveSeen: func(rec Record) { seen = append(seen, rec.Host+":"+rec.Interactive.ID) }, |
| + RunSeen: func(rec Record) { runs = append(runs, rec.Host) }, |
| + } |
| + if err := Reconcile(ctx, s, regWith(t), cfg); err != nil { |
| + t.Fatal(err) |
| + } |
| + if len(seen) != 1 || seen[0] != "acme.example.com:"+ttyA { |
| + t.Fatalf("InteractiveSeen saw %q", seen) |
| + } |
| + if len(runs) != 1 || runs[0] != "run.example.com" { |
| + t.Fatalf("control: RunSeen saw %q", runs) |
| + } |
| +} |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index 893794f4d..a0cf63e8f 100644 |
| --- a/internal/provision/plan9_b8_census_test.go |
| +++ b/internal/provision/plan9_b8_census_test.go |
| @@ -53,7 +53,7 @@ var censusMethods = map[string]bool{ |
| // typed-record-writer touchpoint. Keep these names aligned with the APIs above. |
| var ( |
| censusKeySuffixes = []string{"recordkey", "recordsprefix", "sidecarsprefix", "sidecarkey", "sidecarmanifestkey", "writerecord", "sequencedrecord"} |
| - censusKeyExact = map[string]bool{"createrecord": true, "updaterecord": true, "setrecordregion": true, "setrecordmove": true, "setrecordrun": true, "setrecordseed": true, "setrecordassetgen": true, "mintrecordassetgen": true, "createsidecarrecord": true, "claimrawupdaterecord": true} |
| + censusKeyExact = map[string]bool{"createrecord": true, "updaterecord": true, "setrecordregion": true, "setrecordmove": true, "setrecordrun": true, "setrecordinteractive": true, "setrecordseed": true, "setrecordassetgen": true, "mintrecordassetgen": true, "createsidecarrecord": true, "claimrawupdaterecord": true} |
| censusLitWords = []string{"instances", "sidecars"} |
| ) |
| @@ -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 := fleetPublicRoutesWriteCensusInventory() |
| + inventory := rootfsApps6WriteCensusInventory() |
| 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/provision.go b/internal/provision/provision.go| index 1c1f147b0..c8b9a49ce 100644 |
| --- a/internal/provision/provision.go |
| +++ b/internal/provision/provision.go |
| @@ -85,6 +85,13 @@ type Record struct { |
| // (run.go) write it. Additive and omitempty. |
| ActiveRun *RunState `json:"run,omitempty"` |
| + // Interactive is the instance's open interactive session, if any |
| + // (rootfs apps spec §5.10): written only by the Interactive* |
| + // transitions (interactive.go) through SetRecordInteractive; ordinary |
| + // writers carry it through unchanged. A session refuses neither a run |
| + // nor a move. Additive and omitempty. |
| + Interactive *InteractiveState `json:"interactive,omitempty"` |
| + |
| // RunKeys is the instance's recent keyed run admissions (service runs |
| // spec § 3): each Idempotency-Key, scoped to its caller and hashed, |
| // with the run it admitted. RunAdmit writes it in the same |
diff --git a/internal/provision/reconcile.go b/internal/provision/reconcile.go| index 6840c3cd6..b00e5f152 100644 |
| --- a/internal/provision/reconcile.go |
| +++ b/internal/provision/reconcile.go |
| @@ -133,6 +133,10 @@ type ReconcileConfig struct { |
| // notes the record and acts after the pass, by which time a row this |
| // pass minted is in the registry. Nil: no one is told. |
| RunSeen func(rec Record) |
| + // InteractiveSeen is called like RunSeen, with every in-scope record of |
| + // an untrashed app that carries an interactive-session marker (rootfs |
| + // apps spec §5.10). It must not block. Nil: no one is told. |
| + InteractiveSeen func(rec Record) |
| // Seeds is the seeded-instances wiring (seedreconcile.go). Nil: every |
| // seeded record is left alone. |
| Seeds *SeedHooks |
| @@ -1662,6 +1666,9 @@ func Reconcile(ctx context.Context, s release.Store, reg *registry.Registry, cfg |
| if cfg.RunSeen != nil && rec.ActiveRun != nil { |
| cfg.RunSeen(rec) |
| } |
| + if cfg.InteractiveSeen != nil && rec.Interactive != nil { |
| + cfg.InteractiveSeen(rec) |
| + } |
| existing, ok := byHost[rec.Host] |
| // A forward row at the host is the forward phase's (fleet public |
| // routes spec §4.3): the record moved here from a fleet, and the |
diff --git a/internal/provision/rootfs_apps_6_census_test.go b/internal/provision/rootfs_apps_6_census_test.go| new file mode 100644 |
| index 000000000..b9174ebb1 |
| --- /dev/null |
| +++ b/internal/provision/rootfs_apps_6_census_test.go |
| @@ -0,0 +1,44 @@ |
| +package provision |
| + |
| +// Record-write census entries for rootfs apps Plan 6 (interactive sessions), |
| +// layered on fleetPublicRoutesWriteCensusInventory (the branch base). |
| +// Reviewed by the branch author; the branch's task reviewers re-read them. |
| +// - Task 3: SetRecordInteractive is a new typed record writer, one call |
| +// of updateRecord exactly as SetRecordRun is, so it reads and writes |
| +// under the lifetime judge when the context carries one |
| +// (TestSetRecordInteractiveIsJudged). "setrecordinteractive" joins |
| +// censusKeyExact so every caller of it is a census site. |
| +// - Task 3: Reconcile calls cfg.InteractiveSeen beside cfg.RunSeen on a |
| +// record with a marker; the same record keys and literal, nothing |
| +// written. |
| +func rootfsApps6WriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), fleetPublicRoutesWriteCensusInventory()...) |
| + replacements := []censusEntry{ |
| + {"internal/provision/reconcile.go", "Reconcile", "key-site", "key:ParseRecordKey,key:RecordKey,lit:instances", "be1b699f14a2f8d6935d959dee168bdf6fb556cd78da458f5ba8a1c0e8512a17"}, |
| + } |
| + for _, r := range replacements { |
| + found := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + if e.Class != r.Class || e.Kinds != r.Kinds { |
| + panic("rootfs-apps-6 replacement reclassifies " + r.File + ":" + r.Unit) |
| + } |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + panic("rootfs-apps-6 replacement of an unlisted unit " + r.File + ":" + r.Unit) |
| + } |
| + } |
| + added := []censusEntry{ |
| + {"internal/provision/interactive.go", "SetRecordInteractive", "record-writer", "key:SetRecordInteractive,key:updateRecord", "f2f8c0ad8647cc048a0be0fa3edc051ddd8e3157eba038123f9e5bab79f4530e"}, |
| + } |
| + for _, a := range added { |
| + for _, e := range entries { |
| + if e.File == a.File && e.Unit == a.Unit { |
| + panic("rootfs-apps-6 addition of a listed unit " + a.File + ":" + a.Unit) |
| + } |
| + } |
| + } |
| + return append(entries, added...) |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 1ab671e64..63d7cae98 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -43,3 +43,4 @@ plan14-root-reads-region-ha-dead-holder-backoff.tsv 8f6a1865b0abcea9d4fb68232cc2 |
| plan14-root-reads-managed-fleets-1c-451.tsv af326671321edda76c7e6217a47892605a9e3b886fa880ad6d049c2f28f63873 |
| plan14-root-reads-fleet-public-routes.tsv bca6ef741a96b72767b1747789cd01b3111d61b68548cbe368258c31f3d53a2e |
| plan14-root-reads-fleet-routes-followups.tsv 1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7 |
| +plan14-root-reads-rootfs-apps-6.tsv d62fb15b639f48fde409606adcd630322d8c4b8cc5937ea9a257a4969ddc8f5a |
diff --git a/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv| new file mode 100644 |
| index 000000000..a0b3c1e62 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv |
| @@ -0,0 +1,5 @@ |
| +# 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. |
| +@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 internal/provision e1ecfdc3d169773ac6dd9dc09a6d0feea768ceb1b80195199c5ef74b2f0e6f5c |