carlos / platform Public

console: Linked deployments on the Fleet tab

Linked deployments slice 1, Task 6 (spec §5.3, §5.4).

- The Fleet tab lists the account's linked deployments: name, linked
  when and by whom, reachable or last seen (registry LinkSeen), and the
  published apps with their URLs. An unlinked link keeps its card,
  marked removing, until the registry holds no channel or forward row
  for it and no apps row names it.
- POST /a/{sqid}/links/{id}/unlink (owner, CSRF, confirm card) and
  DELETE /api/cli/links/{account}/{id} (owner) run unlink, the function
  DELETE /api/link runs, and report done or pending; GET
  /api/cli/links/{account} lists the section for the CLI.
- The apps list labels a linked app "Served from <home>"; the platform
  app count and regionlabel.ForRoute treat a link/<id> row as linked.
- Copy: deck LD-C14 to LD-C31; addendum 1 approved; new drafts pending.
- Parity row, claim fixtures, closed doors, census overlay and the 9B8
  layer (re-pins Task 5's five console sites and its linkedPolicies).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev a3865032e347c35571202142f04c2427ca467c1d parent 63c7c3b
24 files changed, +1,002 −35
  • docs/parity.md +3 −2
  • docs/superpowers/notes/census-proposal-linked-deployments-slice1.md +4 −2
  • internal/console/accountfleet.go +31 −13
  • internal/console/accountfleet_test.go +4 −4
  • internal/console/accountlinks.go +379 −0
  • internal/console/accountlinks_test.go +350 −0
  • internal/console/claim_invariant_fixtures_test.go +3 −0
  • internal/console/claim_invariant_probes_nonapp_test.go +12 −0
  • internal/console/claim_invariant_probes_read_test.go +2 −0
  • internal/console/links_copy.go +65 −3
  • internal/console/links_store.go +21 −0
  • internal/console/remoteinstances_test.go +1 −1
  • internal/console/routedecls.go +7 −0
  • internal/console/server.go +19 −0
  • internal/console/svcroutes_test.go +7 −2
  • internal/console/templates/account_fleet.html +25 −0
  • internal/console/templates/apps.html +3 −3
  • internal/console/testdata/claim-routes.txt +3 −0
  • internal/provision/linked_deployments_slice1_census_test.go +28 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv +4 −1
  • internal/regionlabel/regionlabel.go +10 −2
  • internal/regionlabel/regionlabel_test.go +19 −0
  • parity/parity.tsv +1 −0
diff --git a/docs/parity.md b/docs/parity.md
index 7e830ca70..7bf284777 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -14,8 +14,8 @@ CLI rows are checked against the command registry (`parity/cli.tsv`).
| partial | 9 |
| gap | 62 |
| cli-only | 15 |
-| console-only | 17 |
-| Total | 145 |
+| console-only | 18 |
+| Total | 146 |
## account
@@ -137,6 +137,7 @@ CLI rows are checked against the command registry (`parity/cli.tsv`).
| fleets-detach-box | both | `fleets detach-box` | `POST /a/{sqid}/fleets/{fleet}/detach` | | |
| fleets-drain | gap | `fleets drain` | | [wp-fleets-relay](#wp-fleets-relay) | |
| fleets-secrets-key | gap | `fleets secrets-key` | | [wp-fleets-relay](#wp-fleets-relay) | The fleet page shows the fingerprint and prints the CLI command. |
+| links-unlink | console-only | | `POST /a/{sqid}/links/{id}/unlink` | | No carlos command unlinks from the account side yet. carlos link remove unlinks from the home. |
## instances
diff --git a/docs/superpowers/notes/census-proposal-linked-deployments-slice1.md b/docs/superpowers/notes/census-proposal-linked-deployments-slice1.md
index 8a32a249c..531077d77 100644
--- a/docs/superpowers/notes/census-proposal-linked-deployments-slice1.md
+++ b/docs/superpowers/notes/census-proposal-linked-deployments-slice1.md
@@ -13,10 +13,11 @@ Ruling `census-ruling-linked-deployments-slice1`. The independent reviewer appro
| `internal/edge/fleetforward.go` `FleetArmVerdict` | sites | +registry:App, +registry:Host, +registry:Region | linked deployments slice 1 Task 3: owners is edge.ForwardOwners; a link-placed forward row (registry.LinkPlacement over the listed row's Region) admitted by FleetServeEligible gets an Arm entry with its link, app and the link's owner, and ArmLink rows count as served; +registry:App, +registry:Host, +registry:Region are that row's fields; a pure decision over the listing, no read source added |
| `internal/edge/fleetforward.go` `FleetServeEligible` | sites | +registry:Region, +whole:Route | linked deployments slice 1 Task 3: owners is edge.ForwardOwners; a forward row whose Region parses as a link placement is judged by linkServeEligible against owners.Links only, and every other row as before against owners.Fleets; +registry:Region and +whole:Route are that parse and the hand-off; refuses more, never admits a fleet row by link owners |
| `internal/provision/reconcile.go` `Reconcile` | sites | +registry:Region | linked deployments slice 1 Task 2: where a forward row holds an in-scope record's host, a link-placed one (registry.LinkPlacement over the listed row's Region) gets its own log line saying no pass here retires it; the record is still not applied, as before; one +registry:Region read of the listed row, no write added |
+| `internal/regionlabel/regionlabel.go` `ForRoute` | sites | +registry:Region ×2 | linked deployments slice 1 Task 6: a row placed on a linked deployment (registry.LinkPlacement over the row's own Region, "link/<id>") is labelled as linked (the new Label.Link, the link ID; Text empty) before the fleet and everywhere checks, instead of being labelled with "link/<id>" as a region code; pure, reads only the Route it is given, no read added |
| `internal/registry/forward.go` `Registry.PutForward` | sites | +registry:Account, +registry:FleetLabel, +registry:Host, +registry:Region ×2 | linked deployments slice 1 Task 1: also accepts a Region that LinkPlacement parses (link/ + 12 hex), refusing a link row with a FleetLabel (ErrNotForward); the existing in-transaction SELECT also reads the held row's region and refuses a different placement class (ErrHostHeld); a link row additionally needs an active link_channels row of its account in the same transaction (linkAdmits, ErrLinkInactive). Same transaction and statement; the added reads are the argument and the box's own registry database, as carlos |
| `internal/registry/registry.go` `Registry.Fingerprint` | sites | +file:Query | linked deployments slice 1 Task 1: hashes link_channels (link_id, account, token_hash, status, generation; connected, seen_at, seq and created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no links digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; a digest, never a decision |
-Envelopes re-pinned: `internal/edge`, `internal/host`, `internal/provision`, `internal/registry`, `internal/tunnelclient`.
+Envelopes re-pinned: `internal/edge`, `internal/host`, `internal/provision`, `internal/regionlabel`, `internal/registry`, `internal/tunnelclient`.
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.
@@ -31,6 +32,7 @@ Recorded dispositions, which each change must still satisfy:
- `internal/edge/fleetforward.go` `FleetArmVerdict`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 6 fix round 3: the single fleet-arm refusal decision over one listing, used by Edge.Reload, the edges-file writer and the alias pass (parity by construction); returns the refused set with reasons and the accountless notes (+registry:Host x3, +registry:Status, +whole:Route x3). Pure; no I/O. Review R1 finding 2: also returns Served, each admitted row Reload sends through the fleet arm (a forward row, or a fleet-placed row with no Tunnel) with its fleet, app and the fleet owner from owners; a host the alias step refuses is dropped from it (+registry:App, +registry:Host, +registry:Region, +registry:Tunnel on the listing it already holds). Pure; no I/O. Review R2: the pre-fold fleet rows are now Arm; Served is the destination after the platform-alias fold: every ready, unrefused, non-sidecar row DispatchArm gives an entry, with its Arm fleet when its arm is a fleet's, folded by foldPlatformAliases (Reload's own fold), keeping the hosts that go to a fleet (+registry:Host, +registry:Status, +whole:Route on the listing it already holds). Pure; no I/O; refusals unchanged.;rev3=census-ruling-stateless-replicas-3;basis=Task 3: classify ArmReplica as fleet-served for the existing shared routing, edges-file and alias verdict. Existing field reads unchanged; pure in-memory decision, same owner and alias checks.
- `internal/edge/fleetforward.go` `FleetServeEligible`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4 (§4.4 tenancy): a forward row is eligible only on a hub, inert, fleet-placed, its fleet in the fleets table and its raw Account non-empty and equal to the owner; a non-forward fleet-placed row: empty raw Account served and noted, else release.RouteAccount must equal the owner; raw field before RouteAccount (+registry:Account x7, +registry:Region x2, +registry:Tunnel, +whole:Route). Pure; no I/O.;rev3=census-ruling-stateless-replicas-3;basis=Task 3: gate set routing on hub role, valid projection, nonempty account/app, instance or inert forward kind, no platform ownership, HA, hibernation or explicit tunnel. New reads are fields of the already-supplied Route. Existing fleet-owner and inert-forward checks still apply; no external read or expansion of destination authority. Fix round 1 M1: retain the same fail-closed structural predicate but give each invalid condition an internal diagnostic instead of the no-healthy-copy message. No admission expansion, user-facing answer, or additional read.
- `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.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 4, rules 2 and 9): after inScope, a record failing cfg.ownsRecord (on a fleet box, labelled for another box: rec.FleetBox != "" and != cfg.FleetBox) is skipped as out of scope, so it is never minted here; in the removal phase such a record no longer keeps the row (inScope && ownsRecord), so the row goes as record gone. Off a fleet ownsRecord is always true. Read sites unchanged (178). The agent's reconcile loops, not root; it mints less, never more.;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; merge of origin/main 6f1f6ca6: main's fleet-box ownsRecord skip in the record scan and in the removal phase is kept as main has it (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (178);rev3=census-ruling-stateless-replicas-1;basis=Task 3b: call the optional binding callback only for applied, owned stateless rows outside dry run. Reuses this pass record and route reads after existing collision, scope, hold, policy and shape checks; no new record read or typed writer. Fix 3b round 1 I1: binding callback failure is logged and falls through to pr.applied; same per-host callback, record writers, scope and removal gates. TestStatelessBindingFailureContinuesReconcile covers second-record convergence, removal, applied bookkeeping and next-pass retry.;rev3=census-ruling-region-ha-p1b3b-t;basis=B3b: collect validated instance records from the existing scan before pool filtering; report source completeness separately. Record reads, writes, scope and removal authority unchanged.;rev3=census-ruling-agent-start-demo-1;basis=Keeps local demo rows for signed cleanup instead of deleting the binding on record absence or trash; normal/hub paths unchanged. Merge integration against origin/main 9bd45488 retains main's HA departure inventory scan and family-completeness reporting alongside the early local-demo retention guard; existing record reads retained.;rev3=census-ruling-stateless-replicas-2;basis=Final fix I1: legacy records now reach the legacy ownership/removal judgement for former set rows; a greater local incarnation remains protected. Current set-record lifetime and membership checks remain. Same record/registry reads and removal writers. TestReplicaReconcileLegacySuccessor covers both boxes with and without the judge; P11 newer/unknown set protections remain covered. merge of origin/main 6be08467: Retain main signed demo retirement ownership alongside replica set retirement and legacy successor recovery; merge-only body change, unchanged read sources.;rev3=census-ruling-agent-start-demo-3;basis=Install durable source claim holds and reconcile fresh destination seed gates; preserve owned pending routes and stop orphan seeds before cleanup. Census read-site delta: +registry:Account, +registry:App, +registry:Host, +registry:ImportGate ×2, +registry:SeedSource ×2, +whole:Route ×4.;rev3=census-ruling-region-ha-g2-fixes;basis=Run guarded pool withdrawal, extract the unchanged judged collection rules into scanInstanceRecords, and publish pre-pool HA ingress including stale refusal names. Existing direct route reads remain; indirect withdrawal reads and deletion are separately claimed.
+- `internal/regionlabel/regionlabel.go` `ForRoute`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-labels;identity=the console and the carlos CLI (a pure package; no box unit links it for a decision);basis=new (region labels plan 1 task 2): labels a registry row already in hand from its Region and Pool columns and RouteServedEverywhere; pure: no file, no store, no registry open, nothing written;decision: Paul, as census owner, 2026-10-26: accepted as a new unit (#280)
- `internal/registry/forward.go` `Registry.PutForward`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 2: the only writer of a forward row's declared columns: refuses an argument whose kind is not forward; copies only the declared fields from its argument (Status ready, Provisioned true; no forbidden column is ever written); inside one IMMEDIATE transaction refuses a host a non-forward row holds (ErrHostHeld); keeps FleetBox while Region is unchanged; preserves the observational columns (+file:Exec, +file:QueryRow, +registry:Account, App, Channel, RateLimit, Region, Slug, +registry:Host x3, +registry:Kind, +registry:remote x2, +whole:Route x3, +whole:remoteClient x2).;rev3=census-ruling-fleet-routes-followups;basis=refuses up front, with the new sentinel ErrNotForward and before any read or write, an rt that is not a forward row (as before, now a sentinel), has an empty Host, or whose Region is not a fleet placement (registry.FleetPlacement); +registry:Host x2 and +registry:Region x2 read only the argument in those checks; the transaction and statement are unchanged;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3), merged with main's ErrNotForward refusals (kept unchanged): the written row also carries FleetLabel = rt.FleetLabel and FleetBox = rt.FleetLabel; its conflict arm (forwardKept) writes fleet_label from the call and fleet_box as the call's label when set, else kept while the region is unchanged. The hub's forward phase in the agent, not root.;rev3=census-ruling-stateless-replicas-1;basis=Carry declarative Stateless into forward rows under existing transaction and shape guards; projection only.;rev3=census-ruling-agent-start-demo-1;basis=Reads and carries the four demo fields in the existing forward INSERT; the guarded conflict SQL refuses downgrade or identity change.;rev3=census-ruling-stateless-replicas-2;basis=Validates canonical set projection, writes explicit declarative columns and clears single-box binding; all forbidden columns zero. Same transaction/read source. merge of origin/main 6be08467: Retain main demo columns and immutable descriptor conflict guard alongside set validation/projection; merge-only existing route fields.
- `internal/registry/registry.go` `Registry.Fingerprint`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user); the remote arm, unchanged, in the process that holds a remote handle: census-ruling-seeded-instances's body with the row's lifetime pair (incarnation, serving_seq) folded into the edge's change poll, each only when non-zero, so a registry with no pair digests as before; self-serve moves 1 Task 7;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: hashes regional_domains (host, target, account, app, region; created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no regional rows digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; no file path read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): review R1 finding 1: the routes SELECT also reads host, kind, account, app, platform and fingerprintForwardInert (one CASE over the ForwardForbidden columns), and every row folds host, kind, account and app (tagged, quoted), platform when set, and forward_inert=0 for a forward row that is not inert, so a rowid reused by another hostname, an in-place account or app rewrite, or a stray forbidden column moves the edge's change poll. Same one SELECT per table on the same fresh connection to the box's own registry database, as carlos; no table, file or bucket read added; a digest, never a decision.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5): the SELECT also reads fleet_label and, only when it is set, hashes "fleet_label=<q>" into the digest, so labelling a row moves the edge's reload fingerprint. Read sites unchanged (33). Registry side, not root; an unlabelled registry's digest is byte-identical.;rev3=census-ruling-stateless-replicas-1;basis=Read the additive stateless projection in the existing registry SELECT and hash only when set; no new read source.;rev3=census-ruling-agent-start-demo-1;basis=Existing SELECT reads four more demo columns; only a marked row adds them to the hash, so ordinary hashes remain unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Four additive projection columns join the existing routes SELECT and hash only when nonzero; no new query or file read. merge of origin/main 6be08467: Union main demo identity and expiry with replica columns in the same SELECT and hash; merge-only body change.;rev3=census-ruling-agent-start-demo-3;basis=Hash moved-notice wire bytes so notice-only changes invalidate an edge route snapshot. Census read-site delta: +file:QueryRow.;rev3=census-ruling-edge-page-cache-1;basis=selects the new pages_off column with the rest and folds "pages_off=1" into the hash only when set, as assets_off, so a registry that never sets it fingerprints as before; same routes SELECT, no new table; read sites unchanged (34); no read added
@@ -55,6 +57,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- reads `internal/provision/forward.go:forwardView.retirements`: +registry:Region; keeps legacy, task accepted-legacy
- reads `internal/registry/remote_dispatch.go:Registry.dispatchRemote`: +registry:Changed ×3, +registry:Host, +registry:Link, +registry:LinkID ×4, +registry:LinkSeen, +registry:On, +registry:Routes, +registry:SeenAt, +registry:Seq, +registry:StringMap ×2, +whole:LinkChannel, +whole:LinkSeen, +whole:Route; keeps hint, task E2
-Seal: `6d3ea7fccce1a7f4bc507b6eb8d368ed0b62f83022504aa04c7684c72c93aa9a` → `22fd09af6dac49fadf4b023f5e310f1e8399a1ce501a8aacd39e02970e4c40ba`.
+Seal: `6d3ea7fccce1a7f4bc507b6eb8d368ed0b62f83022504aa04c7684c72c93aa9a` → `0cdd951c6ca225d6ba95943e47a2619dbce31a0f3b489bb27ab02e0b5f630d30`.
Overlay: `internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/console/accountfleet.go b/internal/console/accountfleet.go
index c7dadcccc..efed962fa 100644
--- a/internal/console/accountfleet.go
+++ b/internal/console/accountfleet.go
@@ -68,10 +68,11 @@ type accountFleetCard struct {
Apps int
}
-// assembleAccountFleet builds the tab's two halves: the shared platform
-// fleet from status/fleet.json, and the account's own fleets from the
-// registry. warn carries the FIRST read that failed, for a flash banner —
-// every failure degrades its own section to empty and nothing else.
+// assembleAccountFleet builds the tab's sections: the shared platform
+// fleet from status/fleet.json, the account's own fleets from the
+// registry, and its linked deployments (accountLinks). warn carries the
+// FIRST read that failed, for a flash banner — every failure degrades its
+// own section to empty and nothing else.
//
// fleetsKnown is the fleets index's twin of sharedFleetCard.PlacementKnown,
// and exists for the identical reason: a nil slice is the SAME value for
@@ -79,9 +80,18 @@ type accountFleetCard struct {
// failed", and the first of those is a positive claim ("No fleets of your
// own yet") that a failed registry read has not earned. False means the
// section renders "unknown", never "none".
-func (s *Server) assembleAccountFleet(ctx context.Context, acct *Account) (card *sharedFleetCard, fleets []accountFleetCard, fleetsKnown bool, warn string) {
+func (s *Server) assembleAccountFleet(ctx context.Context, acct *Account) (card *sharedFleetCard, fleets []accountFleetCard, fleetsKnown bool, links accountLinksView, warn string) {
card = &sharedFleetCard{Title: "Shared fleet"}
+ // Linked deployments first: their apps are served from a home, not
+ // from the shared fleet, so the placement split below leaves them out.
+ links = s.accountLinks(acct)
+ defer func() {
+ if warn == "" {
+ warn = links.Warn
+ }
+ }()
+
// A console with no deployment bucket configured has no aggregate to
// read at all — that is the empty card, not an error.
if s.cfg.Releases != nil {
@@ -116,15 +126,17 @@ func (s *Server) assembleAccountFleet(ctx context.Context, acct *Account) (card
if warn == "" {
warn = "Could not reach the fleet registry."
}
- return card, nil, false, warn
+ return card, nil, false, links, warn
}
// The placement split. A route whose Region parses as a fleet placement
// runs on that fleet; everything else — "" and any future residency code
// FleetPlacement declines — runs on the shared fleet, which is exactly
- // the fallback the platform itself applies. Counted by distinct APP, not
- // by route, because "3 of your apps run here" is the sentence a tenant
- // can act on; a host count is noise on this page.
+ // the fallback the platform itself applies. A row placed on a linked
+ // deployment ("link/<id>") runs at its home, so it is neither: it is not
+ // counted here. Counted by distinct APP, not by route, because "3 of
+ // your apps run here" is the sentence a tenant can act on; a host count
+ // is noise on this page.
//
// rt.Account is compared strictly, the same test loadFleetPage and
// overview.go make: an unstamped row is not this account's to claim on a
@@ -141,6 +153,9 @@ func (s *Server) assembleAccountFleet(ctx context.Context, acct *Account) (card
if rt.Account != acct.Sqid {
continue
}
+ if _, linked := registry.LinkPlacement(rt.Region); linked {
+ continue
+ }
if _, placed := registry.FleetPlacement(rt.Region); !placed {
platformApps[rt.App] = true
}
@@ -157,7 +172,7 @@ func (s *Server) assembleAccountFleet(ctx context.Context, acct *Account) (card
known = false
} else {
for _, app := range apps {
- if platformApps[app] {
+ if platformApps[app] || links.linkedApps[app] {
continue
}
recs, err := s.pageRecords(ctx, acct.Sqid, app)
@@ -191,7 +206,7 @@ func (s *Server) assembleAccountFleet(ctx context.Context, acct *Account) (card
if warn == "" {
warn = "Could not list your fleets."
}
- return card, nil, false, warn
+ return card, nil, false, links, warn
}
for i := range rows {
// Fleet names are one flat, cross-account namespace (fleets.go's
@@ -218,7 +233,7 @@ func (s *Server) assembleAccountFleet(ctx context.Context, acct *Account) (card
}
fleets = append(fleets, c)
}
- return card, fleets, true, warn
+ return card, fleets, true, links, warn
}
// handleAccountFleetTab serves GET /a/{sqid}/fleet. Membership in the
@@ -232,10 +247,13 @@ func (s *Server) handleAccountFleetTab(w http.ResponseWriter, r *http.Request) {
p := s.accountPage(w, r, addr, raw, acct, role)
p.Title = "Fleet"
p.ActiveNav = "fleet"
- shared, own, ownKnown, warn := s.assembleAccountFleet(r.Context(), acct)
+ shared, own, ownKnown, links, warn := s.assembleAccountFleet(r.Context(), acct)
p.SharedFleet = shared
p.AccountFleets = own
p.FleetsKnown = ownKnown
+ p.LinkedDeployments = links.Cards
+ p.LinkedDeploymentsKnown = links.Known
+ p.LinkSection = s.linkSection()
if warn != "" && p.FlashErr == "" {
p.FlashErr = warn
}
diff --git a/internal/console/accountfleet_test.go b/internal/console/accountfleet_test.go
index 0b7cab8de..975295770 100644
--- a/internal/console/accountfleet_test.go
+++ b/internal/console/accountfleet_test.go
@@ -148,7 +148,7 @@ func TestAccountFleetSharedCardFromFleetJSON(t *testing.T) {
fx := newConsoleFixture(t)
seedSharedBoxes(t, fx, "UK · London", "EU · Ireland")
- card, _, _, warn := fx.srv.assembleAccountFleet(context.Background(), fixtureAccount(fx))
+ card, _, _, _, warn := fx.srv.assembleAccountFleet(context.Background(), fixtureAccount(fx))
if warn != "" {
t.Fatalf("warn = %q, want none on a healthy read", warn)
}
@@ -214,7 +214,7 @@ func TestAccountFleetActiveFlipsWithPlacement(t *testing.T) {
}
acct := fixtureAccount(fx)
- card, _, _, _ := fx.srv.assembleAccountFleet(ctx, acct)
+ card, _, _, _, _ := fx.srv.assembleAccountFleet(ctx, acct)
if !card.Active || card.PlatformApps != 1 {
t.Fatalf("unplaced route: Active=%v PlatformApps=%d, want true/1", card.Active, card.PlatformApps)
}
@@ -244,7 +244,7 @@ func TestAccountFleetActiveFlipsWithPlacement(t *testing.T) {
t.Fatalf("after pass 2: row = %+v %v, want the forward row on fleet/acme", rt, err)
}
- card, own, _, _ := fx.srv.assembleAccountFleet(ctx, acct)
+ card, own, _, _, _ := fx.srv.assembleAccountFleet(ctx, acct)
if card.Active || card.PlatformApps != 0 {
t.Fatalf("every route placed: Active=%v PlatformApps=%d, want false/0", card.Active, card.PlatformApps)
}
@@ -275,7 +275,7 @@ func TestAccountFleetListsOnlyOwnFleets(t *testing.T) {
}
writeFleetHeartbeat(t, fx, "acme", status.Box{GeneratedAt: time.Now(), Label: "pi-1"})
- _, own, ownKnown, warn := fx.srv.assembleAccountFleet(context.Background(), fixtureAccount(fx))
+ _, own, ownKnown, _, warn := fx.srv.assembleAccountFleet(context.Background(), fixtureAccount(fx))
if warn != "" {
t.Fatalf("warn = %q, want none", warn)
}
diff --git a/internal/console/accountlinks.go b/internal/console/accountlinks.go
new file mode 100644
index 000000000..4398743fc
--- /dev/null
+++ b/internal/console/accountlinks.go
@@ -0,0 +1,379 @@
+package console
+
+// The person's side of linked deployments on the serving console (linked
+// deployments spec §5.3, §5.4): the Linked deployments section of the
+// account's Fleet tab, its Unlink, and the same two for the CLI
+// (GET /api/cli/links/{account}, DELETE /api/cli/links/{account}/{id}).
+//
+// Every unlink goes through unlink (apilinks.go), the one function the
+// link's own DELETE /api/link also runs, so a person's unlink and the
+// deployment's own end the same way and can be run again on a link that is
+// already revoked. A revoked link keeps its card, marked removing, until
+// nothing of it is left: no active channel and no forward row in the hub
+// registry, and no apps row naming it. While the registry still holds the
+// channel or a forward row the card says the revocation is pending (the
+// apps may still answer); after that, only leftover apps rows remain, which
+// serve nothing and linkSyncPass removes. The person doors offer Unlink on
+// a removing card too, which runs the remaining steps again.
+
+import (
+ "context"
+ "crypto/subtle"
+ "errors"
+ "log"
+ "net/http"
+ "net/url"
+ "time"
+
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// accountLinkCard is one linked deployment as the Fleet tab and the CLI
+// list show it.
+type accountLinkCard struct {
+ ID, Name, CreatedBy string
+ CreatedAt time.Time
+ // Reachable and LastSeen are the hub's connection record
+ // (registry LinkSeen); they claim nothing when SeenKnown is false.
+ Reachable bool
+ LastSeen time.Time
+ SeenKnown bool
+ Apps []accountLinkApp
+ // Removing: the link is unlinked, and something of it is left (see the
+ // file comment). Pending: what is left includes the registry's channel
+ // or a forward row, or the registry could not be read to say otherwise.
+ Removing bool
+ Pending bool
+ // The card's sentences, filled from the deck: when and by whom it was
+ // linked, and its state line under the reachable chip ("" for none).
+ LinkedText string
+ StateText string
+}
+
+// accountLinkApp is one published app of a linked deployment.
+type accountLinkApp struct {
+ Name, URL string
+}
+
+// accountLinksView is the account's linked deployments: the cards, whether
+// the console's own read of its links succeeded (Known; false means the
+// section says it could not be read, never "none"), the first read that
+// failed as a flash (Warn), and the account's linked app names, which the
+// Fleet tab keeps out of its platform-app count.
+type accountLinksView struct {
+ Cards []accountLinkCard
+ Known bool
+ Warn string
+ linkedApps map[string]bool
+}
+
+// linkSectionCopy is the Linked deployments section's fixed text.
+type linkSectionCopy struct {
+ Heading, Intro, Empty, Unreadable string
+ Reachable, NotReachable, AppsHeading, NoApps string
+ Kind, Unlink string
+}
+
+// linkSection is the section's text for this console: the empty state
+// names its own address for carlos link create --to.
+func (s *Server) linkSection() linkSectionCopy {
+ return linkSectionCopy{
+ Heading: copyLD14, Intro: copyLD15, Empty: linkCopy(copyLD16, "console", s.cfg.Origin),
+ Unreadable: copyLinksReadFailed,
+ Reachable: copyLD18, NotReachable: copyLD19, AppsHeading: copyLD23, NoApps: copyLD24,
+ Kind: copyLD25, Unlink: copyLD26,
+ }
+}
+
+// accountLinks reads acct's linked deployments: the console's links rows,
+// each link's apps rows, and the hub registry's connection record, active
+// channels and (for a revoked link) forward rows. Soft-fail like the rest
+// of the Fleet tab: a failed read costs what it would have shown, and Warn
+// says so.
+func (s *Server) accountLinks(acct *Account) accountLinksView {
+ v := accountLinksView{linkedApps: map[string]bool{}}
+ warn := func(format string, args ...any) {
+ log.Printf("console: linked deployments %s: "+format, append([]any{acct.Sqid}, args...)...)
+ v.Warn = copyLinksReadFailed
+ }
+ links, err := s.store.LinksForAccount(acct.ID)
+ if err != nil {
+ warn("links: %v", err)
+ return v
+ }
+ v.Known = true
+ if len(links) == 0 {
+ return v
+ }
+
+ var (
+ seen map[string]registry.LinkSeen
+ active map[string]string
+ reg consoleRegistry
+ seenOK, act bool
+ )
+ if r, err := s.linkReg(); err != nil {
+ warn("open registry: %v", err)
+ } else {
+ reg = r
+ if seen, err = reg.LinkSeen(); err != nil {
+ warn("link seen: %v", err)
+ } else {
+ seenOK = true
+ }
+ if active, err = reg.LinkChannelAuth(); err != nil {
+ warn("link channels: %v", err)
+ } else {
+ act = true
+ }
+ }
+
+ for i := range links {
+ l := &links[i]
+ apps, appsErr := s.store.LinkedApps(l.ID)
+ if appsErr != nil {
+ warn("apps of %s: %v", l.ID, appsErr)
+ }
+ for _, a := range apps {
+ v.linkedApps[a.App] = true
+ }
+ c := accountLinkCard{ID: l.ID, Name: l.Name, CreatedBy: l.CreatedBy, CreatedAt: l.CreatedAt,
+ LinkedText: linkCopy(copyLD17, "date", l.CreatedAt.UTC().Format("2 Jan 2006"), "person", l.CreatedBy)}
+ if !l.RevokedAt.IsZero() {
+ regClear := false
+ if reg != nil && act {
+ if _, held := active[registry.LinkChannelName(l.ID)]; !held {
+ fwd, err := reg.LinkForwards(l.ID)
+ if err != nil {
+ warn("forward rows of %s: %v", l.ID, err)
+ }
+ regClear = err == nil && len(fwd) == 0
+ }
+ }
+ if regClear && appsErr == nil && len(apps) == 0 {
+ continue // nothing of it is left: unlinked
+ }
+ c.Removing, c.Pending = true, !regClear
+ }
+ for _, a := range apps {
+ c.Apps = append(c.Apps, accountLinkApp{Name: a.App, URL: s.linkAppURL(acct, a.App)})
+ }
+ if seenOK {
+ c.SeenKnown = true
+ if st, ok := seen[l.ID]; ok {
+ c.Reachable, c.LastSeen = st.Connected, st.At
+ }
+ }
+ switch {
+ case c.Pending:
+ c.StateText = copyLinkRemovingPending
+ case c.Removing:
+ c.StateText = copyLD22
+ case !c.SeenKnown || c.Reachable:
+ case c.LastSeen.IsZero():
+ c.StateText = copyLD21
+ default:
+ c.StateText = linkCopy(copyLD20, "ago", humanAge(time.Since(c.LastSeen)))
+ }
+ v.Cards = append(v.Cards, c)
+ }
+ return v
+}
+
+// linkAppURL is a linked app's public address, "" on a console with no
+// apps domain.
+func (s *Server) linkAppURL(acct *Account, app string) string {
+ if s.apexHost(acct.Sqid, app) == "" {
+ return ""
+ }
+ return s.linkPublicationURL(acct, app)
+}
+
+// accountFleetURL is the account's Fleet tab.
+func accountFleetURL(sqid string) string { return "/a/" + url.PathEscape(sqid) + "/fleet" }
+
+// accountLink reads link id of acct for a person door. ok is false with no
+// answer written when the link is not this account's (or the ID is not a
+// link ID): the caller answers its own 404. err is a store failure.
+func (s *Server) accountLink(acct *Account, id string) (l *Link, ok bool, err error) {
+ if !registry.ValidLinkID(id) {
+ return nil, false, nil
+ }
+ l, err = s.store.LinkByID(id)
+ if err != nil || l == nil || l.AccountID != acct.ID {
+ return nil, false, err
+ }
+ return l, true, nil
+}
+
+// personUnlink runs unlink for a person, on a context that outlives the
+// request (the revocation is not abandoned when the client goes) and is
+// bounded like the link's own door. done is true when the hub registry has
+// applied the revocation (apps rows unlink could not remove are finished by
+// linkSyncPass and serve nothing); pending when it has not yet; err when the
+// console transaction itself failed.
+func (s *Server) personUnlink(r *http.Request, l *Link, by string) (pending bool, err error) {
+ ctx, cancel := context.WithTimeout(context.WithoutCancel(r.Context()), linkSyncTimeout)
+ defer cancel()
+ switch err := s.unlink(ctx, l, by); {
+ case err == nil:
+ return false, nil
+ case errors.Is(err, errUnlinkPending):
+ log.Printf("console: link %s: unlink by %s: %v (linkSyncPass retries)", l.ID, by, err)
+ return true, nil
+ case errors.Is(err, errUnlinkAppsLeft):
+ log.Printf("console: link %s: unlink by %s revoked, then: %v (linkSyncPass finishes it)", l.ID, by, err)
+ return false, nil
+ default:
+ return false, err
+ }
+}
+
+// handleLinkUnlinkPage is POST /a/{sqid}/links/{id}/unlink, the Fleet tab
+// card's Unlink: the owner, as for a fleet box's detach, with the form's
+// CSRF token; then the confirm card; then unlink. The flash says whether
+// the hub has cut the link yet.
+func (s *Server) handleLinkUnlinkPage(w http.ResponseWriter, r *http.Request) {
+ addr, raw, acct, ok := s.owner(w, r)
+ if !ok {
+ return
+ }
+ if subtle.ConstantTimeCompare([]byte(r.FormValue("csrf")), []byte(raw)) != 1 {
+ s.renderMessage(w, r, http.StatusForbidden, "Refused", "Cross-site request blocked.")
+ return
+ }
+ l, ok, err := s.accountLink(acct, r.PathValue("id"))
+ if err != nil {
+ log.Printf("console: unlink %s/%s: read: %v", acct.Sqid, r.PathValue("id"), err)
+ s.renderMessage(w, r, http.StatusServiceUnavailable, "Error", copyLinksReadFailed)
+ return
+ }
+ if !ok {
+ http.NotFound(w, r)
+ return
+ }
+ if !confirmed(r) {
+ p := s.accountPage(w, r, addr, raw, acct, RoleOwner)
+ p.Title = linkCopy(copyLD28, "home", l.Name)
+ p.AppName = l.Name
+ p.ActiveNav = "fleet"
+ p.Confirm = &ConfirmView{
+ Title: linkCopy(copyLD28, "home", l.Name),
+ Lines: []string{linkCopy(copyLD27, "home", l.Name)},
+ Action: "/a/" + url.PathEscape(acct.Sqid) + "/links/" + l.ID + "/unlink",
+ Fields: [][2]string{{"csrf", raw}},
+ Button: linkCopy(copyLD28, "home", l.Name),
+ Danger: true,
+ CancelURL: p.Nav + "/fleet",
+ }
+ s.render(w, http.StatusOK, "confirm_action", p)
+ return
+ }
+ pending, err := s.personUnlink(r, l, addr)
+ switch {
+ case err != nil:
+ log.Printf("console: link %s: unlink by %s: %v", l.ID, addr, err)
+ s.setFlash(w, "err", linkCopy(copyLD30, "home", l.Name))
+ case pending:
+ s.setFlash(w, "ok", linkCopy(copyLinkUnlinkPending, "home", l.Name))
+ default:
+ s.setFlash(w, "ok", linkCopy(copyLD29, "home", l.Name))
+ }
+ http.Redirect(w, r, accountFleetURL(acct.Sqid), http.StatusSeeOther)
+}
+
+// linkWire is one linked deployment on GET /api/cli/links/{account}.
+// Reachable is null when the hub's connection record could not be read;
+// LastSeen is absent when the link never connected. Revocation is
+// "pending" on a removing link the hub has not cut yet.
+type linkWire struct {
+ ID string `json:"id"`
+ Name string `json:"name"`
+ CreatedBy string `json:"created_by"`
+ CreatedAt time.Time `json:"created_at"`
+ Reachable *bool `json:"reachable"`
+ LastSeen *time.Time `json:"last_seen,omitempty"`
+ Removing bool `json:"removing"`
+ Revocation string `json:"revocation,omitempty"`
+ Apps []linkAppWire `json:"apps"`
+}
+
+type linkAppWire struct {
+ App string `json:"app"`
+ URL string `json:"url"`
+}
+
+// handleAPILinksList is GET /api/cli/links/{account}: the Fleet tab's
+// Linked deployments for the CLI (carlos links ls). Any person member, as
+// the tab.
+func (s *Server) handleAPILinksList(w http.ResponseWriter, r *http.Request) {
+ _, acct, ok := s.apiAccount(w, r)
+ if !ok {
+ return
+ }
+ v := s.accountLinks(acct)
+ if !v.Known {
+ jsonError(w, http.StatusServiceUnavailable, copyLinksReadFailed)
+ return
+ }
+ out := make([]linkWire, 0, len(v.Cards))
+ for _, c := range v.Cards {
+ lw := linkWire{ID: c.ID, Name: c.Name, CreatedBy: c.CreatedBy, CreatedAt: c.CreatedAt.UTC(),
+ Removing: c.Removing, Apps: make([]linkAppWire, 0, len(c.Apps))}
+ if c.SeenKnown {
+ reachable := c.Reachable
+ lw.Reachable = &reachable
+ if !c.LastSeen.IsZero() {
+ at := c.LastSeen.UTC()
+ lw.LastSeen = &at
+ }
+ }
+ if c.Pending {
+ lw.Revocation = "pending"
+ }
+ for _, a := range c.Apps {
+ lw.Apps = append(lw.Apps, linkAppWire{App: a.Name, URL: a.URL})
+ }
+ out = append(out, lw)
+ }
+ writeJSON(w, http.StatusOK, map[string]any{"links": out})
+}
+
+// handleAPILinkUnlinkPerson is DELETE /api/cli/links/{account}/{id}: the
+// card's Unlink for the CLI, by the account's owner (the browser door's
+// role). 204 once the hub registry has applied the revocation; 202
+// {"revocation":"pending", "message"} while it has not (run it again to
+// finish or check); 503 LD-C13 when the console transaction failed.
+func (s *Server) handleAPILinkUnlinkPerson(w http.ResponseWriter, r *http.Request) {
+ p, acct, ok := s.apiOwnerAccountFor(w, r, copyLinkUnlinkOwnerPurpose)
+ if !ok {
+ return
+ }
+ if !s.allowWrite(p, time.Now()) {
+ jsonError(w, http.StatusTooManyRequests, textTooManyRequests)
+ return
+ }
+ id := r.PathValue("id")
+ l, ok, err := s.accountLink(acct, id)
+ if err != nil {
+ log.Printf("console: unlink %s/%s: read: %v", acct.Sqid, id, err)
+ jsonError(w, http.StatusServiceUnavailable, copyLD13)
+ return
+ }
+ if !ok {
+ jsonError(w, http.StatusNotFound, linkCopy(copyLinkNoSuchLink, "id", id, "account", r.PathValue("account")))
+ return
+ }
+ by := auditActor(p, acct)
+ pending, err := s.personUnlink(r, l, by)
+ switch {
+ case err != nil:
+ log.Printf("console: link %s: unlink by %s: %v", l.ID, by, err)
+ jsonError(w, http.StatusServiceUnavailable, copyLD13)
+ case pending:
+ writeJSON(w, http.StatusAccepted, map[string]string{
+ "revocation": "pending", "message": linkCopy(copyLinkUnlinkPendingCLI, "home", l.Name)})
+ default:
+ w.WriteHeader(http.StatusNoContent)
+ }
+}
diff --git a/internal/console/accountlinks_test.go b/internal/console/accountlinks_test.go
new file mode 100644
index 000000000..3fb541415
--- /dev/null
+++ b/internal/console/accountlinks_test.go
@@ -0,0 +1,350 @@
+package console
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/regionlabel"
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// Linked deployments, Task 6 (spec §5.3, §5.4): the Linked deployments
+// section on the account's Fleet tab, the person-side unlink, and the CLI
+// list.
+
+// pageHas fails when body lacks any of wants.
+func pageHas(t *testing.T, what, body string, wants ...string) {
+ t.Helper()
+ for _, w := range wants {
+ if !strings.Contains(body, w) {
+ t.Fatalf("%s lacks %q:\n%s", what, w, body)
+ }
+ }
+}
+
+// pageLacks fails when body holds any of unwanted.
+func pageLacks(t *testing.T, what, body string, unwanted ...string) {
+ t.Helper()
+ for _, w := range unwanted {
+ if strings.Contains(body, w) {
+ t.Fatalf("%s still holds %q:\n%s", what, w, body)
+ }
+ }
+}
+
+func TestFleetTabShowsLinkedDeployments(t *testing.T) {
+ fx := newLinkFixture(t, "tunnel.example.com")
+ browser := signInPaul(t, fx)
+
+ // Empty state: the heading, the intro and how to link one.
+ _, _, page := get(t, browser, fx.u("/fleet"))
+ pageHas(t, "the Fleet tab with no links", page,
+ esc(copyLD14), esc(copyLD15), esc(linkCopy(copyLD16, "console", fx.ts.URL)))
+
+ before, _, _, _, _ := fx.srv.assembleAccountFleet(context.Background(), fixtureAccount(fx))
+
+ l := mintLink(t, fx, browser, "shop-home")
+ for _, app := range []string{"shop", "blog"} {
+ if status, out := publish(t, fx, l.token, app); status != http.StatusCreated {
+ t.Fatalf("publish %s = %d %v", app, status, out)
+ }
+ }
+ reg := linkRegistryOf(t, fx)
+ if err := reg.SetLinkSeen(l.id, 1, true, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ link, err := fx.st.LinkByID(l.id)
+ if err != nil || link == nil {
+ t.Fatal(link, err)
+ }
+
+ _, _, page = get(t, browser, fx.u("/fleet"))
+ pageHas(t, "the Fleet tab with a reachable link", page,
+ esc(copyLD14), "shop-home",
+ esc(linkCopy(copyLD17, "date", link.CreatedAt.UTC().Format("2 Jan 2006"), "person", link.CreatedBy)),
+ esc(copyLD18), esc(copyLD23), esc(copyLD25), esc(copyLD26),
+ `href="https://`+linkHost(fx, "shop")+`"`, `href="https://`+linkHost(fx, "blog")+`"`,
+ `action="/a/`+fx.sqid+`/links/`+l.id+`/unlink"`)
+ pageLacks(t, "the Fleet tab with a link", page, esc(linkCopy(copyLD16, "console", fx.ts.URL)), esc(copyLD19))
+
+ // Not connected, seen a while ago.
+ if err := reg.SetLinkSeen(l.id, 1, false, time.Now().Add(-3*time.Hour)); err != nil {
+ t.Fatal(err)
+ }
+ _, _, page = get(t, browser, fx.u("/fleet"))
+ pageHas(t, "the Fleet tab with an unreachable link", page,
+ esc(copyLD19), esc(linkCopy(copyLD20, "ago", "3h0m")))
+ pageLacks(t, "the Fleet tab with an unreachable link", page, ">"+esc(copyLD18)+"<")
+
+ // The apps list marks both linked apps as served from the link.
+ _, _, apps := get(t, browser, fx.u("/"))
+ if n := strings.Count(apps, esc(linkCopy(copyLD31, "home", "shop-home"))); n != 2 {
+ t.Fatalf("apps list carries the linked label %d times, want 2:\n%s", n, apps)
+ }
+
+ // Linked apps are neither platform apps nor a region.
+ after, _, _, links, _ := fx.srv.assembleAccountFleet(context.Background(), fixtureAccount(fx))
+ if after.PlatformApps != before.PlatformApps {
+ t.Fatalf("platform apps %d after publishing two linked apps, %d before", after.PlatformApps, before.PlatformApps)
+ }
+ if !links.Known || len(links.Cards) != 1 || len(links.Cards[0].Apps) != 2 || links.Cards[0].Reachable {
+ t.Fatalf("links = %+v", links)
+ }
+ rt := registry.Route{Kind: registry.KindForward, Host: linkHost(fx, "shop"), App: "shop", Account: fx.sqid,
+ Region: registry.LinkPlacementPrefix + l.id}
+ if lab := regionlabel.ForRoute(rt, "ie", regionlabel.Names{}); lab.Link != l.id || lab.Text != "" || lab.Code == "ie" {
+ t.Fatalf("ForRoute(a link row) = %+v, want the link and no region", lab)
+ }
+
+ // A never-seen link says so.
+ l2 := mintLink(t, fx, browser, "blog-home")
+ _ = l2
+ _, _, page = get(t, browser, fx.u("/fleet"))
+ pageHas(t, "the Fleet tab with a new link", page, "blog-home", esc(copyLD21), esc(copyLD24))
+}
+
+// unlinkForm is the Fleet tab's Unlink form for linkID, confirmed or not.
+func unlinkForm(t *testing.T, fx *consoleFixture, c *http.Client, linkID string, confirm bool) (int, string, string) {
+ t.Helper()
+ form := url.Values{"csrf": {sessionToken(t, fx, c)}}
+ if confirm {
+ form.Set("confirmed", "1")
+ }
+ return postForm(t, c, fx.u("/links/"+linkID+"/unlink"), form)
+}
+
+func TestUnlinkFromConsole(t *testing.T) {
+ fx := newLinkFixture(t, "tunnel.example.com")
+ browser := signInPaul(t, fx)
+ l := mintLink(t, fx, browser, "shop-home")
+ acct := linkOpsAccount(t, fx)
+ for _, app := range []string{"shop", "blog"} {
+ if status, out := publish(t, fx, l.token, app); status != http.StatusCreated {
+ t.Fatalf("publish %s = %d %v", app, status, out)
+ }
+ }
+
+ // No CSRF token: refused, nothing changes.
+ if status, _, _ := postForm(t, browser, fx.u("/links/"+l.id+"/unlink"), url.Values{"confirmed": {"1"}}); status != http.StatusForbidden {
+ t.Fatalf("unlink without csrf = %d, want 403", status)
+ }
+ // Unconfirmed: the confirm card, nothing changes.
+ status, _, card := unlinkForm(t, fx, browser, l.id, false)
+ if status != http.StatusOK {
+ t.Fatalf("unconfirmed unlink = %d:\n%s", status, card)
+ }
+ pageHas(t, "the unlink confirm card", card,
+ esc(linkCopy(copyLD27, "home", "shop-home")), esc(linkCopy(copyLD28, "home", "shop-home")), `name="confirmed" value="1"`)
+ if hosts := linkForwardHosts(t, fx, l.id); len(hosts) != 2 {
+ t.Fatalf("forward rows after the confirm card = %v, want both", hosts)
+ }
+ // Unknown and malformed IDs are the owner gate's 404.
+ for _, id := range []string{"0123456789ab", "nope"} {
+ if status, _, _ := unlinkForm(t, fx, browser, id, true); status != http.StatusNotFound {
+ t.Fatalf("unlink %s = %d, want 404", id, status)
+ }
+ }
+
+ // Confirmed: everything goes, and the flash says so.
+ status, loc, _ := unlinkForm(t, fx, browser, l.id, true)
+ if status != http.StatusSeeOther || loc != "/a/"+fx.sqid+"/fleet" {
+ t.Fatalf("unlink = %d -> %q, want 303 to the Fleet tab", status, loc)
+ }
+ _, _, page := get(t, browser, fx.ts.URL+loc)
+ pageHas(t, "the Fleet tab after unlink", page, esc(linkCopy(copyLD29, "home", "shop-home")),
+ esc(linkCopy(copyLD16, "console", fx.ts.URL)))
+ pageLacks(t, "the Fleet tab after unlink", page, `/links/`+l.id+`/unlink`)
+ if hosts := linkForwardHosts(t, fx, l.id); len(hosts) != 0 {
+ t.Fatalf("forward rows after unlink: %v", hosts)
+ }
+ if apps, err := fx.st.LinkedApps(l.id); err != nil || len(apps) != 0 {
+ t.Fatalf("linked apps after unlink = %v %v", apps, err)
+ }
+ for _, app := range []string{"shop", "blog"} {
+ if has, _ := fx.st.HasAppIn(acct.ID, app); has {
+ t.Fatalf("%s outlived unlink", app)
+ }
+ }
+ if _, ok := fx.st.CLIPrincipal(l.token, time.Now()); ok {
+ t.Fatal("the link token still resolves after unlink")
+ }
+ auth, err := linkRegistryOf(t, fx).LinkChannelAuth()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, has := auth[registry.LinkChannelName(l.id)]; has {
+ t.Fatal("LinkChannelAuth still holds the link")
+ }
+
+ // Pending: the registry refuses the revocation. The card stays, marked
+ // removing, with Unlink still offered; once the registry recovers, the
+ // same Unlink finishes it and the card goes.
+ l2 := mintLink(t, fx, browser, "blog-home")
+ if status, out := publish(t, fx, l2.token, "notes"); status != http.StatusCreated {
+ t.Fatalf("publish notes = %d %v", status, out)
+ }
+ real := linkRegistryOf(t, fx)
+ fault := &linkGenFault{consoleRegistry: real, gen: 1 << 62, revFail: 1 << 30}
+ fx.srv.linkRegistry = func() (consoleRegistry, error) { return fault, nil }
+ status, loc, _ = unlinkForm(t, fx, browser, l2.id, true)
+ if status != http.StatusSeeOther {
+ t.Fatalf("pending unlink = %d", status)
+ }
+ _, _, page = get(t, browser, fx.ts.URL+loc)
+ pageHas(t, "the Fleet tab with the unlink pending", page,
+ esc(linkCopy(copyLinkUnlinkPending, "home", "blog-home")), "blog-home", esc(copyLinkRemovingPending),
+ `action="/a/`+fx.sqid+`/links/`+l2.id+`/unlink"`)
+ if hosts := linkForwardHosts(t, fx, l2.id); len(hosts) != 1 {
+ t.Fatalf("forward rows while pending = %v", hosts)
+ }
+ fault.mu.Lock()
+ fault.revFail = 0
+ fault.mu.Unlock()
+ status, loc, _ = unlinkForm(t, fx, browser, l2.id, true)
+ if status != http.StatusSeeOther {
+ t.Fatalf("unlink again = %d", status)
+ }
+ _, _, page = get(t, browser, fx.ts.URL+loc)
+ pageHas(t, "the Fleet tab after the second unlink", page, esc(linkCopy(copyLD29, "home", "blog-home")))
+ pageLacks(t, "the Fleet tab after the second unlink", page, `/links/`+l2.id+`/unlink`)
+ if hosts := linkForwardHosts(t, fx, l2.id); len(hosts) != 0 {
+ t.Fatalf("forward rows after the second unlink: %v", hosts)
+ }
+
+ // Revoked in the registry but an apps row left: still removing (LD-C22).
+ l3 := mintLink(t, fx, browser, "docs-home")
+ if _, err := fx.st.CreateLinkedApp(acct.ID, "docs", "test", l3.id, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.st.RevokeLink(l3.id, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if err := fx.srv.syncLinkChannel(context.Background(), l3.id); err != nil {
+ t.Fatal(err)
+ }
+ _, _, page = get(t, browser, fx.u("/fleet"))
+ pageHas(t, "the Fleet tab with an apps row left", page, "docs-home", esc(copyLD22))
+
+ // A member sees the section but not the Unlink form, and the door is
+ // the owner gate's 404 for them.
+ if err := fx.st.AddMember(OpsAccountID, "sam@keymail.dev", RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ fx.setUser("sam@keymail.dev")
+ member := newBrowser(t)
+ signUp(t, fx, member, "code-links-member")
+ _, _, page = get(t, member, fx.u("/fleet"))
+ pageHas(t, "the member's Fleet tab", page, "docs-home")
+ pageLacks(t, "the member's Fleet tab", page, `/unlink"`)
+ if status, _, _ := unlinkForm(t, fx, member, l3.id, true); status != http.StatusNotFound {
+ t.Fatalf("member unlink = %d, want 404", status)
+ }
+}
+
+func TestLinksListCLI(t *testing.T) {
+ fx := newLinkFixture(t, "tunnel.example.com")
+ browser := signInPaul(t, fx)
+ token := cliToken(t, fx, "paul@keymail.dev", "code-links-cli")
+ listURL := fx.ts.URL + "/api/cli/links/" + fx.sqid
+
+ status, body := getJSON(t, listURL, token)
+ if links, ok := body["links"].([]any); status != http.StatusOK || !ok || len(links) != 0 {
+ t.Fatalf("empty list = %d %v, want 200 with an empty links array", status, body)
+ }
+
+ l := mintLink(t, fx, browser, "shop-home")
+ if status, out := publish(t, fx, l.token, "shop"); status != http.StatusCreated {
+ t.Fatalf("publish = %d %v", status, out)
+ }
+ seen := time.Now().Add(-time.Minute).Truncate(time.Second)
+ if err := linkRegistryOf(t, fx).SetLinkSeen(l.id, 1, true, seen); err != nil {
+ t.Fatal(err)
+ }
+ status, body = getJSON(t, listURL, token)
+ links, _ := body["links"].([]any)
+ if status != http.StatusOK || len(links) != 1 {
+ t.Fatalf("list = %d %v", status, body)
+ }
+ got := links[0].(map[string]any)
+ if got["id"] != l.id || got["name"] != "shop-home" || got["reachable"] != true || got["removing"] != false ||
+ got["last_seen"] != seen.UTC().Format(time.RFC3339) || got["created_by"] == "" || got["created_at"] == "" {
+ t.Fatalf("listed link = %v", got)
+ }
+ apps, _ := got["apps"].([]any)
+ if len(apps) != 1 || apps[0].(map[string]any)["app"] != "shop" ||
+ apps[0].(map[string]any)["url"] != "https://"+linkHost(fx, "shop") {
+ t.Fatalf("listed apps = %v", got["apps"])
+ }
+
+ // Another account's segment is the account gate's 404.
+ if status, _, _ := rawReq(t, http.MethodGet, fx.ts.URL+"/api/cli/links/nosuchacct", token, ""); status != http.StatusNotFound {
+ t.Fatalf("list of a stranger's account = %d, want 404", status)
+ }
+
+ // The person CLI's unlink: pending while the registry refuses, then
+ // done; the list shows the link removing, then not at all.
+ del := func() (int, string) {
+ status, _, out := rawReq(t, http.MethodDelete, listURL+"/"+l.id, token, "")
+ return status, out
+ }
+ real := linkRegistryOf(t, fx)
+ fault := &linkGenFault{consoleRegistry: real, gen: 1 << 62, revFail: 1 << 30}
+ fx.srv.linkRegistry = func() (consoleRegistry, error) { return fault, nil }
+ status, out := del()
+ if status != http.StatusAccepted || !strings.Contains(out, `"revocation":"pending"`) ||
+ !strings.Contains(out, jsonEsc(linkCopy(copyLinkUnlinkPendingCLI, "home", "shop-home"))) {
+ t.Fatalf("CLI unlink with the registry failing = %d %s, want 202 pending", status, out)
+ }
+ _, body = getJSON(t, listURL, token)
+ links, _ = body["links"].([]any)
+ if len(links) != 1 || links[0].(map[string]any)["removing"] != true || links[0].(map[string]any)["revocation"] != "pending" {
+ t.Fatalf("list while pending = %v", body)
+ }
+ fault.mu.Lock()
+ fault.revFail = 0
+ fault.mu.Unlock()
+ if status, out := del(); status != http.StatusNoContent {
+ t.Fatalf("CLI unlink again = %d %s, want 204", status, out)
+ }
+ _, body = getJSON(t, listURL, token)
+ if links, _ := body["links"].([]any); len(links) != 0 {
+ t.Fatalf("list after unlink = %v, want none", body)
+ }
+ if hosts := linkForwardHosts(t, fx, l.id); len(hosts) != 0 {
+ t.Fatalf("forward rows after the CLI unlink: %v", hosts)
+ }
+ // An ID the account never had is a 404.
+ if status, _, _ := rawReq(t, http.MethodDelete, listURL+"/0123456789ab", token, ""); status != http.StatusNotFound {
+ t.Fatalf("CLI unlink of an unknown link = %d, want 404", status)
+ }
+ // A member may list but not unlink.
+ if err := fx.st.AddMember(OpsAccountID, "sam@keymail.dev", RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ l2 := mintLink(t, fx, browser, "blog-home")
+ samToken := cliToken(t, fx, "sam@keymail.dev", "code-links-cli-sam")
+ if status, _ := getJSON(t, listURL, samToken); status != http.StatusOK {
+ t.Fatalf("member list = %d, want 200", status)
+ }
+ if status, _, _ := rawReq(t, http.MethodDelete, listURL+"/"+l2.id, samToken, ""); status != http.StatusForbidden {
+ t.Fatalf("member CLI unlink = %d, want 403", status)
+ }
+}
+
+// jsonEsc is s as encoding/json writes it inside a string (HTML-escaped).
+func jsonEsc(s string) string {
+ return strings.NewReplacer("<", `\u003c`, ">", `\u003e`, "&", `\u0026`).Replace(s)
+}
+
+// claimLinkUnlinked is the claim invariant's effect check for a person's
+// unlink: the link's token no longer resolves and its channel is gone.
+func claimLinkUnlinked(t *testing.T, cx *claimCase, _ claimReply) string {
+ if _, ok := cx.st.CLIPrincipal(cx.vars["linktoken"], time.Now()); ok {
+ return "the link token still resolves after unlink"
+ }
+ return claimLinkChannelIs(t, cx, "")
+}
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go
index b61abe5c0..6a225c001 100644
--- a/internal/console/claim_invariant_fixtures_test.go
+++ b/internal/console/claim_invariant_fixtures_test.go
@@ -924,6 +924,9 @@ var claimFixtures = map[string]claimFixture{
"route GET /auth/cli/whoami": claimRead("names the bearer's principal"),
"route GET /api/link": claimRead("names the link and its linked apps; linkRoute's sync rewrites only the link's own channel and links row"),
"route POST /api/link/rotate": claimNonApp("replaces the link's credential: its cli_tokens rows, its links row and its channel in the hub registry; names no app"),
+ "route GET /api/cli/links/{account}": claimRead("lists the account's linked deployments: its links rows and apps rows, and the registry's channels, forward rows and connection record; writes nothing"),
+ "route DELETE /api/cli/links/{account}/{id}": claimNonApp("the owner unlinks a deployment, as DELETE /api/link: its links row, its credential and its channel; a host-claim console holds no linked apps (publish refuses there)"),
+ "route POST /a/{sqid}/links/{id}/unlink": claimNonApp("the Fleet tab's Unlink, as DELETE /api/cli/links/{account}/{id}"),
"route DELETE /api/link": claimNonApp("revokes the link: its links row, its credential and its channel; a host-claim console holds no linked apps (publish refuses there)"),
"route POST /api/link/publications": {refused: &claimRefusalFixture{
apps: claimRefs("bab/titogo"),
diff --git a/internal/console/claim_invariant_probes_nonapp_test.go b/internal/console/claim_invariant_probes_nonapp_test.go
index 1d3ca2eb6..2d0d4ccb4 100644
--- a/internal/console/claim_invariant_probes_nonapp_test.go
+++ b/internal/console/claim_invariant_probes_nonapp_test.go
@@ -640,6 +640,18 @@ var claimNonAppProbes = map[string]claimProbe{
return claimLinkChannelIs(t, cx, hashToken(out.Token))
},
},
+ "route DELETE /api/cli/links/{account}/{id}": {
+ setup: func(t *testing.T, cx *claimCase) { cx.vars["linktoken"], cx.vars["linkid"] = claimMintLink(t, cx) },
+ do: claimAPIReply(http.MethodDelete, "/api/cli/links/bab/<linkid>", ""),
+ status: http.StatusNoContent,
+ effect: claimLinkUnlinked,
+ },
+ "route POST /a/{sqid}/links/{id}/unlink": {
+ setup: func(t *testing.T, cx *claimCase) { cx.vars["linktoken"], cx.vars["linkid"] = claimMintLink(t, cx) },
+ do: claimFormReply("/a/bab/links/<linkid>/unlink", "confirmed", "1"),
+ status: http.StatusSeeOther, loc: "/a/bab/fleet",
+ effect: claimLinkUnlinked,
+ },
"route DELETE /api/link": {
setup: func(t *testing.T, cx *claimCase) { cx.vars["linktoken"], cx.vars["linkid"] = claimMintLink(t, cx) },
do: func(t *testing.T, cx *claimCase) claimReply {
diff --git a/internal/console/claim_invariant_probes_read_test.go b/internal/console/claim_invariant_probes_read_test.go
index 426b922d6..63a954a3d 100644
--- a/internal/console/claim_invariant_probes_read_test.go
+++ b/internal/console/claim_invariant_probes_read_test.go
@@ -384,6 +384,8 @@ var claimReadProbes = map[string]claimProbe{
"route GET /api/cli/system/status": claimAPIRead(func(t *testing.T, cx *claimCase) { cx.systemRelease(t, "canary", "66587fa") },
"/api/cli/system/status", `"pointers"`, `"version":"66587fa"`),
"route GET /auth/cli/whoami": claimAPIRead(nil, "/auth/cli/whoami", `"address":"`+claimFxOwner+`"`),
+ "route GET /api/cli/links/{account}": claimAPIRead(func(t *testing.T, cx *claimCase) { cx.vars["linktoken"], cx.vars["linkid"] = claimMintLink(t, cx) },
+ "/api/cli/links/bab", `"id":"<linkid>"`, `"name":"shop-home"`),
"route GET /api/link": {
setup: func(t *testing.T, cx *claimCase) { cx.vars["linktoken"], cx.vars["linkid"] = claimMintLink(t, cx) },
do: func(t *testing.T, cx *claimCase) claimReply {
diff --git a/internal/console/links_copy.go b/internal/console/links_copy.go
index 2941e63bb..422be64c3 100644
--- a/internal/console/links_copy.go
+++ b/internal/console/links_copy.go
@@ -33,6 +33,42 @@ const (
copyLD12 = "Custom domains can't be attached to an app served from a home deployment yet. Its Carloku address keeps working."
// LD-C13: a link door's 503 when the link sync fails.
copyLD13 = "Carloku couldn't update this link just now. Try again in a minute."
+ // LD-C14: the Fleet tab's Linked deployments section heading.
+ copyLD14 = "Linked deployments"
+ // LD-C15: the section's intro.
+ copyLD15 = "Deployments you run yourself that publish apps through this account."
+ // LD-C16: the section's empty state; {console} is this console's address.
+ copyLD16 = "No linked deployments. To link one, run carlos link create --to {console} on it."
+ // LD-C17: a card's linked when and by whom.
+ copyLD17 = "Linked {date} by {person}"
+ // LD-C18: a card's reachable state.
+ copyLD18 = "Reachable"
+ // LD-C19: a card's not-reachable state.
+ copyLD19 = "Not reachable"
+ // LD-C20: a card's last seen.
+ copyLD20 = "Last seen {ago} ago"
+ // LD-C21: a card for a link that never connected.
+ copyLD21 = "Not seen yet"
+ // LD-C22: a card whose unlink is in progress ("removing").
+ copyLD22 = "Removing. Its apps are already offline on Carloku."
+ // LD-C23: a card's published apps heading.
+ copyLD23 = "Published apps"
+ // LD-C24: a card with no published apps.
+ copyLD24 = "No apps published yet."
+ // LD-C25: a published app's kind (slice 1 has only this kind).
+ copyLD25 = "Runs at home"
+ // LD-C26: a card's Unlink button.
+ copyLD26 = "Unlink"
+ // LD-C27: the Unlink confirm text.
+ copyLD27 = "Unlink {home}? Its published apps stop working at their Carloku addresses, and it can't publish here again unless someone links it again. The apps keep running at home."
+ // LD-C28: the Unlink confirm button.
+ copyLD28 = "Unlink {home}"
+ // LD-C29: the flash after an unlink.
+ copyLD29 = "Unlinked {home}."
+ // LD-C30: the flash when an unlink fails.
+ copyLD30 = "Could not unlink {home}. Try again."
+ // LD-C31: the account apps list's label on a linked app.
+ copyLD31 = "Served from {home}"
)
// linkCopy fills a deck string's {placeholders} from kv pairs (key, value,
@@ -45,9 +81,9 @@ func linkCopy(s string, kv ...string) string {
return strings.NewReplacer(pairs...).Replace(s)
}
-// Linked deployments' strings NOT in the approved deck: drafts awaiting the
-// copy-review addendum, one place so the review can read them together and
-// the approved text lands in one edit.
+// Linked deployments' approved addendum 1: strings that were drafts outside
+// the deck, APPROVED by Paul unchanged in copy review
+// jt4s7mxwamzso7k34cuvloqfr4 (2026-11-10). Use them verbatim.
const (
// The 400 from POST /auth/cli/start for a purpose other than "link"
// (null included); read by the home CLI.
@@ -71,6 +107,12 @@ const (
// code expired or was already used, in place of the person login's
// "Run carlos auth login again".
copyLinkApproveExpired = "That code has expired or was already used. Run carlos link create again for a fresh one."
+)
+
+// Linked deployments' strings NOT in the approved deck: drafts awaiting the
+// copy-review addendum, one place so the review can read them together and
+// the approved text lands in one edit.
+const (
// The 503 an app door answers when the linked-app guard could not read
// whether the app is linked (linkedAppRefusal fails closed).
copyLinkedCheckFailed = "Could not check this app just now. Try again in a minute."
@@ -85,4 +127,24 @@ const (
// claims on, where no claim operation gates a linked app's row; read by
// the home CLI.
copyLinkedHostClaim = "this console cannot publish linked apps while host claims are on"
+ // The Fleet tab's flash after an Unlink whose revocation the hub
+ // registry has not applied yet (unlink's errUnlinkPending): unlinked on
+ // the console, the connection not cut yet, retried by itself.
+ copyLinkUnlinkPending = "Unlinked {home} here. Carloku has not cut its connection yet and keeps trying by itself. Until it does, its apps may still answer."
+ // The person CLI's 202 from DELETE /api/cli/links/{account}/{id} in the
+ // same case, beside {"revocation":"pending"}; read by the CLI.
+ copyLinkUnlinkPendingCLI = "unlinked {home} here. Carloku has not cut its connection yet and keeps trying by itself. until it does, its apps may still answer"
+ // A card in the removing state while the hub registry still holds the
+ // link's connection or an app's address (the revocation pending), in
+ // place of LD-C22, whose "already offline" is not yet true then.
+ copyLinkRemovingPending = "Removing. Carloku has not cut its connection yet, so its apps may still answer."
+ // The Fleet tab's flash, and the person CLI list's 503, when the
+ // account's links or their state could not be read.
+ copyLinksReadFailed = "Your linked deployments could not be read just now."
+ // Completes the owner gate's 403 ("only an account owner can ...") at
+ // DELETE /api/cli/links/{account}/{id}; read by the CLI.
+ copyLinkUnlinkOwnerPurpose = "unlink a deployment"
+ // The 404 from DELETE /api/cli/links/{account}/{id} for an ID the
+ // account has no link under; read by the CLI.
+ copyLinkNoSuchLink = "no linked deployment {id} in {account}"
)
diff --git a/internal/console/links_store.go b/internal/console/links_store.go
index 649bb0747..09a0e3cd0 100644
--- a/internal/console/links_store.go
+++ b/internal/console/links_store.go
@@ -500,3 +500,24 @@ WHERE t.token_hash = ? AND t.kind = ? AND l.token_hash = t.token_hash AND l.acco
p.Kind = PrincipalLink
return p, true
}
+
+// linkedAppHomes maps each linked app of accountID to the name of the
+// deployment it is served from: what the account's app list labels it
+// with (LD-C31) and what the Fleet tab leaves out of its platform count.
+func (s *Store) linkedAppHomes(accountID int64) (map[string]string, error) {
+ rows, err := s.db.Query(`SELECT p.app, l.name FROM apps p JOIN links l ON l.id = p.linked_link_id
+WHERE p.account_id = ? AND p.linked_link_id != ''`, accountID)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ out := map[string]string{}
+ for rows.Next() {
+ var app, home string
+ if err := rows.Scan(&app, &home); err != nil {
+ return nil, err
+ }
+ out[app] = home
+ }
+ return out, rows.Err()
+}
diff --git a/internal/console/remoteinstances_test.go b/internal/console/remoteinstances_test.go
index 0ff137b0b..2ec67c107 100644
--- a/internal/console/remoteinstances_test.go
+++ b/internal/console/remoteinstances_test.go
@@ -319,7 +319,7 @@ func TestRemoteInstancePages(t *testing.T) {
}
// Fleet tab: one app on the shared fleet.
- card, _, _, warn := tb.fx.srv.assembleAccountFleet(context.Background(), tb.account(t))
+ card, _, _, _, warn := tb.fx.srv.assembleAccountFleet(context.Background(), tb.account(t))
if card.PlatformApps != 1 || !card.PlacementKnown || warn != "" {
t.Fatalf("fleet card = %+v warn %q, want 1 app on the shared fleet", card, warn)
}
diff --git a/internal/console/routedecls.go b/internal/console/routedecls.go
index 8aa097413..2db5db03d 100644
--- a/internal/console/routedecls.go
+++ b/internal/console/routedecls.go
@@ -341,6 +341,9 @@ var routeDecls = []routeDecl{
{Pattern: "POST /a/{sqid}/fleets/{fleet}/detach", Handler: (*Server).handleFleetDetachBoxPage},
{Pattern: "POST /a/{sqid}/fleets/{fleet}/tags", Handler: (*Server).handleFleetTagBoxPage},
{Pattern: "POST /a/{sqid}/fleets/{fleet}/place", Handler: (*Server).handleFleetPlacePage},
+ // Linked deployments (accountlinks.go): the Fleet tab card's Unlink,
+ // owner-gated with CSRF like a fleet box's detach.
+ {Pattern: "POST /a/{sqid}/links/{id}/unlink", Handler: (*Server).handleLinkUnlinkPage},
// The object store's destroy door (appsettings.go, issue #55): the account
// owner, the bucket name typed out, and a passkey. It is the only console
// route that destroys a customer's objects outside the app trash, and
@@ -888,6 +891,10 @@ var routeDecls = []routeDecl{
{Pattern: "POST /api/cli/fleets/{account}/managed-plan", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIManagedFleetPlan},
{Pattern: "POST /api/cli/fleets/{account}/{fleet}/managed-boxes", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIManagedFleetAdd},
{Pattern: "GET /api/cli/fleets/{account}", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIFleetList},
+ // Linked deployments for a person (accountlinks.go): the Fleet tab's
+ // list (any member) and its Unlink (the owner).
+ {Pattern: "GET /api/cli/links/{account}", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPILinksList},
+ {Pattern: "DELETE /api/cli/links/{account}/{id}", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPILinkUnlinkPerson},
{Pattern: "GET /api/cli/fleets/{account}/{fleet}", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIFleetShow},
{Pattern: "POST /api/cli/fleets/{account}/{fleet}/boxes", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIFleetAddBox},
{Pattern: "POST /api/cli/fleets/{account}/{fleet}/boxes/{label}/rotate", Kind: kindCLI, Allow: svcrole.Set{}, Handler: (*Server).handleAPIFleetRotateBox},
diff --git a/internal/console/server.go b/internal/console/server.go
index e2b6c4904..95e400941 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -2653,6 +2653,13 @@ type page struct {
SharedFleet *sharedFleetCard
AccountFleets []accountFleetCard
FleetsKnown bool
+ // The Fleet tab's Linked deployments section (accountlinks.go):
+ // LinkedDeploymentsKnown says the links read SUCCEEDED, the same rule
+ // as FleetsKnown; LinkSection is its fixed text. (Not "AccountLinks":
+ // that is the account nav, mobilenav.go.)
+ LinkedDeployments []accountLinkCard
+ LinkedDeploymentsKnown bool
+ LinkSection linkSectionCopy
// RotatedLabel/RotatedToken are set only on the response to a rotate
// POST, to show the fresh bearer token exactly once — never stored,
// never re-derivable from a later view of this same page.
@@ -2714,6 +2721,9 @@ type appRow struct {
// Elsewhere RC-15's counts of its instances in other regions.
Region appRegionFacts
Elsewhere []regionCount
+ // ServedFrom labels a linked app (LD-C31, "Served from <home>") in
+ // place of its region: it runs at its home deployment, not in one.
+ ServedFrom string
// Starred is the viewer's own star (applist.go). ExpiresAt is a
// temporary app's expiry, zero for a permanent app.
Starred bool
@@ -4029,11 +4039,20 @@ func (s *Server) handleAccountHome(w http.ResponseWriter, r *http.Request) {
s.renderMessage(w, r, http.StatusInternalServerError, "Error", "Could not read platform state. Please try again.")
return
}
+ // Linked apps are labelled by their home. Best-effort: a failed read
+ // costs the label, never the page.
+ homes, err := s.store.linkedAppHomes(acct.ID)
+ if err != nil {
+ log.Printf("console: app list %s: linked apps: %v", acct.Sqid, err)
+ }
for _, v := range views {
row := summarize(v, acct.Sqid)
// Assemble listed the registry: its rows give the legacy fleet.
row.Region = s.regionFactsFor(acct, v.App, v.routeFleet, true)
row.Elsewhere = elsewhereCounts(v.Routes, acct.Sqid, row.Region)
+ if home, ok := homes[v.App]; ok {
+ row.ServedFrom = linkCopy(copyLD31, "home", home)
+ }
p.Apps = append(p.Apps, row)
// Over every app, before the q filter narrows the lists.
if appIsLive(row, v, acct.Sqid) {
diff --git a/internal/console/svcroutes_test.go b/internal/console/svcroutes_test.go
index 2573da2c0..57203205d 100644
--- a/internal/console/svcroutes_test.go
+++ b/internal/console/svcroutes_test.go
@@ -181,6 +181,11 @@ var closedDoors = []string{
// Setting a fleet's secrets key decides who can read the fleet's future
// secrets. Same cut, and owner-gated inside.
"PUT /api/cli/fleets/{account}/{fleet}/secrets-key",
+ // A linked deployment's card, listed and unlinked by a person: the
+ // Fleet tab's section for the CLI (linked deployments spec §5.3, §5.4).
+ // Same cut as the fleet doors; the unlink is owner-gated inside.
+ "GET /api/cli/links/{account}",
+ "DELETE /api/cli/links/{account}/{id}",
// Minting, rotating and revoking a SERVICE credential is the same cut
// seen from the other side: these are the doors that hand out authority,
// so a credential must never reach them — not even the admin one, and
@@ -1724,8 +1729,8 @@ func TestEveryClosedDoorRefusesAServiceCredential(t *testing.T) {
}
seen++
}
- if seen != len(closedDoors) || seen != 89 {
- t.Errorf("walked %d closed doors, want all %d (and 89 today: three domain purchase doors, two managed admission doors, the fleet show door, two managed configuration doors, 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, seven fleets, the fleet secrets key door, four services, two email credentials, email pause, the build probe, the swap policy, the copy count, the interactive setting, the interactive session door, 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, the PDF status door, 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, the billing revenue and payments doors, the billing house door, and the claimed source door)",
+ if seen != len(closedDoors) || seen != 91 {
+ t.Errorf("walked %d closed doors, want all %d (and 91 today: three domain purchase doors, two managed admission doors, the fleet show door, two managed configuration doors, 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, seven fleets, the fleet secrets key door, the two person link doors (list and unlink), four services, two email credentials, email pause, the build probe, the swap policy, the copy count, the interactive setting, the interactive session door, 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, the PDF status door, 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, the billing revenue and payments doors, the billing house door, and the claimed source door)",
seen, len(closedDoors))
}
}
diff --git a/internal/console/templates/account_fleet.html b/internal/console/templates/account_fleet.html
index 833f4acd2..6c6c953a4 100644
--- a/internal/console/templates/account_fleet.html
+++ b/internal/console/templates/account_fleet.html
@@ -39,6 +39,31 @@
{{else if .FleetsKnown}}<p class="small">No fleets of your own yet.</p>
{{else}}<p class="small">Your fleets could not be read just now.</p>{{end}}
+<h2>{{.LinkSection.Heading}}</h2>
+<p class="small">{{.LinkSection.Intro}}</p>
+{{if .LinkedDeployments}}
+{{range .LinkedDeployments}}
+<div class="sectionhead">
+ <h3>{{.Name}}</h3>
+ {{if $.IsOwner}}<form method="post" action="{{$.Base}}/links/{{.ID}}/unlink" class="inline">
+ <input type="hidden" name="csrf" value="{{$.CSRF}}">
+ <button type="submit" class="btn-sm btn-secondary">{{$.LinkSection.Unlink}}</button>
+ </form>{{end}}
+</div>
+<p class="small">{{.LinkedText}}</p>
+{{if .Removing}}<p><span class="chip chip-canary">{{.StateText}}</span></p>
+{{else}}{{if .SeenKnown}}<p>{{if .Reachable}}<span class="chip chip-health-ok">{{$.LinkSection.Reachable}}</span>{{else}}<span class="chip chip-stale">{{$.LinkSection.NotReachable}}</span>{{end}}
+ {{if .StateText}}<span class="small">{{.StateText}}</span>{{end}}</p>{{end}}
+<h4>{{$.LinkSection.AppsHeading}}</h4>
+{{if .Apps}}<ul>
+ {{range .Apps}}<li><a href="{{$.Nav}}/apps/{{.Name}}">{{.Name}}</a>{{if .URL}} <a href="{{.URL}}">{{.URL}}</a>{{end}} <span class="chip chip-env">{{$.LinkSection.Kind}}</span></li>
+ {{end}}
+</ul>{{else}}<p class="small">{{$.LinkSection.NoApps}}</p>{{end}}
+{{end}}
+{{end}}
+{{else if .LinkedDeploymentsKnown}}<p class="small">{{.LinkSection.Empty}}</p>
+{{else}}<p class="small">{{.LinkSection.Unreadable}}</p>{{end}}
+
<h2>Bring your own fleet</h2>
<p>Run your apps on hardware you own — an office box, a Raspberry Pi, your own cloud account.
Your boxes dial out to the platform; nothing connects in.</p>
diff --git a/internal/console/templates/apps.html b/internal/console/templates/apps.html
index 771bdca81..732363671 100644
--- a/internal/console/templates/apps.html
+++ b/internal/console/templates/apps.html
@@ -23,7 +23,7 @@
<button class="linkish" type="submit" aria-label="{{if .Starred}}{{$.AppListCopy.Unstar}}{{else}}{{$.AppListCopy.Star}}{{end}}" aria-pressed="{{.Starred}}"> {{icon "star"}}</button>
</form><a href="{{$.Nav}}/apps/{{.App}}">{{template "app_mark" .App}}<span class="app-label">{{.App}}</span></a></td>
<td role="cell" class="app-host">{{if .URL}}<a href="https://{{.URL}}">{{.URL}}</a>{{else}}—{{end}}</td>
- <td role="cell" class="app-region">{{if .Region.Known}}{{.Region.Text}}{{range .Elsewhere}}<br><span class="small">{{.Line}}</span>{{end}}{{else}}—{{end}}</td>
+ <td role="cell" class="app-region">{{if .ServedFrom}}{{.ServedFrom}}{{else if .Region.Known}}{{.Region.Text}}{{range .Elsewhere}}<br><span class="small">{{.Line}}</span>{{end}}{{else}}—{{end}}</td>
<td role="cell" class="app-health"><span class="chip chip-health-{{.Verdict}}">{{.VerdictLabel}}</span></td>
<td role="cell" class="app-observed{{if not (or .Deployment.Mixed .Deployment.UniformVersion .CanaryN)}} app-empty{{end}}"><span class="app-meta-label">{{$.StatusCopy.ObservedLabel}}</span>{{if .Deployment.Mixed}}{{$.StatusCopy.Mixed}}{{else if .Deployment.UniformVersion}}<code>{{.Deployment.UniformVersion}}</code>{{else}}—{{end}}{{if .CanaryN}} <span class="chip chip-canary">{{.CanaryN}} test version{{if ne .CanaryN 1}}s{{end}}</span>{{end}}</td>
<td role="cell" class="app-expiry{{if .ExpiresAt.IsZero}} app-empty{{end}}"><span class="app-meta-label">{{$.AppListCopy.Expires}}</span>{{if not .ExpiresAt.IsZero}}<time datetime="{{.ExpiresAt.Format "2006-01-02T15:04:05Z07:00"}}">{{fmtTime .ExpiresAt}}</time>
@@ -40,7 +40,7 @@
<button class="linkish" type="submit" aria-label="{{if .Starred}}{{$.AppListCopy.Unstar}}{{else}}{{$.AppListCopy.Star}}{{end}}" aria-pressed="{{.Starred}}"> {{icon "star"}}</button>
</form><a href="{{$.Nav}}/apps/{{.App}}">{{template "app_mark" .App}}<span class="app-label">{{.App}}</span></a></td>
<td role="cell" class="app-host">{{if .URL}}<a href="https://{{.URL}}">{{.URL}}</a>{{else}}—{{end}}</td>
- <td role="cell" class="app-region">{{if .Region.Known}}{{.Region.Text}}{{range .Elsewhere}}<br><span class="small">{{.Line}}</span>{{end}}{{else}}—{{end}}</td>
+ <td role="cell" class="app-region">{{if .ServedFrom}}{{.ServedFrom}}{{else if .Region.Known}}{{.Region.Text}}{{range .Elsewhere}}<br><span class="small">{{.Line}}</span>{{end}}{{else}}—{{end}}</td>
<td role="cell" class="app-health"><span class="chip chip-health-{{.Verdict}}">{{.VerdictLabel}}</span></td>
<td role="cell" class="app-observed{{if not (or .Deployment.Mixed .Deployment.UniformVersion .CanaryN)}} app-empty{{end}}"><span class="app-meta-label">{{$.StatusCopy.ObservedLabel}}</span>{{if .Deployment.Mixed}}{{$.StatusCopy.Mixed}}{{else if .Deployment.UniformVersion}}<code>{{.Deployment.UniformVersion}}</code>{{else}}—{{end}}{{if .CanaryN}} <span class="chip chip-canary">{{.CanaryN}} test version{{if ne .CanaryN 1}}s{{end}}</span>{{end}}</td>
<td role="cell" class="app-expiry{{if .ExpiresAt.IsZero}} app-empty{{end}}"><span class="app-meta-label">{{$.AppListCopy.Expires}}</span>{{if not .ExpiresAt.IsZero}}<time datetime="{{.ExpiresAt.Format "2006-01-02T15:04:05Z07:00"}}">{{fmtTime .ExpiresAt}}</time>
@@ -57,7 +57,7 @@
<button class="linkish" type="submit" aria-label="{{if .Starred}}{{$.AppListCopy.Unstar}}{{else}}{{$.AppListCopy.Star}}{{end}}" aria-pressed="{{.Starred}}"> {{icon "star"}}</button>
</form><a href="{{$.Nav}}/apps/{{.App}}">{{template "app_mark" .App}}<span class="app-label">{{.App}}</span></a></td>
<td role="cell" class="app-host">{{if .URL}}<a href="https://{{.URL}}">{{.URL}}</a>{{else}}—{{end}}</td>
- <td role="cell" class="app-region">{{if .Region.Known}}{{.Region.Text}}{{range .Elsewhere}}<br><span class="small">{{.Line}}</span>{{end}}{{else}}—{{end}}</td>
+ <td role="cell" class="app-region">{{if .ServedFrom}}{{.ServedFrom}}{{else if .Region.Known}}{{.Region.Text}}{{range .Elsewhere}}<br><span class="small">{{.Line}}</span>{{end}}{{else}}—{{end}}</td>
<td role="cell" class="app-health"><span class="chip chip-health-{{.Verdict}}">{{.VerdictLabel}}</span></td>
<td role="cell" class="app-observed{{if not (or .Deployment.Mixed .Deployment.UniformVersion .CanaryN)}} app-empty{{end}}"><span class="app-meta-label">{{$.StatusCopy.ObservedLabel}}</span>{{if .Deployment.Mixed}}{{$.StatusCopy.Mixed}}{{else if .Deployment.UniformVersion}}<code>{{.Deployment.UniformVersion}}</code>{{else}}—{{end}}{{if .CanaryN}} <span class="chip chip-canary">{{.CanaryN}} test version{{if ne .CanaryN 1}}s{{end}}</span>{{end}}</td>
<td role="cell" class="app-expiry{{if .ExpiresAt.IsZero}} app-empty{{end}}"><span class="app-meta-label">{{$.AppListCopy.Expires}}</span>{{if not .ExpiresAt.IsZero}}<time datetime="{{.ExpiresAt.Format "2006-01-02T15:04:05Z07:00"}}">{{fmtTime .ExpiresAt}}</time>
diff --git a/internal/console/testdata/claim-routes.txt b/internal/console/testdata/claim-routes.txt
index f049f2790..a1b6b570f 100644
--- a/internal/console/testdata/claim-routes.txt
+++ b/internal/console/testdata/claim-routes.txt
@@ -22,6 +22,7 @@ route DELETE /api/cli/apps/{account}/{app}/email/events/push
route DELETE /api/cli/apps/{account}/{app}/instances/{host}
route DELETE /api/cli/apps/{account}/{app}/instances/{host}/move
route DELETE /api/cli/apps/{account}/{app}/sidecars/{name}
+route DELETE /api/cli/links/{account}/{id}
route DELETE /api/cli/system/geoip
route DELETE /api/link
route DELETE /api/link/publications/{app}
@@ -130,6 +131,7 @@ route GET /api/cli/billing/problems
route GET /api/cli/billing/revenue
route GET /api/cli/fleets/{account}
route GET /api/cli/fleets/{account}/{fleet}
+route GET /api/cli/links/{account}
route GET /api/cli/services/{account}
route GET /api/cli/status/instances
route GET /api/cli/status/layout
@@ -233,6 +235,7 @@ route POST /a/{sqid}/getting-started/show
route POST /a/{sqid}/getting-started/skip
route POST /a/{sqid}/invite
route POST /a/{sqid}/invite/revoke
+route POST /a/{sqid}/links/{id}/unlink
route POST /a/{sqid}/members/remove
route POST /a/{sqid}/members/transfer
route POST /a/{sqid}/plan/keep
diff --git a/internal/provision/linked_deployments_slice1_census_test.go b/internal/provision/linked_deployments_slice1_census_test.go
index 21ed9afd8..611427e6a 100644
--- a/internal/provision/linked_deployments_slice1_census_test.go
+++ b/internal/provision/linked_deployments_slice1_census_test.go
@@ -21,11 +21,38 @@ package provision
// publication header, from the client's request, beside the tunnel
// markers it already deletes. A header delete on the request; the gzip
// pool Put is unchanged. nonrecord / sel:Put, as before.
+//
+// Tasks 5 and 6 (serving console: link API, linked apps, the linked-app
+// guard, and the Fleet tab's Linked deployments) re-digest five units and
+// add one; no record write is added and no class or kind changes:
+// - Server.handleBrowserRestart, Server.handleInstanceRetry and
+// Server.updatesFormGate (Task 5): each consults the linked-app guard
+// (refuseLinkedPage) after resolving the app and returns on a refusal,
+// before anything else it did. A refusal only; the instances literal
+// and every write after it are unchanged. key-site / lit:instances.
+// - Server.finishDemoClaimAbort (Task 5): the transfer's apps DELETE also
+// requires an empty linked_link_id (a linked app's row goes only by
+// unpublish and unlink). A narrower delete; the record-key check is
+// unchanged. key-site / key:IsRecordKey.
+// - var routeDecls: Task 5's five kindLink doors (/api/link) and Task 6's
+// three person doors (POST /a/{sqid}/links/{id}/unlink,
+// GET /api/cli/links/{account}, DELETE /api/cli/links/{account}/{id});
+// declarations only, no record path. key-site /
+// lit:instances,lit:sidecars, as before.
+// - var linkedPolicies (new, Task 5): the linked-app guard's table of
+// {app} route patterns (some under instances/ and sidecars/) to a
+// policy; a map literal of patterns, no record path built from it.
+// key-site / lit:instances,lit:sidecars, as routeDecls.
func linkedDeploymentsSlice1WriteCensusInventory() []censusEntry {
entries := append([]censusEntry(nil), billingOverviewSpeedWriteCensusInventory()...)
repins := []censusEntry{
{"internal/provision/reconcile.go", "Reconcile", "key-site", "key:RecordKey", "d9c22f68fbe887332e505c7c44ff36492678c939f7a5b6a69b9f26520f42a048"},
{"internal/edge/demo_traffic.go", "Edge.serveDemoTraffic", "nonrecord", "sel:Put", "e967e257733b9d3afe3c2cf256b9ff2156b9b1b593ef37fe97df6f132abfd77e"},
+ {"internal/console/browserrestart.go", "Server.handleBrowserRestart", "key-site", "lit:instances", "31fc89c5b5bf51f508fc9bc2ea620e3bc456ef684be51a22dcac91651d2d7579"},
+ {"internal/console/browserretry.go", "Server.handleInstanceRetry", "key-site", "lit:instances", "bd226a89ac4bb225085c77da1584fd83918b0dc8fcbc13d6eaed39f5199ed64f"},
+ {"internal/console/browserupdates.go", "Server.updatesFormGate", "key-site", "lit:instances", "d210ef3a33e8b0582adbe857edc808c935e1df89d5fbd98e54db4c3105ce86e3"},
+ {"internal/console/demo_claim_transfer.go", "Server.finishDemoClaimAbort", "key-site", "key:IsRecordKey", "72f672cee02f1f4c5c327990a9e2d712565382631a3a5e52d74258c3deaf8093"},
+ {"internal/console/routedecls.go", "var routeDecls", "key-site", "lit:instances,lit:sidecars", "bed10a715f399683e4d27fe33a9450866192703f44361c84a4ac4473955f8dbc"},
}
for _, r := range repins {
found := false
@@ -41,5 +68,5 @@ func linkedDeploymentsSlice1WriteCensusInventory() []censusEntry {
panic("linked-deployments-slice1 census: re-pin of an unlisted unit " + r.File + ":" + r.Unit)
}
}
- return entries
+ return append(entries, censusEntry{"internal/console/linkedpolicy.go", "var linkedPolicies", "key-site", "lit:instances,lit:sidecars", "0924f764529bc4f94e16273f54d4ce4d22c967b105d833ec37b86caa4e58eee6"})
}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 010f2d898..bb3b7029f 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -155,4 +155,4 @@ plan14-root-reads-gvisor-probe-diag.tsv a9ae6b238b6b2e177be1f9c7ae06ea0f24477e4e
plan14-root-reads-deploy-happy-path.tsv a9ae6b238b6b2e177be1f9c7ae06ea0f24477e4eb0e58abda63f4b7337dbe3ee
plan14-root-reads-held-move-speed.tsv 837f27a6b7b6ed272f8c68aca07650fa32cf3ec92ce28bf9d812a4282eeb0b58
plan14-root-reads-litestream-quiet-802.tsv 6d3ea7fccce1a7f4bc507b6eb8d368ed0b62f83022504aa04c7684c72c93aa9a
-plan14-root-reads-linked-deployments-slice1.tsv 22fd09af6dac49fadf4b023f5e310f1e8399a1ce501a8aacd39e02970e4c40ba
+plan14-root-reads-linked-deployments-slice1.tsv 0cdd951c6ca225d6ba95943e47a2619dbce31a0f3b489bb27ab02e0b5f630d30
diff --git a/internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv b/internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv
index 79c30d77f..b6c526fed 100644
--- a/internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv
+++ b/internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv
@@ -1,5 +1,5 @@
# Census overlay linked-deployments-slice1, written by census-propose (#369). census-ruling-linked-deployments-slice1, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-linked-deployments-slice1.md.
-# 5 body, 6 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 5 body, 7 sites, 6 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
# 18 new dispositions: 4 reads re-frozen at their disposition with the claim, 13 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 1 other.
@legacy 692b495a9271d335562f5eafe3992156fe67947a51a727bca8116f4e16f3eff9 internal/edge/demo_traffic.go Edge.serveDemoTraffic legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_traffic.go:128-334 reads the resolved Route and passes it to existing admission, metering, rate and activator helpers. Resident serving checks precede the inert moved hook (:143), retirement and durable request debit (:302); output debits use the writer below compression. Forwarders do not count or transform again. Existing expiry/control cancellations and five-second write bounds apply; no request-path console or bucket read.;rev3=census-ruling-edge-page-cache-1;basis=attaches the in-memory page mark holder to a demo's request when the route is an instance (up.route.Kind, the +registry:Kind and +whole:Route sites), as ServeHTTP does; nothing else; final fix wave: also wraps the app's writer in the page diagnostics writer (pageDiagnostics(r, host, up).wrap(appWriter)), which sets Carlos-Cache: bypass on a marked response and records nothing; in memory, no read added;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: the demo route's request header scrub also deletes tunnelclient.LinkAppHeader (Carlos-Link-App), the hub-set link publication header, beside the tunnel markers it already deletes; a header delete on the cloned request, no read added registry:App@2655,registry:DemoExpiresAt@1390,registry:Kind@6523,whole:Route@1089,whole:Route@1393,whole:Route@1532,whole:Route@1619,whole:Route@1742,whole:Route@223,whole:Route@2266,whole:Route@2582,whole:Route@2647,whole:Route@2658,whole:Route@2744,whole:Route@2840,whole:Route@2914,whole:Route@2961,whole:Route@3019,whole:Route@3048,whole:Route@3267,whole:Route@3298,whole:Route@3330,whole:Route@3703,whole:Route@375,whole:Route@4367,whole:Route@4417,whole:Route@4469,whole:Route@454,whole:Route@4708,whole:Route@5473,whole:Route@6016,whole:Route@6526,whole:Route@6974 e967e257733b9d3afe3c2cf256b9ff2156b9b1b593ef37fe97df6f132abfd77e
@legacy d04f60b2f85c24cbdea35db32a9d449081c73580a28df2c7c803fb760fe18562 internal/edge/edge.go Edge.ServeHTTP legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with the import gate checked after the door's scope and a gated row left out of the response cache; serving only;rev3=census-ruling-edge-request-records;basis=one more call in the observer defer, observeRecords(up.route, ...), passing on the route the defer already holds; no new kind of read;rev3=census-ruling-design-edge-rate-limit-358;basis=calls rateAdmit twice, and an admitted request holds a slot on both paths: on the upgrade path before the activator or proxy (the handshake holds its slot through slotWriter, given back at the first final answer or at the reverse proxy's hijack on a 101, so an open WebSocket is not counted; released by a defer), and on the ordinary path after the response-cache check and before the activator and proxy (an admitted request holds a slot through slotWriter, released by a defer); a refusal is a 429 written there and returns; the upgrade path's comment now names slotWriter as its one wrapper; one comment on the door mark reworded; read sites unchanged (22: main's 21 plus edge-request-records' observeRecords pass of the route), offsets moved; no read added;rev3=census-ruling-plans-4c-box-throttle;basis=calls planThrottleAdmit before the response cache, and on an upgrade trackUpgrade then planUpgradeAdmit (plans 4c, Astra findings 1 and 2); the new reads live in those units (plans-4c-units decision). The same read sites here.;rev3=census-ruling-plans-4d-lapse;basis=calls planDisabledAdmit right after the import gate, passing the final upstream's route and the request host; a turned-off route gets the fixed disabled page before the meter, gate, cache and activator (plans 4d). The new read lives in that unit (plans-4d-units decision); one more whole-row pass here.;rev3=census-ruling-edge-protection-2;basis=runs the guard, a pure in-memory matcher on r.URL.Path and RawQuery (internal/edgeguard), once per request after the meter and observer defer and before the password gate, the upgrade branch, the cache and the activator, for a request that is not a door call, a backhauled door hop or a tunnel delivery; a matched block answers a 404 itself through guardDecide; the two new sites are one expression, up.route.Kind == "static" (a static route this box serves checks only the hard tier here and leaves the probe tier to serveTree), a read of the route row the edge already resolved; no new kind of read;rev3=census-ruling-edge-asset-cache-3;basis=the asset cache's three hooks (asset cache plan 3): the request's reserved asset headers are deleted at entry (the fill assertion kept only beside a verified hop); on the exact-remote and lookup-miss branches the far catch (serveAssetFar) is tried before backhaulTo and backhaul; after the observer defer and main's hard and probe checks, a verified hop with a valid fill assertion is answered by serveAssetFillForHop; after the upgrade branch and before gzip and the shared cache, the local catch (serveAssetLocal); the observer defer skips only the usage meter for an acknowledged home fill (out.unbilled); the new reads live in the new units of the edge-asset-cache-3-decisions overlay; the same route row and read sites (25); no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: straight after lookupUpstreamPath it calls regionalGate (regional.go), which for an entry built from a regional_domains row answers 503 to a hop or a deny entry before any arm that can leave the box (the exact-home backhaul, the far asset catch, the door dial, the miss backhaul), and lets a star match through only to the exact-home arm when ExactHome names another box for that distinct exact name; after the exact-home arm a regional deny entry the arm did not answer is refused (regionalRefuse, 503); refusals only, on the route map the edge already holds; read sites unchanged (25);rev3=census-ruling-static-headers;basis=the shared response cache is no longer looked up or filled for a static-kind route: one more read of the route row the edge already resolved (up.route.Kind == "static") in the cacheable expression; a refusal only, nothing new opened or followed;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2 (N-HA10): one call, frontForwardHA, right after the route lookup's !ok block and before the login POST; same reads;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4: loginPost and cacheable treat a forward row as not this box's to answer (IsForward(), +whole:Route x2): no login form and no shared cache for a forward host. Serving only.;rev3=census-ruling-tunnel-websockets;basis=Deletes the Carlos-Upgrade marker header from incoming requests and puts the upgrade admission (host, path, the entry tenancy, all in hand) on a tunnel arm request. For a login POST on an ungated ArmTunnel row it reads the visitor request body (bounded by gate.MaxFormBody, 413 past it; a request body, not a file) and resolves next against the entry Reload built (Gate, Route); the bytes pass on only when loginPassesThrough holds (spec 7, Tasks 3, 5 and 6).;rev3=census-ruling-console-protection-tab;basis=one more call in the observer defer, observeGuardCount(up.route, out), beside the observeRecords call that files the guard Match: it passes on the route row the defer already holds (+whole:Route) and the request outcome to the usage meter, which counts the check in memory. Called whether or not the request was unbilled, as observeRecords is. Nothing is opened, read or followed; no new kind of read; no check, refusal or serving decision changes.;rev3=census-ruling-probe-burst-limit;basis=answers a probe-burst notice POST (serveBurstNotice) ahead of every route for a non-door caller; builds the guard state for up.route and stamps its account and app (RouteAccount, App) for the cool-down's this-app/other-app label; for a catalogue match on a non-static or tunnelled route, offers the burst rule (in-memory limiter, burstDecide: 429 or a watch verdict, never a block for a fleet or forward row); the observer defer calls noteBurst(up.route, ...); the added sites are the route value already in hand (+registry:App, +whole:Route x5); no new root read or write kind;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): parses the request's query once (stripHoldMarker) to record the carlos_hold=1 mark in the request context; calls classifyHold on the upstream already resolved from the loaded map (the +whole:Route is that in-memory Route), including a second pass for a login POST; gives a marked request on a door-refused route the plain 404; adds the hold branch (planThrottleAdmit, rateAdmit, serveHeld) after the gate; and excludes marked requests from the shared cache. Reads only the request and the already-loaded upstream map; no registry or bucket read added.;rev3=census-ruling-region-ha-p3a;basis=Complete the P3a cut: an exact peer name with no dial target answers the approved admission 503 before local wildcard dispatch or asset serving. ExactHome and lookupHome stop fallback at a present non-dial entry; backhaulTo refuses an empty target before signing or dialing. Retain Task 3 local admission and fixed platform/unit exemptions. Two added whole Route uses feed the local in-memory admission predicate; existing Route values and store/path reads are unchanged.;rev3=census-ruling-stateless-coordinator-route;basis=P24/P25: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy only for an unescaped, already-clean path; malformed forms remain on the hub. No new read sites relative to origin/main. Merge with main 3487d6f6 retains its region HA admission checks before routing and after login target lookup, its empty-home refusal, and their two existing whole:Route reads; these change this unit's digest relative to the previously approved branch tip 92b24a7d.;rev3=census-ruling-stateless-replicas-3;basis=Task 1a: pass the already-resolved Route to the reserved replica-probe handler after acceptHop and existing admissionRefuses, requiring tunnel context plus private marker and refusing door/backhaul ingress. Added whole Route use only; scrub marker before forwarding; HA calls remain unchanged.;rev3=census-ruling-region-ha-p3b;basis=Resolve local aliases/catch-alls with cached peer name ownership before serving. Add registry Account/App/ClaimStamp/Host/Incarnation/ServingSeq and six whole Route references for NameClaim; inputs are agent registry rows/edges publications used by unprivileged edge, not root permits. Closed owners retain names and return 503; aware remote owner cannot fall through on missing transport, while legacy hop/door behavior remains. Merge 45cebde4 retains authenticated replica probes after local admission and before ordinary name resolution; probe authentication still requires the tunnel context.;rev3=census-ruling-agent-start-demo-2;basis=edge.go:1901 enters the protected demo path before ordinary exits; :2012-2015 rechecks the selected marked Route after lookup. Added whole Route use routes demos through serving checks, counters and policy; no new registry query or file open in this unit.;rev3=census-ruling-demo-api-site-route;basis=Reserve the configured site API namespace after hop verification and control-header scrubbing, before ordinary static, cache, billing and tenant dispatch. Validate hop field shape and delegate only allowlisted operations to the dedicated console path with verified client attribution and console admission. The alias helper enables HTTP/1.1 full duplex so an early console refusal does not wait for upload EOF. Existing 56 read sites unchanged; no new registry, bucket or file read.;rev3=census-ruling-region-ha-g2-fixes;basis=Consult HA ingress after region admission and before miss/alias backhaul; no new direct read; routing-only metadata does not create an upstream.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3/W4: backhaul and door calls pass the owner the door checked into backhaulTo; the §6.5 holder follow (once, GET/HEAD or an unswitched upgrade, no body) and one connect-failure fallback dial only boxes in the holder region's view (same Region/Placement/DataBucket, HomeEligible, fresh) for that owner. Holder name comes only from the TLS-verified signed hop answer; app-set X-Carlos-Holder stays stripped. Routing only; the receiving box still re-checks the lease. No new read site.;rev3=census-ruling-edge-page-cache-1;basis=attaches an in-memory page mark holder to every request to an instance route (the +registry:Kind check of up.route.Kind), wraps the hold and upgrade branches in pageDiagnostics, asks servePage after the plan throttle (a hit answered from the page index over the asset store), keeps an opted-in instance out of the LRU (pagesOptedIn), wraps the response in the page writer, and wraps the proxy's writer in assetInformationalScrub on the remaining arms; the page reads are in the new pagecache.go units;rev3=census-ruling-region-ha-held-build;basis=first branch: a request for the reserved control paths /.carlos/ha-drain and /.carlos/ha-take goes to serveHAControl and returns (refused unless a signed ask); no request on those paths reaches a route, a forward or an app; no read added here. region HA held-requests Task 2: X-Carlos-Replayable is read from verified hops only and deleted from every request; just before frontForwardHA, moveGate runs for an HA hibernating route (route HA, Host and the whole Route passed in memory) and can only hold, refuse with an existing answer or front-forward to the confirmed holder; ReleaseMoveTicket before serveHeld; no store or filesystem read added; region HA held-requests Task 5: after the HA control-path branch, every request is counted by the connection drain (conns.track: a cancellable request context, and Connection: close only while draining); memory only; no read added; Task 5 fix 1: after the drain's final barrier a new request is refused at once through handoverExit with the existing answerHolderUnreachable, never forwarded; the tracked request also carries its connection (from ConnContext) so the drain can close it at its bound; memory only; no read added;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: the inbound strip also deletes tunnelclient.LinkAppHeader (Carlos-Link-App) from every client request, beside Carlos-Tunnel-Upgrade; a header delete, no read added file:ReadAll@18697,registry:Account@9593,registry:App@25590,registry:App@9617,registry:ClaimStamp@9647,registry:Gate@17671,registry:Gate@29981,registry:Gate@30041,registry:Gate@30099,registry:HA@13417,registry:HA@13748,registry:Host@13787,registry:Host@30084,registry:Host@9824,registry:ImportGate@38581,registry:Incarnation@9682,registry:Kind@22624,registry:Kind@24452,registry:Kind@27890,registry:Kind@38523,registry:Kind@38552,registry:ServingSeq@9716,whole:Route@13420,whole:Route@13514,whole:Route@13751,whole:Route@13790,whole:Route@17566,whole:Route@17677,whole:Route@20494,whole:Route@21278,whole:Route@21736,whole:Route@21928,whole:Route@22627,whole:Route@24455,whole:Route@25516,whole:Route@25582,whole:Route@25593,whole:Route@25846,whole:Route@25941,whole:Route@26017,whole:Route@26061,whole:Route@26363,whole:Route@26393,whole:Route@27893,whole:Route@28178,whole:Route@29984,whole:Route@30044,whole:Route@30087,whole:Route@30102,whole:Route@31313,whole:Route@33601,whole:Route@38526,whole:Route@38555,whole:Route@38584,whole:Route@38616,whole:Route@41050,whole:Route@7667,whole:Route@7766,whole:Route@7861,whole:Route@9596,whole:Route@9620,whole:Route@9650,whole:Route@9685,whole:Route@9719,whole:Route@9827 4033f1a7e5a075992a98b1c0baa0d0305ab7cb7f2c9387e70f172ee7c7eb4dac
@@ -25,6 +25,7 @@
@legacy 42304ac2f37522340c2bda552d9967300504dab2102ccdec079d9b0bc740f3af internal/edge/fleetforward.go FleetArmVerdict legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 6 fix round 3: the single fleet-arm refusal decision over one listing, used by Edge.Reload, the edges-file writer and the alias pass (parity by construction); returns the refused set with reasons and the accountless notes (+registry:Host x3, +registry:Status, +whole:Route x3). Pure; no I/O. Review R1 finding 2: also returns Served, each admitted row Reload sends through the fleet arm (a forward row, or a fleet-placed row with no Tunnel) with its fleet, app and the fleet owner from owners; a host the alias step refuses is dropped from it (+registry:App, +registry:Host, +registry:Region, +registry:Tunnel on the listing it already holds). Pure; no I/O. Review R2: the pre-fold fleet rows are now Arm; Served is the destination after the platform-alias fold: every ready, unrefused, non-sidecar row DispatchArm gives an entry, with its Arm fleet when its arm is a fleet's, folded by foldPlatformAliases (Reload's own fold), keeping the hosts that go to a fleet (+registry:Host, +registry:Status, +whole:Route on the listing it already holds). Pure; no I/O; refusals unchanged.;rev3=census-ruling-stateless-replicas-3;basis=Task 3: classify ArmReplica as fleet-served for the existing shared routing, edges-file and alias verdict. Existing field reads unchanged; pure in-memory decision, same owner and alias checks.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: owners is edge.ForwardOwners; a link-placed forward row (registry.LinkPlacement over the listed row's Region) admitted by FleetServeEligible gets an Arm entry with its link, app and the link's owner, and ArmLink rows count as served; +registry:App, +registry:Host, +registry:Region are that row's fields; a pure decision over the listing, no read source added registry:App@769,registry:App@970,registry:Host@1615,registry:Host@1675,registry:Host@1807,registry:Host@1867,registry:Host@376,registry:Host@559,registry:Host@618,registry:Host@729,registry:Host@928,registry:Region@681,registry:Region@859,registry:Status@1547,registry:Status@316,registry:Tunnel@900,whole:Route@1049,whole:Route@1515,whole:Route@1705,whole:Route@1923,whole:Route@264,whole:Route@518 b98bcc250129fbe47a5fc5be92bac28d809683358010420c3c52388bb42f36a2
@legacy 88e9d5cee56487049c335bd495dc6b39da00bb40f3b834440711ffa2e669f5e4 internal/edge/fleetforward.go FleetServeEligible legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4 (§4.4 tenancy): a forward row is eligible only on a hub, inert, fleet-placed, its fleet in the fleets table and its raw Account non-empty and equal to the owner; a non-forward fleet-placed row: empty raw Account served and noted, else release.RouteAccount must equal the owner; raw field before RouteAccount (+registry:Account x7, +registry:Region x2, +registry:Tunnel, +whole:Route). Pure; no I/O.;rev3=census-ruling-stateless-replicas-3;basis=Task 3: gate set routing on hub role, valid projection, nonempty account/app, instance or inert forward kind, no platform ownership, HA, hibernation or explicit tunnel. New reads are fields of the already-supplied Route. Existing fleet-owner and inert-forward checks still apply; no external read or expansion of destination authority. Fix round 1 M1: retain the same fail-closed structural predicate but give each invalid condition an internal diagnostic instead of the no-healthy-copy message. No admission expansion, user-facing answer, or additional read.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: owners is edge.ForwardOwners; a forward row whose Region parses as a link placement is judged by linkServeEligible against owners.Links only, and every other row as before against owners.Fleets; +registry:Region and +whole:Route are that parse and the hand-off; refuses more, never admits a fleet row by link owners registry:Account@1413,registry:Account@1484,registry:Account@1570,registry:Account@1672,registry:Account@1828,registry:Account@1926,registry:Account@2189,registry:Account@512,registry:App@532,registry:FleetBoxes@297,registry:HA@683,registry:Hibernate@692,registry:Kind@860,registry:Platform@610,registry:Region@1244,registry:Region@142,registry:Region@282,registry:Tunnel@1629,registry:Tunnel@774,whole:Route@208,whole:Route@2111 94d88d4b36a3dbc2d0cac93be76da320d5926d71b66a2ad8f89bc84ec639468e
@legacy 443c05a3beba6486bd237cd06334e1557c08c6308b1bab7f6e82d6df7b8ed186 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-managed-fleets-1b;basis=managed fleets 1b (Task 4, rules 2 and 9): after inScope, a record failing cfg.ownsRecord (on a fleet box, labelled for another box: rec.FleetBox != "" and != cfg.FleetBox) is skipped as out of scope, so it is never minted here; in the removal phase such a record no longer keeps the row (inScope && ownsRecord), so the row goes as record gone. Off a fleet ownsRecord is always true. Read sites unchanged (178). The agent's reconcile loops, not root; it mints less, never more.;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; merge of origin/main 6f1f6ca6: main's fleet-box ownsRecord skip in the record scan and in the removal phase is kept as main has it (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (178);rev3=census-ruling-stateless-replicas-1;basis=Task 3b: call the optional binding callback only for applied, owned stateless rows outside dry run. Reuses this pass record and route reads after existing collision, scope, hold, policy and shape checks; no new record read or typed writer. Fix 3b round 1 I1: binding callback failure is logged and falls through to pr.applied; same per-host callback, record writers, scope and removal gates. TestStatelessBindingFailureContinuesReconcile covers second-record convergence, removal, applied bookkeeping and next-pass retry.;rev3=census-ruling-region-ha-p1b3b-t;basis=B3b: collect validated instance records from the existing scan before pool filtering; report source completeness separately. Record reads, writes, scope and removal authority unchanged.;rev3=census-ruling-agent-start-demo-1;basis=Keeps local demo rows for signed cleanup instead of deleting the binding on record absence or trash; normal/hub paths unchanged. Merge integration against origin/main 9bd45488 retains main's HA departure inventory scan and family-completeness reporting alongside the early local-demo retention guard; existing record reads retained.;rev3=census-ruling-stateless-replicas-2;basis=Final fix I1: legacy records now reach the legacy ownership/removal judgement for former set rows; a greater local incarnation remains protected. Current set-record lifetime and membership checks remain. Same record/registry reads and removal writers. TestReplicaReconcileLegacySuccessor covers both boxes with and without the judge; P11 newer/unknown set protections remain covered. merge of origin/main 6be08467: Retain main signed demo retirement ownership alongside replica set retirement and legacy successor recovery; merge-only body change, unchanged read sources.;rev3=census-ruling-agent-start-demo-3;basis=Install durable source claim holds and reconcile fresh destination seed gates; preserve owned pending routes and stop orphan seeds before cleanup. Census read-site delta: +registry:Account, +registry:App, +registry:Host, +registry:ImportGate ×2, +registry:SeedSource ×2, +whole:Route ×4.;rev3=census-ruling-region-ha-g2-fixes;basis=Run guarded pool withdrawal, extract the unchanged judged collection rules into scanInstanceRecords, and publish pre-pool HA ingress including stale refusal names. Existing direct route reads remain; indirect withdrawal reads and deletion are separately claimed.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 2: where a forward row holds an in-scope record's host, a link-placed one (registry.LinkPlacement over the listed row's Region) gets its own log line saying no pass here retires it; the record is still not applied, as before; one +registry:Region read of the listed row, no write added registry:Account@26723,registry:Account@28593,registry:Account@47359,registry:Account@47405,registry:Account@49034,registry:Account@49411,registry:Account@49637,registry:Account@49704,registry:Account@49750,registry:Account@49843,registry:Account@49885,registry:Account@50533,registry:Account@50791,registry:Account@51693,registry:Account@51741,registry:Account@52150,registry:Account@52196,registry:Account@52441,registry:Account@52866,registry:Account@53354,registry:Account@53698,registry:Account@54300,registry:Account@54493,registry:Account@54905,registry:Account@55084,registry:Account@55408,registry:Account@55973,registry:App@26696,registry:App@28566,registry:App@47379,registry:App@47417,registry:App@49046,registry:App@49423,registry:App@49649,registry:App@49724,registry:App@49762,registry:App@49863,registry:App@50545,registry:App@50803,registry:App@51705,registry:App@51753,registry:App@52170,registry:App@52208,registry:App@52453,registry:App@52878,registry:App@53366,registry:App@53710,registry:App@54312,registry:App@54505,registry:App@54917,registry:App@55096,registry:App@55420,registry:App@55985,registry:Canary@47872,registry:ClaimOwnership@27310,registry:DBPath@37220,registry:DBPath@37235,registry:DBPath@37481,registry:DBPath@38084,registry:DBPath@38097,registry:EgressAllow@25809,registry:FleetBoxes@47833,registry:FleetBoxes@47981,registry:FleetBoxes@54693,registry:Gate@33117,registry:Gate@33257,registry:Gate@33544,registry:Hibernate@31789,registry:Hibernate@31987,registry:Hibernate@32052,registry:Hibernate@32391,registry:Hibernate@32742,registry:Hibernate@33052,registry:HoldOp@17800,registry:HoldOp@54045,registry:HoldOp@54136,registry:HoldOp@54271,registry:HoldOp@54647,registry:Host@15299,registry:Host@18203,registry:Host@18343,registry:Host@47338,registry:Host@47932,registry:Host@49010,registry:Host@49387,registry:Host@49551,registry:Host@49657,registry:Host@50553,registry:Host@50759,registry:Host@52033,registry:Host@52305,registry:Host@52420,registry:Host@52743,registry:Host@52840,registry:Host@53231,registry:Host@53328,registry:Host@53542,registry:Host@53744,registry:Host@54127,registry:Host@54262,registry:Host@54466,registry:Host@54539,registry:Host@54638,registry:Host@54878,registry:Host@55057,registry:Host@55136,registry:Host@55223,registry:Host@55382,registry:Host@55457,registry:Host@55543,registry:Host@55950,registry:ImportGate@34696,registry:ImportGate@34995,registry:Incarnation@17976,registry:Incarnation@48050,registry:Kind@18188,registry:Kind@18328,registry:Kind@27452,registry:Kind@27818,registry:Kind@28100,registry:Kind@28320,registry:Kind@37138,registry:Kind@37151,registry:Kind@37261,registry:Kind@37274,registry:Kind@37995,registry:Kind@38006,registry:Kind@46462,registry:Kind@53533,registry:Kind@54253,registry:Kind@54629,registry:Kind@54869,registry:Kind@55214,registry:Kind@55373,registry:Kind@55534,registry:Platform@47857,registry:PolicyExpiresAt@25834,registry:Pool@46548,registry:Provisioned@26672,registry:Provisioned@28542,registry:Provisioned@46507,registry:RateLimit@33630,registry:RateLimit@33781,registry:RateLimit@34068,registry:Region@17167,registry:Region@46537,registry:ReplicaIncarnation@17684,registry:ReplicaIncarnation@17721,registry:Replication@32476,registry:Replication@32603,registry:Runtime@19372,registry:Runtime@19550,registry:Runtime@21857,registry:Runtime@31156,registry:Runtime@31210,registry:Runtime@31414,registry:Seed@35618,registry:SeedSource@34654,registry:SeedSource@34974,registry:SeedSource@35101,registry:Size@25825,registry:Socket@37186,registry:Socket@37201,registry:Socket@37498,registry:Socket@38054,registry:Socket@38067,registry:Stateless@38155,registry:Unit@37104,registry:Unit@37117,registry:Unit@38021,registry:Unit@38032,whole:ClaimOwnership@27313,whole:ClaimOwnership@27330,whole:Route@15281,whole:Route@15292,whole:Route@15310,whole:Route@16591,whole:Route@17576,whole:Route@17787,whole:Route@18102,whole:Route@18388,whole:Route@18402,whole:Route@18415,whole:Route@18438,whole:Route@19867,whole:Route@19874,whole:Route@19914,whole:Route@20275,whole:Route@20430,whole:Route@20715,whole:Route@21162,whole:Route@21213,whole:Route@21250,whole:Route@22922,whole:Route@23131,whole:Route@23470,whole:Route@23479,whole:Route@23525,whole:Route@25758,whole:Route@26317,whole:Route@26788,whole:Route@26798,whole:Route@27155,whole:Route@27162,whole:Route@27230,whole:Route@27593,whole:Route@27649,whole:Route@27719,whole:Route@27730,whole:Route@28158,whole:Route@29191,whole:Route@32142,whole:Route@34803,whole:Route@37330,whole:Route@38268,whole:Route@39155,whole:Route@39200,whole:Route@39210,whole:Route@40080,whole:Route@41107,whole:Route@46573,whole:Route@46721,whole:Route@47818,whole:Route@48188,whole:Route@48962,whole:Route@49344,whole:Route@51195,whole:Route@53636,whole:Route@54784,whole:Route@55295,whole:Route@55880,whole:Route@55930 d9c22f68fbe887332e505c7c44ff36492678c939f7a5b6a69b9f26520f42a048
+@legacy 2def32fa25be34ed945a3785e62058c66cacdbb2c83c86552f76f218e1c32d91 internal/regionlabel/regionlabel.go ForRoute legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-labels;identity=the console and the carlos CLI (a pure package; no box unit links it for a decision);basis=new (region labels plan 1 task 2): labels a registry row already in hand from its Region and Pool columns and RouteServedEverywhere; pure: no file, no store, no registry open, nothing written;decision: Paul, as census owner, 2026-10-26: accepted as a new unit (#280);rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 6: a row placed on a linked deployment (registry.LinkPlacement over the row's own Region, "link/<id>") is labelled as linked (the new Label.Link, the link ID; Text empty) before the fleet and everywhere checks, instead of being labelled with "link/<id>" as a region code; pure, reads only the Route it is given, no read added registry:Pool@329,registry:Pool@394,registry:Region@100,registry:Region@138,registry:Region@199,registry:Region@233,registry:Region@318,registry:Region@364,whole:Route@292 f88391a298a8511fd1305ffcd046b84130d0fd1f756509802529f776679971ea
@legacy 645f2b6273823f863b1b1fefa4d84b4d683a3956d4de8d6b06fede15c938fcd4 internal/registry/forward.go Registry.PutForward legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 2: the only writer of a forward row's declared columns: refuses an argument whose kind is not forward; copies only the declared fields from its argument (Status ready, Provisioned true; no forbidden column is ever written); inside one IMMEDIATE transaction refuses a host a non-forward row holds (ErrHostHeld); keeps FleetBox while Region is unchanged; preserves the observational columns (+file:Exec, +file:QueryRow, +registry:Account, App, Channel, RateLimit, Region, Slug, +registry:Host x3, +registry:Kind, +registry:remote x2, +whole:Route x3, +whole:remoteClient x2).;rev3=census-ruling-fleet-routes-followups;basis=refuses up front, with the new sentinel ErrNotForward and before any read or write, an rt that is not a forward row (as before, now a sentinel), has an empty Host, or whose Region is not a fleet placement (registry.FleetPlacement); +registry:Host x2 and +registry:Region x2 read only the argument in those checks; the transaction and statement are unchanged;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3), merged with main's ErrNotForward refusals (kept unchanged): the written row also carries FleetLabel = rt.FleetLabel and FleetBox = rt.FleetLabel; its conflict arm (forwardKept) writes fleet_label from the call and fleet_box as the call's label when set, else kept while the region is unchanged. The hub's forward phase in the agent, not root.;rev3=census-ruling-stateless-replicas-1;basis=Carry declarative Stateless into forward rows under existing transaction and shape guards; projection only.;rev3=census-ruling-agent-start-demo-1;basis=Reads and carries the four demo fields in the existing forward INSERT; the guarded conflict SQL refuses downgrade or identity change.;rev3=census-ruling-stateless-replicas-2;basis=Validates canonical set projection, writes explicit declarative columns and clears single-box binding; all forbidden columns zero. Same transaction/read source. merge of origin/main 6be08467: Retain main demo columns and immutable descriptor conflict guard alongside set validation/projection; merge-only existing route fields.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: also accepts a Region that LinkPlacement parses (link/ + 12 hex), refusing a link row with a FleetLabel (ErrNotForward); the existing in-transaction SELECT also reads the held row's region and refuses a different placement class (ErrHostHeld); a link row additionally needs an active link_channels row of its account in the same transaction (linkAdmits, ErrLinkInactive). Same transaction and statement; the added reads are the argument and the box's own registry database, as carlos file:Exec@2052,file:QueryRow@1631,registry:Account@1092,registry:Account@1989,registry:App@1069,registry:Channel@1145,registry:Copies@1392,registry:DemoExpiresAt@960,registry:DemoHost@901,registry:DemoID@880,registry:DemoLifetime@928,registry:FleetBox@1513,registry:FleetBoxes@1369,registry:FleetBoxes@1490,registry:FleetLabel@1280,registry:FleetLabel@1310,registry:FleetLabel@1525,registry:FleetLabel@540,registry:Host@1693,registry:Host@250,registry:Host@287,registry:Host@500,registry:Host@660,registry:Host@993,registry:Kind@259,registry:RateLimit@1172,registry:Region@1119,registry:Region@130,registry:Region@1898,registry:Region@509,registry:Region@82,registry:ReplicaIncarnation@1460,registry:ReplicaRevision@1420,registry:Slug@1045,registry:Stateless@1340,registry:remote@737,registry:remote@767,whole:Route@2085,whole:Route@822,whole:Route@830,whole:remoteClient@739,whole:remoteClient@769 92749de50752ac228f653180d60ea0b177331657a7062598c8b877b35c694106
@legacy a6cb59b1acada968c3228a1a943bec945ec3d72ae1609dcaaed0277feef63043 internal/registry/registry.go Registry.Fingerprint legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user); the remote arm, unchanged, in the process that holds a remote handle: census-ruling-seeded-instances's body with the row's lifetime pair (incarnation, serving_seq) folded into the edge's change poll, each only when non-zero, so a registry with no pair digests as before; self-serve moves 1 Task 7;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: hashes regional_domains (host, target, account, app, region; created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no regional rows digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; no file path read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): review R1 finding 1: the routes SELECT also reads host, kind, account, app, platform and fingerprintForwardInert (one CASE over the ForwardForbidden columns), and every row folds host, kind, account and app (tagged, quoted), platform when set, and forward_inert=0 for a forward row that is not inert, so a rowid reused by another hostname, an in-place account or app rewrite, or a stray forbidden column moves the edge's change poll. Same one SELECT per table on the same fresh connection to the box's own registry database, as carlos; no table, file or bucket read added; a digest, never a decision.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5): the SELECT also reads fleet_label and, only when it is set, hashes "fleet_label=<q>" into the digest, so labelling a row moves the edge's reload fingerprint. Read sites unchanged (33). Registry side, not root; an unlabelled registry's digest is byte-identical.;rev3=census-ruling-stateless-replicas-1;basis=Read the additive stateless projection in the existing registry SELECT and hash only when set; no new read source.;rev3=census-ruling-agent-start-demo-1;basis=Existing SELECT reads four more demo columns; only a marked row adds them to the hash, so ordinary hashes remain unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Four additive projection columns join the existing routes SELECT and hash only when nonzero; no new query or file read. merge of origin/main 6be08467: Union main demo identity and expiry with replica columns in the same SELECT and hash; merge-only body change.;rev3=census-ruling-agent-start-demo-3;basis=Hash moved-notice wire bytes so notice-only changes invalidate an edge route snapshot. Census read-site delta: +file:QueryRow.;rev3=census-ruling-edge-page-cache-1;basis=selects the new pages_off column with the rest and folds "pages_off=1" into the hash only when set, as assets_off, so a registry that never sets it fingerprints as before; same routes SELECT, no new table; read sites unchanged (34); no read added;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: hashes link_channels (link_id, account, token_hash, status, generation; connected, seen_at, seq and created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no links digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; a digest, never a decision file:Exec@284,file:Open@188,file:Query@10785,file:Query@11990,file:Query@368,file:Query@6655,file:Query@7134,file:Query@8120,file:Query@8816,file:Query@9728,file:QueryRow@12638,registry:ClaimIncarnation@1729,registry:ClaimIncarnation@5563,registry:ClaimIncarnation@5640,registry:ClaimOwner@1773,registry:ClaimOwner@5764,registry:ClaimOwner@5829,registry:ClaimRowID@1792,registry:ClaimRowID@5856,registry:ClaimRowID@5922,registry:ClaimStamp@1754,registry:ClaimStamp@5673,registry:ClaimStamp@5737,registry:Incarnation@1848,registry:Incarnation@6143,registry:Incarnation@6207,registry:ServingSeq@1867,registry:ServingSeq@6234,registry:ServingSeq@6297,registry:Text@158,registry:path@207,registry:remote@55,registry:remote@87,whole:remoteClient@57,whole:remoteClient@89 65a6883d3e8b0b81a4861d22ddc434fd63670f42e3c64fb70c07c2cf0603ee08
internal/edge/demo_traffic.go Edge.serveDemoTraffic legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_traffic.go:128-334 reads the resolved Route and passes it to existing admission, metering, rate and activator helpers. Resident serving checks precede the inert moved hook (:143), retirement and durable request debit (:302); output debits use the writer below compression. Forwarders do not count or transform again. Existing expiry/control cancellations and five-second write bounds apply; no request-path console or bucket read.;rev3=census-ruling-edge-page-cache-1;basis=attaches the in-memory page mark holder to a demo's request when the route is an instance (up.route.Kind, the +registry:Kind and +whole:Route sites), as ServeHTTP does; nothing else; final fix wave: also wraps the app's writer in the page diagnostics writer (pageDiagnostics(r, host, up).wrap(appWriter)), which sets Carlos-Cache: bypass on a marked response and records nothing; in memory, no read added;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: the demo route's request header scrub also deletes tunnelclient.LinkAppHeader (Carlos-Link-App), the hub-set link publication header, beside the tunnel markers it already deletes; a header delete on the cloned request, no read added registry:App@2655,registry:DemoExpiresAt@1390,registry:Kind@6523,whole:Route@1089,whole:Route@1393,whole:Route@1532,whole:Route@1619,whole:Route@1742,whole:Route@223,whole:Route@2266,whole:Route@2582,whole:Route@2647,whole:Route@2658,whole:Route@2744,whole:Route@2840,whole:Route@2914,whole:Route@2961,whole:Route@3019,whole:Route@3048,whole:Route@3267,whole:Route@3298,whole:Route@3330,whole:Route@3703,whole:Route@375,whole:Route@4367,whole:Route@4417,whole:Route@4469,whole:Route@454,whole:Route@4708,whole:Route@5473,whole:Route@6016,whole:Route@6526,whole:Route@6974 e967e257733b9d3afe3c2cf256b9ff2156b9b1b593ef37fe97df6f132abfd77e
@@ -53,11 +54,13 @@ internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1
internal/edge/fleetforward.go FleetArmVerdict legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 6 fix round 3: the single fleet-arm refusal decision over one listing, used by Edge.Reload, the edges-file writer and the alias pass (parity by construction); returns the refused set with reasons and the accountless notes (+registry:Host x3, +registry:Status, +whole:Route x3). Pure; no I/O. Review R1 finding 2: also returns Served, each admitted row Reload sends through the fleet arm (a forward row, or a fleet-placed row with no Tunnel) with its fleet, app and the fleet owner from owners; a host the alias step refuses is dropped from it (+registry:App, +registry:Host, +registry:Region, +registry:Tunnel on the listing it already holds). Pure; no I/O. Review R2: the pre-fold fleet rows are now Arm; Served is the destination after the platform-alias fold: every ready, unrefused, non-sidecar row DispatchArm gives an entry, with its Arm fleet when its arm is a fleet's, folded by foldPlatformAliases (Reload's own fold), keeping the hosts that go to a fleet (+registry:Host, +registry:Status, +whole:Route on the listing it already holds). Pure; no I/O; refusals unchanged.;rev3=census-ruling-stateless-replicas-3;basis=Task 3: classify ArmReplica as fleet-served for the existing shared routing, edges-file and alias verdict. Existing field reads unchanged; pure in-memory decision, same owner and alias checks.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: owners is edge.ForwardOwners; a link-placed forward row (registry.LinkPlacement over the listed row's Region) admitted by FleetServeEligible gets an Arm entry with its link, app and the link's owner, and ArmLink rows count as served; +registry:App, +registry:Host, +registry:Region are that row's fields; a pure decision over the listing, no read source added registry:App@769,registry:App@970,registry:Host@1615,registry:Host@1675,registry:Host@1807,registry:Host@1867,registry:Host@376,registry:Host@559,registry:Host@618,registry:Host@729,registry:Host@928,registry:Region@681,registry:Region@859,registry:Status@1547,registry:Status@316,registry:Tunnel@900,whole:Route@1049,whole:Route@1515,whole:Route@1705,whole:Route@1923,whole:Route@264,whole:Route@518 b98bcc250129fbe47a5fc5be92bac28d809683358010420c3c52388bb42f36a2
internal/edge/fleetforward.go FleetServeEligible legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4 (§4.4 tenancy): a forward row is eligible only on a hub, inert, fleet-placed, its fleet in the fleets table and its raw Account non-empty and equal to the owner; a non-forward fleet-placed row: empty raw Account served and noted, else release.RouteAccount must equal the owner; raw field before RouteAccount (+registry:Account x7, +registry:Region x2, +registry:Tunnel, +whole:Route). Pure; no I/O.;rev3=census-ruling-stateless-replicas-3;basis=Task 3: gate set routing on hub role, valid projection, nonempty account/app, instance or inert forward kind, no platform ownership, HA, hibernation or explicit tunnel. New reads are fields of the already-supplied Route. Existing fleet-owner and inert-forward checks still apply; no external read or expansion of destination authority. Fix round 1 M1: retain the same fail-closed structural predicate but give each invalid condition an internal diagnostic instead of the no-healthy-copy message. No admission expansion, user-facing answer, or additional read.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: owners is edge.ForwardOwners; a forward row whose Region parses as a link placement is judged by linkServeEligible against owners.Links only, and every other row as before against owners.Fleets; +registry:Region and +whole:Route are that parse and the hand-off; refuses more, never admits a fleet row by link owners registry:Account@1413,registry:Account@1484,registry:Account@1570,registry:Account@1672,registry:Account@1828,registry:Account@1926,registry:Account@2189,registry:Account@512,registry:App@532,registry:FleetBoxes@297,registry:HA@683,registry:Hibernate@692,registry:Kind@860,registry:Platform@610,registry:Region@1244,registry:Region@142,registry:Region@282,registry:Tunnel@1629,registry:Tunnel@774,whole:Route@208,whole:Route@2111 94d88d4b36a3dbc2d0cac93be76da320d5926d71b66a2ad8f89bc84ec639468e
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-managed-fleets-1b;basis=managed fleets 1b (Task 4, rules 2 and 9): after inScope, a record failing cfg.ownsRecord (on a fleet box, labelled for another box: rec.FleetBox != "" and != cfg.FleetBox) is skipped as out of scope, so it is never minted here; in the removal phase such a record no longer keeps the row (inScope && ownsRecord), so the row goes as record gone. Off a fleet ownsRecord is always true. Read sites unchanged (178). The agent's reconcile loops, not root; it mints less, never more.;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; merge of origin/main 6f1f6ca6: main's fleet-box ownsRecord skip in the record scan and in the removal phase is kept as main has it (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (178);rev3=census-ruling-stateless-replicas-1;basis=Task 3b: call the optional binding callback only for applied, owned stateless rows outside dry run. Reuses this pass record and route reads after existing collision, scope, hold, policy and shape checks; no new record read or typed writer. Fix 3b round 1 I1: binding callback failure is logged and falls through to pr.applied; same per-host callback, record writers, scope and removal gates. TestStatelessBindingFailureContinuesReconcile covers second-record convergence, removal, applied bookkeeping and next-pass retry.;rev3=census-ruling-region-ha-p1b3b-t;basis=B3b: collect validated instance records from the existing scan before pool filtering; report source completeness separately. Record reads, writes, scope and removal authority unchanged.;rev3=census-ruling-agent-start-demo-1;basis=Keeps local demo rows for signed cleanup instead of deleting the binding on record absence or trash; normal/hub paths unchanged. Merge integration against origin/main 9bd45488 retains main's HA departure inventory scan and family-completeness reporting alongside the early local-demo retention guard; existing record reads retained.;rev3=census-ruling-stateless-replicas-2;basis=Final fix I1: legacy records now reach the legacy ownership/removal judgement for former set rows; a greater local incarnation remains protected. Current set-record lifetime and membership checks remain. Same record/registry reads and removal writers. TestReplicaReconcileLegacySuccessor covers both boxes with and without the judge; P11 newer/unknown set protections remain covered. merge of origin/main 6be08467: Retain main signed demo retirement ownership alongside replica set retirement and legacy successor recovery; merge-only body change, unchanged read sources.;rev3=census-ruling-agent-start-demo-3;basis=Install durable source claim holds and reconcile fresh destination seed gates; preserve owned pending routes and stop orphan seeds before cleanup. Census read-site delta: +registry:Account, +registry:App, +registry:Host, +registry:ImportGate ×2, +registry:SeedSource ×2, +whole:Route ×4.;rev3=census-ruling-region-ha-g2-fixes;basis=Run guarded pool withdrawal, extract the unchanged judged collection rules into scanInstanceRecords, and publish pre-pool HA ingress including stale refusal names. Existing direct route reads remain; indirect withdrawal reads and deletion are separately claimed.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 2: where a forward row holds an in-scope record's host, a link-placed one (registry.LinkPlacement over the listed row's Region) gets its own log line saying no pass here retires it; the record is still not applied, as before; one +registry:Region read of the listed row, no write added registry:Account@26723,registry:Account@28593,registry:Account@47359,registry:Account@47405,registry:Account@49034,registry:Account@49411,registry:Account@49637,registry:Account@49704,registry:Account@49750,registry:Account@49843,registry:Account@49885,registry:Account@50533,registry:Account@50791,registry:Account@51693,registry:Account@51741,registry:Account@52150,registry:Account@52196,registry:Account@52441,registry:Account@52866,registry:Account@53354,registry:Account@53698,registry:Account@54300,registry:Account@54493,registry:Account@54905,registry:Account@55084,registry:Account@55408,registry:Account@55973,registry:App@26696,registry:App@28566,registry:App@47379,registry:App@47417,registry:App@49046,registry:App@49423,registry:App@49649,registry:App@49724,registry:App@49762,registry:App@49863,registry:App@50545,registry:App@50803,registry:App@51705,registry:App@51753,registry:App@52170,registry:App@52208,registry:App@52453,registry:App@52878,registry:App@53366,registry:App@53710,registry:App@54312,registry:App@54505,registry:App@54917,registry:App@55096,registry:App@55420,registry:App@55985,registry:Canary@47872,registry:ClaimOwnership@27310,registry:DBPath@37220,registry:DBPath@37235,registry:DBPath@37481,registry:DBPath@38084,registry:DBPath@38097,registry:EgressAllow@25809,registry:FleetBoxes@47833,registry:FleetBoxes@47981,registry:FleetBoxes@54693,registry:Gate@33117,registry:Gate@33257,registry:Gate@33544,registry:Hibernate@31789,registry:Hibernate@31987,registry:Hibernate@32052,registry:Hibernate@32391,registry:Hibernate@32742,registry:Hibernate@33052,registry:HoldOp@17800,registry:HoldOp@54045,registry:HoldOp@54136,registry:HoldOp@54271,registry:HoldOp@54647,registry:Host@15299,registry:Host@18203,registry:Host@18343,registry:Host@47338,registry:Host@47932,registry:Host@49010,registry:Host@49387,registry:Host@49551,registry:Host@49657,registry:Host@50553,registry:Host@50759,registry:Host@52033,registry:Host@52305,registry:Host@52420,registry:Host@52743,registry:Host@52840,registry:Host@53231,registry:Host@53328,registry:Host@53542,registry:Host@53744,registry:Host@54127,registry:Host@54262,registry:Host@54466,registry:Host@54539,registry:Host@54638,registry:Host@54878,registry:Host@55057,registry:Host@55136,registry:Host@55223,registry:Host@55382,registry:Host@55457,registry:Host@55543,registry:Host@55950,registry:ImportGate@34696,registry:ImportGate@34995,registry:Incarnation@17976,registry:Incarnation@48050,registry:Kind@18188,registry:Kind@18328,registry:Kind@27452,registry:Kind@27818,registry:Kind@28100,registry:Kind@28320,registry:Kind@37138,registry:Kind@37151,registry:Kind@37261,registry:Kind@37274,registry:Kind@37995,registry:Kind@38006,registry:Kind@46462,registry:Kind@53533,registry:Kind@54253,registry:Kind@54629,registry:Kind@54869,registry:Kind@55214,registry:Kind@55373,registry:Kind@55534,registry:Platform@47857,registry:PolicyExpiresAt@25834,registry:Pool@46548,registry:Provisioned@26672,registry:Provisioned@28542,registry:Provisioned@46507,registry:RateLimit@33630,registry:RateLimit@33781,registry:RateLimit@34068,registry:Region@17167,registry:Region@46537,registry:ReplicaIncarnation@17684,registry:ReplicaIncarnation@17721,registry:Replication@32476,registry:Replication@32603,registry:Runtime@19372,registry:Runtime@19550,registry:Runtime@21857,registry:Runtime@31156,registry:Runtime@31210,registry:Runtime@31414,registry:Seed@35618,registry:SeedSource@34654,registry:SeedSource@34974,registry:SeedSource@35101,registry:Size@25825,registry:Socket@37186,registry:Socket@37201,registry:Socket@37498,registry:Socket@38054,registry:Socket@38067,registry:Stateless@38155,registry:Unit@37104,registry:Unit@37117,registry:Unit@38021,registry:Unit@38032,whole:ClaimOwnership@27313,whole:ClaimOwnership@27330,whole:Route@15281,whole:Route@15292,whole:Route@15310,whole:Route@16591,whole:Route@17576,whole:Route@17787,whole:Route@18102,whole:Route@18388,whole:Route@18402,whole:Route@18415,whole:Route@18438,whole:Route@19867,whole:Route@19874,whole:Route@19914,whole:Route@20275,whole:Route@20430,whole:Route@20715,whole:Route@21162,whole:Route@21213,whole:Route@21250,whole:Route@22922,whole:Route@23131,whole:Route@23470,whole:Route@23479,whole:Route@23525,whole:Route@25758,whole:Route@26317,whole:Route@26788,whole:Route@26798,whole:Route@27155,whole:Route@27162,whole:Route@27230,whole:Route@27593,whole:Route@27649,whole:Route@27719,whole:Route@27730,whole:Route@28158,whole:Route@29191,whole:Route@32142,whole:Route@34803,whole:Route@37330,whole:Route@38268,whole:Route@39155,whole:Route@39200,whole:Route@39210,whole:Route@40080,whole:Route@41107,whole:Route@46573,whole:Route@46721,whole:Route@47818,whole:Route@48188,whole:Route@48962,whole:Route@49344,whole:Route@51195,whole:Route@53636,whole:Route@54784,whole:Route@55295,whole:Route@55880,whole:Route@55930 d9c22f68fbe887332e505c7c44ff36492678c939f7a5b6a69b9f26520f42a048
+internal/regionlabel/regionlabel.go ForRoute legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-labels;identity=the console and the carlos CLI (a pure package; no box unit links it for a decision);basis=new (region labels plan 1 task 2): labels a registry row already in hand from its Region and Pool columns and RouteServedEverywhere; pure: no file, no store, no registry open, nothing written;decision: Paul, as census owner, 2026-10-26: accepted as a new unit (#280);rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 6: a row placed on a linked deployment (registry.LinkPlacement over the row's own Region, "link/<id>") is labelled as linked (the new Label.Link, the link ID; Text empty) before the fleet and everywhere checks, instead of being labelled with "link/<id>" as a region code; pure, reads only the Route it is given, no read added registry:Pool@329,registry:Pool@394,registry:Region@100,registry:Region@138,registry:Region@199,registry:Region@233,registry:Region@318,registry:Region@364,whole:Route@292 f88391a298a8511fd1305ffcd046b84130d0fd1f756509802529f776679971ea
internal/registry/forward.go Registry.PutForward legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 2: the only writer of a forward row's declared columns: refuses an argument whose kind is not forward; copies only the declared fields from its argument (Status ready, Provisioned true; no forbidden column is ever written); inside one IMMEDIATE transaction refuses a host a non-forward row holds (ErrHostHeld); keeps FleetBox while Region is unchanged; preserves the observational columns (+file:Exec, +file:QueryRow, +registry:Account, App, Channel, RateLimit, Region, Slug, +registry:Host x3, +registry:Kind, +registry:remote x2, +whole:Route x3, +whole:remoteClient x2).;rev3=census-ruling-fleet-routes-followups;basis=refuses up front, with the new sentinel ErrNotForward and before any read or write, an rt that is not a forward row (as before, now a sentinel), has an empty Host, or whose Region is not a fleet placement (registry.FleetPlacement); +registry:Host x2 and +registry:Region x2 read only the argument in those checks; the transaction and statement are unchanged;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3), merged with main's ErrNotForward refusals (kept unchanged): the written row also carries FleetLabel = rt.FleetLabel and FleetBox = rt.FleetLabel; its conflict arm (forwardKept) writes fleet_label from the call and fleet_box as the call's label when set, else kept while the region is unchanged. The hub's forward phase in the agent, not root.;rev3=census-ruling-stateless-replicas-1;basis=Carry declarative Stateless into forward rows under existing transaction and shape guards; projection only.;rev3=census-ruling-agent-start-demo-1;basis=Reads and carries the four demo fields in the existing forward INSERT; the guarded conflict SQL refuses downgrade or identity change.;rev3=census-ruling-stateless-replicas-2;basis=Validates canonical set projection, writes explicit declarative columns and clears single-box binding; all forbidden columns zero. Same transaction/read source. merge of origin/main 6be08467: Retain main demo columns and immutable descriptor conflict guard alongside set validation/projection; merge-only existing route fields.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: also accepts a Region that LinkPlacement parses (link/ + 12 hex), refusing a link row with a FleetLabel (ErrNotForward); the existing in-transaction SELECT also reads the held row's region and refuses a different placement class (ErrHostHeld); a link row additionally needs an active link_channels row of its account in the same transaction (linkAdmits, ErrLinkInactive). Same transaction and statement; the added reads are the argument and the box's own registry database, as carlos file:Exec@2052,file:QueryRow@1631,registry:Account@1092,registry:Account@1989,registry:App@1069,registry:Channel@1145,registry:Copies@1392,registry:DemoExpiresAt@960,registry:DemoHost@901,registry:DemoID@880,registry:DemoLifetime@928,registry:FleetBox@1513,registry:FleetBoxes@1369,registry:FleetBoxes@1490,registry:FleetLabel@1280,registry:FleetLabel@1310,registry:FleetLabel@1525,registry:FleetLabel@540,registry:Host@1693,registry:Host@250,registry:Host@287,registry:Host@500,registry:Host@660,registry:Host@993,registry:Kind@259,registry:RateLimit@1172,registry:Region@1119,registry:Region@130,registry:Region@1898,registry:Region@509,registry:Region@82,registry:ReplicaIncarnation@1460,registry:ReplicaRevision@1420,registry:Slug@1045,registry:Stateless@1340,registry:remote@737,registry:remote@767,whole:Route@2085,whole:Route@822,whole:Route@830,whole:remoteClient@739,whole:remoteClient@769 92749de50752ac228f653180d60ea0b177331657a7062598c8b877b35c694106
internal/registry/registry.go Registry.Fingerprint legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user); the remote arm, unchanged, in the process that holds a remote handle: census-ruling-seeded-instances's body with the row's lifetime pair (incarnation, serving_seq) folded into the edge's change poll, each only when non-zero, so a registry with no pair digests as before; self-serve moves 1 Task 7;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: hashes regional_domains (host, target, account, app, region; created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no regional rows digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; no file path read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): review R1 finding 1: the routes SELECT also reads host, kind, account, app, platform and fingerprintForwardInert (one CASE over the ForwardForbidden columns), and every row folds host, kind, account and app (tagged, quoted), platform when set, and forward_inert=0 for a forward row that is not inert, so a rowid reused by another hostname, an in-place account or app rewrite, or a stray forbidden column moves the edge's change poll. Same one SELECT per table on the same fresh connection to the box's own registry database, as carlos; no table, file or bucket read added; a digest, never a decision.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5): the SELECT also reads fleet_label and, only when it is set, hashes "fleet_label=<q>" into the digest, so labelling a row moves the edge's reload fingerprint. Read sites unchanged (33). Registry side, not root; an unlabelled registry's digest is byte-identical.;rev3=census-ruling-stateless-replicas-1;basis=Read the additive stateless projection in the existing registry SELECT and hash only when set; no new read source.;rev3=census-ruling-agent-start-demo-1;basis=Existing SELECT reads four more demo columns; only a marked row adds them to the hash, so ordinary hashes remain unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Four additive projection columns join the existing routes SELECT and hash only when nonzero; no new query or file read. merge of origin/main 6be08467: Union main demo identity and expiry with replica columns in the same SELECT and hash; merge-only body change.;rev3=census-ruling-agent-start-demo-3;basis=Hash moved-notice wire bytes so notice-only changes invalidate an edge route snapshot. Census read-site delta: +file:QueryRow.;rev3=census-ruling-edge-page-cache-1;basis=selects the new pages_off column with the rest and folds "pages_off=1" into the hash only when set, as assets_off, so a registry that never sets it fingerprints as before; same routes SELECT, no new table; read sites unchanged (34); no read added;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: hashes link_channels (link_id, account, token_hash, status, generation; connected, seen_at, seq and created_at not) over the same fresh connection, with a section marker written only when a row exists, so a registry with no links digests as before; the one added site is that SELECT (+file:Query) on the box's own registry database, as carlos; a digest, never a decision file:Exec@284,file:Open@188,file:Query@10785,file:Query@11990,file:Query@368,file:Query@6655,file:Query@7134,file:Query@8120,file:Query@8816,file:Query@9728,file:QueryRow@12638,registry:ClaimIncarnation@1729,registry:ClaimIncarnation@5563,registry:ClaimIncarnation@5640,registry:ClaimOwner@1773,registry:ClaimOwner@5764,registry:ClaimOwner@5829,registry:ClaimRowID@1792,registry:ClaimRowID@5856,registry:ClaimRowID@5922,registry:ClaimStamp@1754,registry:ClaimStamp@5673,registry:ClaimStamp@5737,registry:Incarnation@1848,registry:Incarnation@6143,registry:Incarnation@6207,registry:ServingSeq@1867,registry:ServingSeq@6234,registry:ServingSeq@6297,registry:Text@158,registry:path@207,registry:remote@55,registry:remote@87,whole:remoteClient@57,whole:remoteClient@89 65a6883d3e8b0b81a4861d22ddc434fd63670f42e3c64fb70c07c2cf0603ee08
@coverage internal/edge 7601ac1640244e54751e02e5ccdbc648a0b582525383763314c998b4e56db969
@coverage internal/host 0a8907da434ef77fbc1abed6aff4bef5cd86810ab5013ef33230dd7810dcfcb5
@coverage internal/provision 6c3f9188cfe17a2f7f87d78cf5f60e9104f5bcd55941947129a5bcea3e4c586c
+@coverage internal/regionlabel 8d831085b7e3ce7bb1ea1f20f443b4529c5b7177de18e7c4889e4ca330aa6a00
@coverage internal/registry b292d21b32a57a29c87a1c3d23b73383b643c459848adad05bf7a1f573f68235
@coverage internal/tunnelclient a3661e839ab9e18977dfad0ebe846a38f7c8e327c6c85047d1e3cef42d80aff6
@fields ?,A,Account,Accounts,AcquiredGeneration,AddedAt,Addr,Addrs,Adoption,Alias,Aliases,Alive,AllowAbsent,App,Archives,Args,AssetGen,AssetsOff,Assigned,Assignment,At,Attempts,B,Backing,Basis,Binding,Blocked,Body,Bucket,BuildState,By,Callback,CallbackError,CallbackFailed,Canary,Caps,CertExpiresAt,Changed,Channel,CheckedAt,Claim,ClaimIncarnation,ClaimOwner,ClaimOwnership,ClaimRowID,ClaimStamp,Class,Code,Column,Connected,Contents,Copies,Count,CreatedAt,Cursor,DBPath,DNSCheckedAt,DNSStatus,Deadline,Default,DeleteUncertain,Demand,DemoExpiresAt,DemoHost,DemoID,DemoLifetime,Departure,DepartureIID,DepartureRef,Departures,Digest,DoneBefore,DrainingSince,Due,DueAt,Duty,EdgesETag,EgressAllow,EnrolledAt,Env,EnvBefore,Environment,Error,ErrorKind,ExcludeHosts,ExpectGood,ExpectOp,ExpectPair,Expected,ExpectedPair,F,Failed,FenceGen,Field,FillLegacyRegistration,Fleet,FleetBox,FleetBoxes,FleetLabel,Fleets,Found,From,FromDB,FromOp,FromSock,Gate,Generation,GoodDemand,GoodDigest,GoodVersion,HA,HAJournal,Hash,Health,Held,Hibernate,Hint,Hints,HoldOp,HolderEpoch,HolderIID,HolderRef,Host,Hosts,ID,IID,Id,IdValue,Identity,Idle,IdleSeconds,Import,ImportGate,Inbox,Incarnation,InventoryGeneration,Journal,Keep,Key,KeyFP,Keys,Kind,Label,LabelledAt,LastAt,LastBlocked,LastError,LastMs,LastPage,LastStatus,Lifetime,Limit,Link,LinkID,LinkSeen,LockETag,LockGeneration,Managed,MaxRun,MaxRunSeconds,MessageID,Method,Moved,Ms,Name,Next,NextAt,NextAttempt,NextDue,NextGood,NextValue,NotBefore,Now,Number,Number64,Observation,Observed,ObservedValue,Offset,Old,Oldest,On,OnConflict,Op,Original,Owner,Ownership,P,Page,PagesOff,Pair,Path,Paths,PermissionAlerted,Phase,Platform,PolicyExpiresAt,Pool,Prefix,Prev,PrevVersion,ProofDigest,ProofKey,Provisioned,Pub,RDs,RateLimit,Raw,Receipt,ReceivedAt,RecordDigest,RecordKey,Ref,Region,Regional,Registration,Replica,ReplicaIncarnation,ReplicaLife,ReplicaRevision,Replicas,Replication,Rescan,Result,Retirement,RetryCount,Revision,Route,Routes,Row,Rows,Runtime,Scan,SecretsKeyFP,SecretsKeySetAt,SecretsKeySetBy,SecretsPub,Seed,SeedID,SeedSource,SeenAt,Seq,Sequence,ServingSeq,ServingVersion,Size,Slug,Socket,Spec,Sqid,StartedAt,State,Stateless,Status,StatusNamed,Steering,StringMap,Summary,T,TValue,Tags,Target,Targets,Text,Timer,Timers,Times,To,ToDB,ToOp,ToSock,TokenHash,Tunnel,Type,Unit,Unresolved,UpdateSettings,Ver,Version,ViewKey,Visited,W,Waiting,Wake,WakeDigest,WakeIncarnation,Walk,Wildcards,closed,conn,connect,ctx,d,dec,done,enc,full,input,output,path,readOnly,remote,slot,sql,wait
diff --git a/internal/regionlabel/regionlabel.go b/internal/regionlabel/regionlabel.go
index 9f7ccee14..6e84d2832 100644
--- a/internal/regionlabel/regionlabel.go
+++ b/internal/regionlabel/regionlabel.go
@@ -102,7 +102,11 @@ type Label struct {
Fleet string // the customer fleet's name
Pool string // the record's or row's pool
Everywhere bool // served by every platform box (the everywhere class)
- Text string
+ // Link is the linked deployment's ID for a row served from one
+ // ("link/<id>"): no region of the platform's, so Text is "" and the
+ // console names the deployment itself (linked deployments spec §5.4).
+ Link string
+ Text string
}
// City is a C23 place after its last " · ": "UK · London" is "London",
@@ -152,8 +156,12 @@ func ForRecord(rec provision.Record, home string, n Names) Label {
}
// ForRoute labels a registry row that has no record in hand, by the same
-// table, with the row's half of the class rule.
+// table, with the row's half of the class rule. A row placed on a linked
+// deployment is labelled as linked (Link), never as a region code.
func ForRoute(rt registry.Route, home string, n Names) Label {
+ if id, ok := registry.LinkPlacement(rt.Region); ok {
+ return Label{Code: rt.Region, Link: id}
+ }
if _, ok := registry.FleetPlacement(rt.Region); ok {
return ForCode(rt.Region, home, n)
}
diff --git a/internal/regionlabel/regionlabel_test.go b/internal/regionlabel/regionlabel_test.go
index be188650d..c7e92b227 100644
--- a/internal/regionlabel/regionlabel_test.go
+++ b/internal/regionlabel/regionlabel_test.go
@@ -63,6 +63,25 @@ func TestLabelTableInOrder(t *testing.T) {
}
}
+// TestForRouteLinkRowIsLinked: a forward row placed on a linked deployment
+// ("link/<id>") is served from that deployment, not from a region: the
+// label names the link and carries no region text, place or code of the
+// home's (linked deployments spec §5.4).
+func TestForRouteLinkRowIsLinked(t *testing.T) {
+ t.Parallel()
+ n := names()
+ for _, kind := range []string{registry.KindForward, "instance", "static"} {
+ l := ForRoute(registry.Route{Host: "shop.bab.apps.example.com", Kind: kind, Region: "link/0123456789ab"}, "ie", n)
+ if l.Link != "0123456789ab" || l.Code != "link/0123456789ab" || l.Text != "" || l.Place != "" || l.Everywhere || l.Fleet != "" {
+ t.Errorf("ForRoute(a %s link row) = %+v, want the link and no region", kind, l)
+ }
+ }
+ // A malformed link ID is not a link: it falls through to the code.
+ if l := ForRoute(registry.Route{Kind: "instance", Region: "link/nope"}, "ie", n); l.Link != "" {
+ t.Errorf("ForRoute(link/nope) = %+v, want no link", l)
+ }
+}
+
// TestForCodeWithoutAPlaceIsTheCode: Review Focus 1. Before the map is
// read, or for a code no box publishes, the label is the code, never empty.
func TestForCodeWithoutAPlaceIsTheCode(t *testing.T) {
diff --git a/parity/parity.tsv b/parity/parity.tsv
index cf2743a10..676c2ef87 100644
--- a/parity/parity.tsv
+++ b/parity/parity.tsv
@@ -150,6 +150,7 @@ fleets-tag-box fleets both fleets tag-box POST /a/{sqid}/fleets/{fleet}/tags
fleets-detach-box fleets both fleets detach-box POST /a/{sqid}/fleets/{fleet}/detach
fleets-drain fleets gap fleets drain wp-fleets-relay
fleets-secrets-key fleets gap fleets secrets-key wp-fleets-relay The fleet page shows the fingerprint and prints the CLI command.
+links-unlink fleets console-only POST /a/{sqid}/links/{id}/unlink No carlos command unlinks from the account side yet. carlos link remove unlinks from the home.
# team
team-list team gap GET /a/{sqid}/team wp-cli-verbs The CLI cannot list members.