carlos / platform Public

console: home link fixes: current-request save, journals, pending

Linked deployments slice 1, Task 7 fix round 1 (Astra review).

- A link request saves only while it is the current one: homeLinkSave
  checks the request's sequence under ops, and a start replaces the
  request in flight under ops after checking again that no link was
  saved. Barrier test supersedes a request just before it saves.
- CheckCredentialFile also refuses a readable -wal, -shm or -journal
  beside the registry (the token lands in the WAL first); the refusal
  draft names them.
- The pending unlink is kept in home_link.unlink_pending (not in
  Fingerprint), so a restarted console still reports it.
- Census overlay re-proposed with the fix-round claims.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev f8dd07f226b85acdfb8d71d154cff2cb8a5bc37f parent e3743cb
10 files changed, +432 −113
  • docs/superpowers/notes/census-proposal-linked-deployments-slice1.md +6 −5
  • internal/console/homelink.go +66 −33
  • internal/console/homelink_test.go +127 −23
  • internal/console/links_copy.go +5 −4
  • internal/console/view.go +1 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv +12 −10
  • internal/registry/homelink.go +72 −23
  • internal/registry/homelink_test.go +140 −14
  • internal/registry/remote_dispatch.go +2 −0
diff --git a/docs/superpowers/notes/census-proposal-linked-deployments-slice1.md b/docs/superpowers/notes/census-proposal-linked-deployments-slice1.md
index 97f4c2053..88ac393f1 100644
--- a/docs/superpowers/notes/census-proposal-linked-deployments-slice1.md
+++ b/docs/superpowers/notes/census-proposal-linked-deployments-slice1.md
@@ -1,6 +1,6 @@
# Census approval: linked-deployments-slice1
-Ruling `census-ruling-linked-deployments-slice1`. The independent reviewer approves or rejects every change below, 33 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-linked-deployments-slice1`. The independent reviewer approves or rejects every change below, 34 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
@@ -50,10 +50,11 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/registry/homelink.go:Registry.PutHomeLink`: reads +file:Exec ×3, +registry:Account, +registry:AppsDomain, +registry:CreatedAt ×2, +registry:ID ×5, +registry:ServingURL, +registry:Token ×2, +registry:TunnelURL, +registry:path, +registry:remote ×2, +whole:HomeLink ×2, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
- new `internal/registry/homelink.go:Registry.PutHomeLinkApp`: reads +file:Exec ×2, +file:QueryRow ×2, +registry:HomeAccount ×4, +registry:HomeApp ×4, +registry:HomeHost ×4, +registry:Name ×4, +registry:remote ×2, +whole:HomeLinkApp ×3, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
- new `internal/registry/homelink.go:Registry.SetHomeLinkState`: reads +file:Exec, +registry:remote ×2, +registry:sql, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
-- new `internal/registry/homelink.go:Registry.migrateHomeLink`: reads +file:Exec ×2, +registry:sql ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/homelink.go:Registry.SetHomeLinkUnlinkPending`: reads +file:Exec, +registry:remote ×2, +registry:sql, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/homelink.go:Registry.migrateHomeLink`: reads +file:Exec ×3, +registry:sql ×3; written legacy, accepted-legacy, frozen
- new `internal/registry/homelink.go:bumpHomeLinkConnGen`: reads +file:Exec; written legacy, accepted-legacy, frozen
- new `internal/registry/homelink.go:fingerprintHomeLink`: reads +file:Query ×2, +registry:Account, +registry:AppsDomain, +registry:BoxLabel, +registry:ConnGen, +registry:HomeAccount ×2, +registry:HomeApp ×2, +registry:HomeHost ×2, +registry:ID, +registry:Name ×2, +registry:ServingURL, +registry:Token, +registry:TunnelURL; written legacy, accepted-legacy, frozen
-- new `internal/registry/homelink.go:scanHomeLink`: reads +registry:Account, +registry:AppsDomain, +registry:BoxLabel, +registry:ConnGen, +registry:CreatedAt, +registry:ID, +registry:ServingURL, +registry:State, +registry:Token, +registry:TunnelURL, +whole:HomeLink; written legacy, accepted-legacy, frozen
+- new `internal/registry/homelink.go:scanHomeLink`: reads +registry:Account, +registry:AppsDomain, +registry:BoxLabel, +registry:ConnGen, +registry:CreatedAt, +registry:ID, +registry:ServingURL, +registry:State, +registry:Token, +registry:TunnelURL, +registry:UnlinkPending, +whole:HomeLink; written legacy, accepted-legacy, frozen
- new `internal/registry/links.go:Registry.DeleteLinkForward`: reads +file:Exec, +registry:Changed, +registry:remote ×2, +registry:sql, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
- new `internal/registry/links.go:Registry.LinkChannelAuth`: reads +registry:StringMap, +registry:remote ×2, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
- new `internal/registry/links.go:Registry.LinkForwards`: reads +file:Query, +registry:Routes, +registry:remote ×2, +whole:Route ×5, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
@@ -70,8 +71,8 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- reads `internal/edge/fleetforward.go:DispatchArm`: +registry:Region; keeps legacy, task accepted-legacy
- reads `internal/provision/forward.go:forwardPhase.mint`: +registry:Account, +registry:App, +registry:Region; keeps legacy, task accepted-legacy
- reads `internal/provision/forward.go:forwardView.retirements`: +registry:Region; keeps legacy, task accepted-legacy
-- reads `internal/registry/remote_dispatch.go:Registry.dispatchRemote`: +registry:Changed ×5, +registry:HomeLink ×2, +registry:HomeLinkApp ×2, +registry:HomeLinkApps, +registry:Host, +registry:Label, +registry:Link, +registry:LinkID ×4, +registry:LinkSeen, +registry:Name ×2, +registry:Number64, +registry:On, +registry:Routes, +registry:SeenAt, +registry:Seq, +registry:Status, +registry:StringMap ×2, +whole:HomeLink ×2, +whole:HomeLinkApp ×3, +whole:LinkChannel, +whole:LinkSeen, +whole:Route; keeps hint, task E2
+- reads `internal/registry/remote_dispatch.go:Registry.dispatchRemote`: +registry:Changed ×5, +registry:HomeLink ×2, +registry:HomeLinkApp ×2, +registry:HomeLinkApps, +registry:Host, +registry:Label, +registry:Link, +registry:LinkID ×5, +registry:LinkSeen, +registry:Name ×2, +registry:Number64, +registry:On ×2, +registry:Routes, +registry:SeenAt, +registry:Seq, +registry:Status, +registry:StringMap ×2, +whole:HomeLink ×2, +whole:HomeLinkApp ×3, +whole:LinkChannel, +whole:LinkSeen, +whole:Route; keeps hint, task E2
-Seal: `6d3ea7fccce1a7f4bc507b6eb8d368ed0b62f83022504aa04c7684c72c93aa9a` → `977bd10e9d3b72202328e6e33fa23cb81597c3307a3a6aed91c7b00082f615d8`.
+Seal: `6d3ea7fccce1a7f4bc507b6eb8d368ed0b62f83022504aa04c7684c72c93aa9a` → `2eb90feb894383f5e240d79a536f99caca2d9f37b4caeaed703519569ffe920e`.
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/homelink.go b/internal/console/homelink.go
index 4793e2bc0..c19cafd8f 100644
--- a/internal/console/homelink.go
+++ b/internal/console/homelink.go
@@ -35,18 +35,21 @@ import (
// homeLinkState is the home console's in-process link state.
type homeLinkState struct {
// ops serializes the doors that change the link or the published set,
- // and the background poll's save, so no two of them interleave their
- // serving-console call and their registry write.
+ // the replacement of the link request in flight, and the background
+ // poll's save, so no two of them interleave their serving-console call
+ // and their registry write, and only the current request can save.
ops sync.Mutex
- mu sync.Mutex // guards start and unlinkPending
+ mu sync.Mutex // guards start
// start is the link request in flight (or the last one that failed),
- // reported by GET /api/cli/link until a link is saved.
+ // reported by GET /api/cli/link until a link is saved. Replaced only
+ // with ops held.
start *homeLinkStart
- // unlinkPending is the ID of the link whose serving-side unlink
- // answered 202: revoked there, its connection not yet cut. The home
- // keeps the link until a later remove gets the 204.
- unlinkPending string
+
+ // beforeSave, when non-nil, is called by an approved poll with its
+ // request's sequence just before it takes ops to save. Tests only: the
+ // barrier that supersedes a request at the last moment.
+ beforeSave func(seq uint64)
// pollEvery, when non-zero, replaces the serving console's poll
// interval. Tests only.
@@ -171,12 +174,7 @@ func (s *Server) handleAPIHomeLinkStart(w http.ResponseWriter, r *http.Request)
jsonError(w, http.StatusConflict, copyHomeLinkRegistryReadable)
return
}
- if l, err := reg.HomeLink(); err != nil {
- log.Printf("console: home link: read: %v", err)
- jsonError(w, http.StatusServiceUnavailable, copyHomeLinkReadFailed)
- return
- } else if l != nil {
- jsonError(w, http.StatusConflict, linkCopy(copyLD41, "account", l.Account, "console", l.ServingURL))
+ if !s.homeLinkNotHeld(w, reg) {
return
}
name := cleanLabel(req.Name)
@@ -196,15 +194,41 @@ func (s *Server) handleAPIHomeLinkStart(w http.ResponseWriter, r *http.Request)
jsonError(w, http.StatusBadGateway, linkCopy(copyLD37, "console", base))
return
}
+ // The request replaces the one in flight under ops, after checking
+ // again that no link was saved while the serving console answered: a
+ // poll saves only while its request is the current one (homeLinkSave),
+ // so the two never cross.
+ s.homeLink.ops.Lock()
+ if !s.homeLinkNotHeld(w, reg) {
+ s.homeLink.ops.Unlock()
+ return
+ }
s.homeLinkPollStart(base, start)
+ s.homeLink.ops.Unlock()
writeJSON(w, http.StatusOK, map[string]string{
"verification_uri": start.VerificationURI,
"user_code": start.UserCode,
})
}
+// homeLinkNotHeld answers 409 LD-C41 when this deployment already holds a
+// link (503 when that cannot be read), and reports whether it holds none.
+func (s *Server) homeLinkNotHeld(w http.ResponseWriter, reg consoleRegistry) bool {
+ l, err := reg.HomeLink()
+ if err != nil {
+ log.Printf("console: home link: read: %v", err)
+ jsonError(w, http.StatusServiceUnavailable, copyHomeLinkReadFailed)
+ return false
+ }
+ if l != nil {
+ jsonError(w, http.StatusConflict, linkCopy(copyLD41, "account", l.Account, "console", l.ServingURL))
+ return false
+ }
+ return true
+}
+
// homeLinkPollStart records start as the request in flight, superseding an
-// earlier one, and polls it in the background.
+// earlier one, and polls it in the background. The caller holds ops.
func (s *Server) homeLinkPollStart(base string, start *linkStartAnswer) {
homeLinkStartSeq.Lock()
homeLinkStartSeq.n++
@@ -235,7 +259,7 @@ func (s *Server) homeLinkPollStart(base string, start *linkStartAnswer) {
go func() {
defer s.homeLink.polls.Done()
defer cancel()
- failed := s.homeLinkPoll(ctx, base, start.DeviceCode, every, deadline)
+ failed := s.homeLinkPoll(ctx, seq, base, start.DeviceCode, every, deadline)
s.homeLink.mu.Lock()
defer s.homeLink.mu.Unlock()
cur := s.homeLink.start
@@ -254,7 +278,7 @@ func (s *Server) homeLinkPollStart(base string, start *linkStartAnswer) {
// deadline passes, and saves an approved link. It returns "" once the link
// is saved, else the deck refusal it ended with. A poll that fails to get an
// answer is tried again on the next tick.
-func (s *Server) homeLinkPoll(ctx context.Context, base, deviceCode string, every time.Duration, deadline time.Time) string {
+func (s *Server) homeLinkPoll(ctx context.Context, seq uint64, base, deviceCode string, every time.Duration, deadline time.Time) string {
c := newLinkClient(base, "")
t := time.NewTicker(every)
defer t.Stop()
@@ -279,21 +303,34 @@ func (s *Server) homeLinkPoll(ctx context.Context, base, deviceCode string, ever
case CLIAuthExpired, CLIAuthUnknown:
return copyLD40
case CLIAuthApproved:
- return s.homeLinkSave(base, ans)
+ return s.homeLinkSave(seq, base, ans)
}
}
}
-// homeLinkSave stores an approved link. It refuses an answer that is not
-// a link's, or lacks the link ID, the account or an https tunnel address
-// (LD-C38): nothing is saved, and the credential is dropped.
-func (s *Server) homeLinkSave(base string, ans *linkPollAnswer) string {
+// homeLinkSave stores the approved link of request seq. It refuses an
+// answer that is not a link's, or lacks the link ID, the account or an
+// https tunnel address (LD-C38): nothing is saved, and the credential is
+// dropped. With ops held it saves only while seq is still the request in
+// flight: a request superseded at any moment before (its replacement also
+// holds ops) saves nothing, and its credential is dropped.
+func (s *Server) homeLinkSave(seq uint64, base string, ans *linkPollAnswer) string {
if ans.Purpose != cliPurposeLink || ans.Token == "" || !registry.ValidLinkID(ans.LinkID) ||
ans.Account == "" || !homeLinkTunnelURL(ans.TunnelURL) {
return linkCopy(copyLD38, "console", base)
}
+ if s.homeLink.beforeSave != nil {
+ s.homeLink.beforeSave(seq)
+ }
s.homeLink.ops.Lock()
defer s.homeLink.ops.Unlock()
+ s.homeLink.mu.Lock()
+ current := s.homeLink.start != nil && s.homeLink.start.seq == seq
+ s.homeLink.mu.Unlock()
+ if !current {
+ log.Printf("console: home link %s: not saved: its request was superseded", ans.LinkID)
+ return copyHomeLinkSaveFailed // reported nowhere: the poll's own seq check drops it
+ }
reg, err := openRegistry(s.cfg.Registry)
if err != nil {
log.Printf("console: home link %s: registry: %v", ans.LinkID, err)
@@ -310,9 +347,6 @@ func (s *Server) homeLinkSave(base string, ans *linkPollAnswer) string {
log.Printf("console: home link %s: save: %v", ans.LinkID, err)
return copyHomeLinkSaveFailed
}
- s.homeLink.mu.Lock()
- s.homeLink.unlinkPending = ""
- s.homeLink.mu.Unlock()
log.Printf("console: home link %s: linked to %s on %s", ans.LinkID, ans.Account, base)
return ""
}
@@ -379,7 +413,7 @@ func (s *Server) handleAPIHomeLinkStatus(w http.ResponseWriter, r *http.Request)
}
out := homeLinkWire{Apps: []homeLinkAppWire{}}
s.homeLink.mu.Lock()
- start, pending := s.homeLink.start, s.homeLink.unlinkPending
+ start := s.homeLink.start
if start != nil {
out.Start = &homeLinkStartWire{Status: "pending"}
if start.failed != "" {
@@ -398,7 +432,7 @@ func (s *Server) handleAPIHomeLinkStatus(w http.ResponseWriter, r *http.Request)
return
}
out.Linked, out.Console, out.Account, out.Box, out.State = true, l.ServingURL, l.Account, l.BoxLabel, l.State
- if pending == l.ID {
+ if l.UnlinkPending {
out.Revocation = "pending"
}
urls := map[string]string{}
@@ -722,9 +756,11 @@ func (s *Server) handleAPIHomeLinkRemove(w http.ResponseWriter, r *http.Request)
return
}
if pending {
- s.homeLink.mu.Lock()
- s.homeLink.unlinkPending = l.ID
- s.homeLink.mu.Unlock()
+ // Kept in the link's row, so a restarted console still
+ // reports it and the next remove still finishes it.
+ if err := reg.SetHomeLinkUnlinkPending(l.ID, true); err != nil {
+ log.Printf("console: home link %s: record the pending unlink: %v", l.ID, err)
+ }
writeJSON(w, http.StatusAccepted, map[string]string{
"revocation": "pending", "message": linkCopy(copyHomeLinkUnlinkPending, "console", l.ServingURL)})
return
@@ -735,9 +771,6 @@ func (s *Server) handleAPIHomeLinkRemove(w http.ResponseWriter, r *http.Request)
jsonError(w, http.StatusServiceUnavailable, copyHomeLinkReadFailed)
return
}
- s.homeLink.mu.Lock()
- s.homeLink.unlinkPending = ""
- s.homeLink.mu.Unlock()
log.Printf("console: home link %s: removed (local %v)", l.ID, local)
writeJSON(w, http.StatusOK, map[string]any{"account": l.Account, "console": l.ServingURL, "local": local})
}
diff --git a/internal/console/homelink_test.go b/internal/console/homelink_test.go
index 5d25e6b73..2b301c9a0 100644
--- a/internal/console/homelink_test.go
+++ b/internal/console/homelink_test.go
@@ -2,8 +2,10 @@ package console
import (
"encoding/json"
+ "errors"
"fmt"
"io"
+ "io/fs"
"net/http"
"net/http/httptest"
"net/url"
@@ -21,15 +23,24 @@ import (
const homeTestLinkID = "0123456789ab"
+// chmodHomeRegistry sets the mode of the registry file at path and of
+// every journal beside it that exists (the registry runs in WAL mode).
+func chmodHomeRegistry(t *testing.T, path string, mode os.FileMode) {
+ t.Helper()
+ for _, sfx := range []string{"", "-wal", "-shm", "-journal"} {
+ if err := os.Chmod(path+sfx, mode); err != nil && !errors.Is(err, fs.ErrNotExist) {
+ t.Fatal(err)
+ }
+ }
+}
+
// newHomeFixture is a home console: the ordinary fixture (paul owns the ops
-// account, so he passes apiSystemRoller) with its registry file at the
-// bootstrap's 0640, and a fast background poll.
+// account, so he passes apiSystemRoller) with its registry file and its
+// journals at the bootstrap's 0640, and a fast background poll.
func newHomeFixture(t *testing.T) *consoleFixture {
t.Helper()
fx := newConsoleFixture(t)
- if err := os.Chmod(fx.regPath, 0o640); err != nil {
- t.Fatal(err)
- }
+ chmodHomeRegistry(t, fx.regPath, 0o640)
fx.srv.homeLink.pollEvery = 200 * time.Millisecond
t.Cleanup(fx.srv.homeLink.polls.Wait)
return fx
@@ -324,20 +335,27 @@ func TestHomeStartRefusesOldServingConsole(t *testing.T) {
}
})
- t.Run("a registry others can read", func(t *testing.T) {
- f := newFakeServing(t)
- if err := os.Chmod(home.regPath, 0o644); err != nil {
- t.Fatal(err)
- }
- defer os.Chmod(home.regPath, 0o640)
- status, out := postJSON(t, home.ts.URL+"/api/cli/link/start", map[string]string{"to": f.srv.URL}, op)
- if status != http.StatusConflict || str(t, out, "error") != copyHomeLinkRegistryReadable {
- t.Fatalf("start = %d %v; want 409 %q", status, out, copyHomeLinkRegistryReadable)
- }
- if got := f.callLog(); len(got) != 0 {
- t.Fatalf("the serving console was called: %v", got)
- }
- })
+ for _, readable := range []string{"", "-wal"} {
+ t.Run("a registry others can read: registry.db"+readable, func(t *testing.T) {
+ f := newFakeServing(t)
+ if readable == "-wal" {
+ if fi, err := os.Stat(home.regPath + "-wal"); err != nil || fi.Size() == 0 {
+ t.Fatalf("the WAL = %v, %v; want a nonempty file", fi, err)
+ }
+ }
+ if err := os.Chmod(home.regPath+readable, 0o644); err != nil {
+ t.Fatal(err)
+ }
+ defer chmodHomeRegistry(t, home.regPath, 0o640)
+ status, out := postJSON(t, home.ts.URL+"/api/cli/link/start", map[string]string{"to": f.srv.URL}, op)
+ if status != http.StatusConflict || str(t, out, "error") != copyHomeLinkRegistryReadable {
+ t.Fatalf("start = %d %v; want 409 %q", status, out, copyHomeLinkRegistryReadable)
+ }
+ if got := f.callLog(); len(got) != 0 {
+ t.Fatalf("the serving console was called: %v", got)
+ }
+ })
+ }
}
func TestHomePublishRefusesStatic(t *testing.T) {
@@ -524,10 +542,17 @@ func TestHomeLinkRemovePending(t *testing.T) {
if st := homeStatus(t, home, op); !st.Linked || st.Revocation != "pending" {
t.Fatalf("status = %+v; want linked, revocation pending", st)
}
+ // A fresh console on the same registry (the console restarted) still
+ // reports the pending unlink, and its remove finishes it.
+ fresh := newConsoleFixtureWith(t, consoleFixtureOptions{Tweak: func(c *Config) { c.Registry = home.regPath }})
+ freshOp := cliToken(t, fresh, "paul@keymail.dev", "code-home-pending-fresh")
+ if st := homeStatus(t, fresh, freshOp); !st.Linked || st.Revocation != "pending" {
+ t.Fatalf("a fresh console's status = %+v; want linked, revocation pending", st)
+ }
f.mu.Lock()
f.remove = 0
f.mu.Unlock()
- status, body = homeReq(t, home, http.MethodDelete, "/api/cli/link", op, "")
+ status, body = homeReq(t, fresh, http.MethodDelete, "/api/cli/link", freshOp, "")
if status != http.StatusOK {
t.Fatalf("second remove = %d %s", status, body)
}
@@ -655,9 +680,7 @@ func TestHomeLinkClientFollowsNoRedirect(t *testing.T) {
// credential. linked stores the link as an approved start would.
func claimHomeServing(t *testing.T, cx *claimCase, linked bool) *fakeServing {
t.Helper()
- if err := os.Chmod(cx.regPath, 0o640); err != nil {
- t.Fatal(err)
- }
+ chmodHomeRegistry(t, cx.regPath, 0o640)
f := newFakeServing(t)
cx.vars["serving"] = f.srv.URL
if linked {
@@ -754,3 +777,84 @@ var claimHomeLinkNonAppProbes = map[string]claimProbe{
},
},
}
+
+// TestHomeStartSupersededAtTheLastMoment: request A's poll has its
+// approval and is about to save when request B supersedes it. A saves
+// nothing; B's link is the one kept.
+func TestHomeStartSupersededAtTheLastMoment(t *testing.T) {
+ home := newHomeFixture(t)
+ op := cliToken(t, home, "paul@keymail.dev", "code-home-supersede")
+ a, b := newFakeServing(t), newFakeServing(t)
+ b.approve["token"], b.approve["link_id"], b.approve["account"] = "link-token-b", "ba9876543210", "cab"
+ // B's request stays pending until A's save has been refused. A failing
+ // run releases it too, so B's poll ends before the fixture waits.
+ approveB := make(chan struct{})
+ var releaseB sync.Once
+ release := func() { releaseB.Do(func() { close(approveB) }) }
+ t.Cleanup(release)
+ // And ends the request in flight before the fake consoles close, so a
+ // failing run fails rather than polling a closed server until expiry.
+ t.Cleanup(func() {
+ home.srv.homeLink.mu.Lock()
+ defer home.srv.homeLink.mu.Unlock()
+ if st := home.srv.homeLink.start; st != nil && st.cancel != nil {
+ st.cancel()
+ }
+ })
+ b.handle = func(w http.ResponseWriter, r *http.Request) bool {
+ if r.URL.Path != "/auth/cli/poll" {
+ return false
+ }
+ select {
+ case <-approveB:
+ return false
+ default:
+ writeJSON(w, http.StatusOK, map[string]any{"status": "pending"})
+ return true
+ }
+ }
+ var once sync.Once
+ home.srv.homeLink.beforeSave = func(seq uint64) {
+ once.Do(func() {
+ // The barrier: A is approved and about to persist. B
+ // supersedes it now, through the door.
+ status, out := postJSON(t, home.ts.URL+"/api/cli/link/start", map[string]string{"to": b.srv.URL}, op)
+ if status != http.StatusOK {
+ t.Errorf("start B = %d %v", status, out)
+ }
+ })
+ }
+ if status, out := postJSON(t, home.ts.URL+"/api/cli/link/start", map[string]string{"to": a.srv.URL}, op); status != http.StatusOK {
+ t.Fatalf("start A = %d %v", status, out)
+ }
+ // A's poll ends (saving nothing) once B superseded it.
+ deadline := time.Now().Add(10 * time.Second)
+ for !slicesContains(a.callLog(), "POST /auth/cli/poll") || !slicesContains(b.callLog(), "POST /auth/cli/start") {
+ if time.Now().After(deadline) {
+ t.Fatalf("A polled %v, B saw %v", a.callLog(), b.callLog())
+ }
+ time.Sleep(20 * time.Millisecond)
+ }
+ time.Sleep(300 * time.Millisecond) // A's save, had it not been refused, is done by now
+ if l, _ := homeRegistry(t, home).HomeLink(); l != nil {
+ t.Fatalf("the superseded request saved its link: %+v", l)
+ }
+ release()
+ st := waitHomeStart(t, home, op)
+ if !st.Linked || st.Console != b.srv.URL || st.Account != "cab" {
+ t.Fatalf("status = %+v; want B's link", st)
+ }
+ l, err := homeRegistry(t, home).HomeLink()
+ if err != nil || l == nil || l.ID != "ba9876543210" || l.Token != "link-token-b" || l.ServingURL != b.srv.URL {
+ t.Fatalf("stored link = %+v, %v; want B's", l, err)
+ }
+}
+
+func slicesContains(xs []string, x string) bool {
+ for _, v := range xs {
+ if v == x {
+ return true
+ }
+ }
+ return false
+}
diff --git a/internal/console/links_copy.go b/internal/console/links_copy.go
index 6d87a3a5a..feeae4ad6 100644
--- a/internal/console/links_copy.go
+++ b/internal/console/links_copy.go
@@ -192,10 +192,11 @@ const (
// The 503 from every home link door on a console with no registry
// (CARLOS_REGISTRY), where a link could not be kept.
copyHomeLinkNoRegistry = "this console has no registry, so it can't hold a link"
- // The 409 from POST /api/cli/link/start when the registry file can be
- // read by other users on the machine, so the link's key must not be
- // written there.
- copyHomeLinkRegistryReadable = "other users on this machine can read the registry file, so the link's key can't be kept there. make it readable only by the agent (mode 0640) and try again"
+ // The 409 from POST /api/cli/link/start when the registry file, or a
+ // journal SQLite keeps beside it (-wal, -shm, -journal), can be read by
+ // other users on the machine, so the link's key must not be written
+ // there.
+ copyHomeLinkRegistryReadable = "other users on this machine can read the registry file or its journal files (registry.db-wal, -shm, -journal), so the link's key can't be kept there. make them all readable only by the agent (mode 0640) and try again"
// The 502 when the serving console could not be reached.
copyHomeLinkUnreachable = "could not reach {console}. try again"
// The 502 when the serving console answered with a status and no
diff --git a/internal/console/view.go b/internal/console/view.go
index 1a31b976a..ff5926faf 100644
--- a/internal/console/view.go
+++ b/internal/console/view.go
@@ -561,6 +561,7 @@ type consoleRegistry interface {
// holds and the apps it publishes through it.
HomeLink() (*registry.HomeLink, error)
PutHomeLink(registry.HomeLink) error
+ SetHomeLinkUnlinkPending(id string, pending bool) error
DeleteHomeLink() error
HomeLinkApps() ([]registry.HomeLinkApp, error)
PutHomeLinkApp(registry.HomeLinkApp) error
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 7e2d832af..f3e860eba 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 977bd10e9d3b72202328e6e33fa23cb81597c3307a3a6aed91c7b00082f615d8
+plan14-root-reads-linked-deployments-slice1.tsv 2eb90feb894383f5e240d79a536f99caca2d9f37b4caeaed703519569ffe920e
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 7cdded7d8..62e9bf58b 100644
--- a/internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv
+++ b/internal/provision/testdata/plan14-root-reads-linked-deployments-slice1.tsv
@@ -1,12 +1,12 @@
# 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, 7 sites, 6 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-# 33 new dispositions: 4 reads re-frozen at their disposition with the claim, 28 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 1 other.
+# 34 new dispositions: 4 reads re-frozen at their disposition with the claim, 29 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
@legacy 6487af86ec8ee5c304f749f5e9653f5a6e3dc28412ef29bebe655ec471de70ff internal/registry/forward.go Registry.DeleteForward 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: deletes a forward row only (WHERE kind = 'forward'); remote-or-local shape of every narrow setter (+file:Exec, +registry:Changed, +registry:remote x2, +registry:sql, +whole:remoteClient x2).;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: the one DELETE also refuses a link-placed forward row (AND substr(region, 1, 5) <> 'link/'); a narrower delete, no read added file:Exec@217,registry:Changed@183,registry:remote@66,registry:remote@98,registry:sql@217,whole:remoteClient@100,whole:remoteClient@68 b8340d223ba36ae1cc71c54f86c2d9202dbc8e87aaf968c3054eb7068ad2400c
@legacy 016a166915f0e50879425a00398d783afebf2c3f2b138fe7303689dc5be0933a internal/registry/registry.go Registry.migrate legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user), on every registry open; a box CLI verb that opens the registry directly runs it as whoever runs the verb: census-ruling-seeded-instances's body with two more columns added to routes (incarnation and serving_seq, INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule); self-serve moves 1 Task 7;rev3=census-ruling-rootfs-apps-2;basis=one more ALTER TABLE, routes ADD COLUMN runtime TEXT NOT NULL DEFAULT '', beside main's rate_limit, assets_off, asset_gen, incarnation and serving_seq (the last four from the merges of origin/main 3c33f2eb and 953b9fda); the same sixteen sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328/#329 plan 1 Task 4: three more ALTER TABLE statements in the existing loop, routes ADD COLUMN egress_allow, size and policy_expires_at, each TEXT NOT NULL DEFAULT '' and idempotent through the duplicate-column rule; the same sixteen sites, no read added.;rev3=census-ruling-region-ha-p1a;basis=one more ALTER TABLE in the existing loop: routes ADD COLUMN ha INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule; the same sixteen sites, no read added;rev3=census-ruling-ha-p1a-433;basis=the registry's SQLite side as carlos (agent, registry child; a box CLI verb that opens the registry directly runs it as whoever runs it), on every registry open: the ALTER TABLE routes statements are now built from the one migration definition routeAddedColumns (addedColumn name, type, default; review r1 P2): for each entry without the Claim mark, "ALTER TABLE routes ADD COLUMN " + spec(), byte for byte the statements main runs, in main's order, under the same duplicate-column rule. +registry:Claim is that mark, +whole:addedColumn the struct. Every name, type and default is an in-binary literal; no statement added, removed or changed; no read added.;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: one more CREATE TABLE IF NOT EXISTS regional_domains (host TEXT PRIMARY KEY, target, account, app, region TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL DEFAULT 0), beside wildcard_domains; the added sites are that statement (+file:Exec, +registry:sql), an in-binary literal; additive, no existing statement changed;rev3=census-ruling-region-ha-p1b3b-t;basis=Create local HA duty/replay tables and revision triggers in the existing registry connection; no new database path.;rev3=census-ruling-agent-start-demo-3;basis=Create moved-notice storage as a single (id, wire) row; fingerprints include the stored wire bytes. Census read-site delta: +file:Exec, +registry:sql.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: calls migrateLinks after migrateHADuties (one CREATE TABLE IF NOT EXISTS link_channels, an in-binary literal); additive, no existing statement changed; linked deployments slice 1 Task 7: also runs migrateHomeLink (CREATE TABLE IF NOT EXISTS home_link and home_link_apps) after migrateLinks; additive, the box's own registry database, as carlos file:Exec@1124,file:Exec@1855,file:Exec@212,file:Exec@2409,file:Exec@3347,file:Exec@3626,file:Exec@4489,file:Exec@4665,file:Exec@51,file:Exec@761,registry:Claim@686,registry:sql@1124,registry:sql@1855,registry:sql@212,registry:sql@2409,registry:sql@3347,registry:sql@3626,registry:sql@4489,registry:sql@4665,registry:sql@51,registry:sql@761,whole:addedColumn@661 63fc63e2dd8bcd22c23e590d7e79f2996c31e0edc94aa1da2d48646f99c64ef2
@legacy a10d080a12c01e05c132febd9e72b6656c340866c1749be14ba9e1f142d8e1ea internal/edge/fleetforward.go linkServeEligible legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: new pure rule for a link-placed forward row: refused off the hub, when not inert, when it carries a fleet box, label or replica set, when its link is not in the active link owners, or when its raw Account is empty or not the link's owner; reads only the row and the owners map registry:Account@567,registry:Account@636,registry:Account@720,registry:FleetBox@277,registry:FleetBoxes@321,registry:FleetLabel@298 e15bfdfc2c2928ccd325b8844346be778eb5e186bd7898c2f21bf84c7574dde7
-@legacy 82b21726cd512469f6ccaff2bcfeac008fb0d377e579809188d2bc6b597b43f8 internal/registry/homelink.go CheckCredentialFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): Lstat of the registry path the Registry was opened with (never a caller-named path in production: PutHomeLink passes r.path, the console passes its configured registry); refuses a symbolic link, a non-regular file and a world-readable mode; reads only the mode, refuses more file:Lstat@58 e81e54320614a3ef75aeba1ceb9e9184c2f097fb697802665e747ca5ec0c02b8
+@legacy fea79e228a063943572b0ca4d2abde20ebb96d9ea14678b6bff560828db248ed internal/registry/homelink.go CheckCredentialFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): Lstat of the registry path the Registry was opened with (never a caller-named path in production: PutHomeLink passes r.path, the console passes its configured registry); refuses a symbolic link, a non-regular file and a world-readable mode; reads only the mode, refuses more; fix round 1: also Lstats registry.db-wal, -shm and -journal beside the same path (the WAL holds the token first in WAL mode); a missing journal is skipped, an existing one must be a regular non-symlink file with no world-read bit, else refused naming it; reads only modes, refuses more file:Lstat@150 e721b4422cf333532c8e47d2c99553b6d71d7c8763c1ae4cbbbd29e72b6c3c69
@legacy c7283e7233b5213e808e63d902edc8fb0a32aa5c4e2e65f6c437f15b5349c70e internal/registry/homelink.go Registry.ClaimHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one conditional UPDATE home_link SET box_label WHERE box_label = '' (the agent's claim), reporting whether it applied file:Exec@321,registry:Changed@288,registry:remote@169,registry:remote@201,registry:sql@321,whole:remoteClient@171,whole:remoteClient@203 b2aeb29bea79d56169650a976c811d670b49ff2e40d516750fab647e508ef2ad
@legacy 116b3858199894475b6097cb013d5ff091613743c01b0727888c5b4411b7e362 internal/registry/homelink.go Registry.DeleteHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one transaction deleting home_link_apps and home_link file:Exec@220,file:Exec@302,registry:remote@48,registry:remote@78,whole:remoteClient@50,whole:remoteClient@80 8b984285e4e482cff9c4c61bf9ad301df7a733b97e7578e57e0019467c0ec289
@legacy a92d98586f30275534e4da5d391ee16121e13a0dd6cd2c0415508b61b819af5f internal/registry/homelink.go Registry.DeleteHomeLinkApp legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one IMMEDIATE transaction deleting the name and, when it existed, bumping conn_gen file:Exec@289,registry:Changed@191,registry:remote@102,registry:remote@70,whole:remoteClient@104,whole:remoteClient@72 dc3de197a7a9e9bc760dc47cd182b440acd71cdc44c7d032a29a58ae504383d4
@@ -17,10 +17,11 @@
@legacy 38512bb8a69d0c8a24b85f8417df5bac1c84461634b57f1f2f2525fd75adb8e7 internal/registry/homelink.go Registry.PutHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): validates the link ID and a non-empty token, then CheckCredentialFile on the registry's own path, then one IMMEDIATE transaction writing home_link (deleting another ID's row and the published set); written by the home console only file:Exec@572,file:Exec@759,file:Exec@846,registry:Account@1216,registry:AppsDomain@1227,registry:CreatedAt@455,registry:CreatedAt@490,registry:ID@1174,registry:ID@139,registry:ID@217,registry:ID@619,registry:ID@80,registry:ServingURL@1180,registry:Token@1207,registry:Token@151,registry:TunnelURL@1194,registry:path@382,registry:remote@230,registry:remote@260,whole:HomeLink@316,whole:HomeLink@326,whole:remoteClient@232,whole:remoteClient@262 81dd1dd9c16e821cfd39ca335e1d9f1fa55a18fc1bcbc75ae8d53e7f99415967
@legacy a55f13d1e03fddbaf0d545a171db2235c6ebb2f789fe4490d2359b7c2ade43b5 internal/registry/homelink.go Registry.PutHomeLinkApp legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one IMMEDIATE transaction: refuses with no home_link row, inserts a new name, or rewrites a changed one and bumps conn_gen (bumpHomeLinkConnGen) file:Exec@1147,file:Exec@811,file:QueryRow@423,file:QueryRow@622,registry:HomeAccount@1057,registry:HomeAccount@1248,registry:HomeAccount@77,registry:HomeAccount@938,registry:HomeApp@100,registry:HomeApp@1081,registry:HomeApp@1263,registry:HomeApp@953,registry:HomeHost@1102,registry:HomeHost@119,registry:HomeHost@1274,registry:HomeHost@964,registry:Name@1286,registry:Name@61,registry:Name@713,registry:Name@930,registry:remote@224,registry:remote@254,whole:HomeLinkApp@214,whole:HomeLinkApp@313,whole:HomeLinkApp@326,whole:remoteClient@226,whole:remoteClient@256 60200100b330969fe5d76a7aef03f389fb1229bc29ee8845b98c99d9a1b2fdd8
@legacy 6d481f791fd4fab8ab0814220b50302b99b0b5ee94ab1adc12ffc7fa9a55ea82 internal/registry/homelink.go Registry.SetHomeLinkState legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): validates the state against a closed set, then one UPDATE of home_link.state; not hashed by Fingerprint file:Exec@380,registry:remote@241,registry:remote@271,registry:sql@380,whole:remoteClient@243,whole:remoteClient@273 dc43156360a1fc86911d84f382623acc07baadd3d3420dcb5fa0f7b2a481fa34
-@legacy e32a9f47372dbe223d58017b27cfef78e842b96bae624c50abade2713ae3f1aa internal/registry/homelink.go Registry.migrateHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): CREATE TABLE IF NOT EXISTS home_link and home_link_apps on the box's own registry database, as carlos; additive file:Exec@433,file:Exec@59,registry:sql@433,registry:sql@59 c433ed81b9d0009bb2f1a0d293aa6427894a0d3d9fd6a60f305fdf9c75b4e4b7
+@legacy f9fd8c9c3059fb891f0999cf4e863b502cf9b18950a085aab6bcdb1c4e12fe84 internal/registry/homelink.go Registry.SetHomeLinkUnlinkPending legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7 fix round 1): validates the link ID, then one UPDATE home_link SET unlink_pending WHERE id (or the remote call); the home console's record that a serving-side unlink answered 202; not hashed by Fingerprint file:Exec@353,registry:remote@163,registry:remote@193,registry:sql@353,whole:remoteClient@165,whole:remoteClient@195 c6caeb94d768f23359c73f66bca16f53462424ecd2143f7d7e1bf84a01cf900d
+@legacy f9d12a0679cc67c799d24148017f5261a20d72bb5359862a725b8ca895b4327f internal/registry/homelink.go Registry.migrateHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): CREATE TABLE IF NOT EXISTS home_link and home_link_apps on the box's own registry database, as carlos; additive; fix round 1: one more additive statement, ALTER TABLE home_link ADD COLUMN unlink_pending INTEGER NOT NULL DEFAULT 0, duplicate-column error swallowed; the box's own registry database, as carlos file:Exec@521,file:Exec@59,file:Exec@705,registry:sql@521,registry:sql@59,registry:sql@705 e89e23e2ef451502d0fc7c8259dede51a2e32462bb531ac301210d4e34bd9fb7
@legacy fe8d05784af7d3353ae13bf1d2c7ea34c30b242a0fd43772ed4dae503f3af4dd internal/registry/homelink.go bumpHomeLinkConnGen legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one UPDATE home_link SET conn_gen = conn_gen + 1 inside the caller's transaction file:Exec@53 2fdb6872763f94c49336351be7aa0d96cbe22dace51c1eb466133635f0325c2c
@legacy 435a2ea947465dab611b1d573f004599c29f97d695900fdfd085770900c92e2d internal/registry/homelink.go fingerprintHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): two SELECTs (home_link, home_link_apps) on Fingerprint's own fresh connection, folded into its hash; hashes the token's sha256, never the token file:Query@655,file:Query@72,registry:Account@507,registry:AppsDomain@518,registry:BoxLabel@532,registry:ConnGen@544,registry:HomeAccount@1095,registry:HomeAccount@891,registry:HomeApp@1110,registry:HomeApp@907,registry:HomeHost@1121,registry:HomeHost@919,registry:ID@439,registry:Name@1087,registry:Name@882,registry:ServingURL@445,registry:Token@496,registry:TunnelURL@459 6c9c95eba507d65fe3845f19c68bf5ba76f2edfb12e2b0296c09fec485c0a7a8
-@legacy 78d5da093e5f5a09b45fa7f9f7d277c72f157549dbb7f6c5622213fd5bfd2816 internal/registry/homelink.go scanHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): scans one home_link row into HomeLink; pure registry:Account@167,registry:AppsDomain@179,registry:BoxLabel@196,registry:ConnGen@270,registry:CreatedAt@315,registry:ID@121,registry:ServingURL@128,registry:State@209,registry:Token@157,registry:TunnelURL@143,whole:HomeLink@363 ab62e4389ecbc628b62aaed5c989c77862457243e3c77acb5db973028f21744c
+@legacy 4cadaed5874a683b42bfb495ee077e85ee11eabbfe69838bd87a40a633ded489 internal/registry/homelink.go scanHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): scans one home_link row into HomeLink; pure; fix round 1: also scans unlink_pending into HomeLink.UnlinkPending; pure registry:Account@176,registry:AppsDomain@188,registry:BoxLabel@205,registry:ConnGen@289,registry:CreatedAt@366,registry:ID@130,registry:ServingURL@137,registry:State@218,registry:Token@166,registry:TunnelURL@152,registry:UnlinkPending@314,whole:HomeLink@414 002d3dc1ce6e59195638c9aa04e25c90e87031ca33be0395911aca87c76f1d0b
@legacy e70f7d3114b383da7bd236ef53642b4ded74f395d22741ffa42f30638472a597 internal/registry/links.go Registry.DeleteLinkForward legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new: deletes host's row only while it is a forward row placed exactly link/<linkID> (validated ID); remote-or-local shape of every narrow setter file:Exec@346,registry:Changed@312,registry:remote@175,registry:remote@207,registry:sql@346,whole:remoteClient@177,whole:remoteClient@209 b4eb7a228abe47f59f7d7b24e852014f1bc0eb1a468b88510b51239371d53e22
@legacy 11c4910fcedf49657f3161d0b7d079becedc2be530f32d09c5149c3c88208b24 internal/registry/links.go Registry.LinkChannelAuth legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new: active link_channels token hashes keyed by link:<id>/home, via activeLinkMap; remote-or-local shape registry:StringMap@177,registry:remote@102,registry:remote@70,whole:remoteClient@104,whole:remoteClient@72 7dd9c9b6f9df7401d71b9dfaec929083111f19aa96c37f4dd058d8d2664deb3f
@legacy a0b67cb74b6908970585ef8431ce450014c7c1e5d8110fae4a08efab095dcfc6 internal/registry/links.go Registry.LinkForwards legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new: SELECT routeCols FROM routes for forward rows placed link/<linkID> over a fresh connection to the box's own registry database; remote-or-local shape file:Query@407,registry:Routes@285,registry:remote@165,registry:remote@197,whole:Route@289,whole:Route@702,whole:Route@715,whole:Route@720,whole:Route@734,whole:remoteClient@167,whole:remoteClient@199 0e111abd6943c2f4c6c0be4100df66d1b06f7f98589ce9e5980e6cf6c47e2111
@@ -49,7 +50,7 @@ internal/host/edgesfile.go edgesFileWriteClaims authority F,J1 rev3=census-rulin
internal/registry/forward.go Registry.DeleteForward 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: deletes a forward row only (WHERE kind = 'forward'); remote-or-local shape of every narrow setter (+file:Exec, +registry:Changed, +registry:remote x2, +registry:sql, +whole:remoteClient x2).;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: the one DELETE also refuses a link-placed forward row (AND substr(region, 1, 5) <> 'link/'); a narrower delete, no read added file:Exec@217,registry:Changed@183,registry:remote@66,registry:remote@98,registry:sql@217,whole:remoteClient@100,whole:remoteClient@68 b8340d223ba36ae1cc71c54f86c2d9202dbc8e87aaf968c3054eb7068ad2400c
internal/registry/registry.go Registry.migrate legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user), on every registry open; a box CLI verb that opens the registry directly runs it as whoever runs the verb: census-ruling-seeded-instances's body with two more columns added to routes (incarnation and serving_seq, INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule); self-serve moves 1 Task 7;rev3=census-ruling-rootfs-apps-2;basis=one more ALTER TABLE, routes ADD COLUMN runtime TEXT NOT NULL DEFAULT '', beside main's rate_limit, assets_off, asset_gen, incarnation and serving_seq (the last four from the merges of origin/main 3c33f2eb and 953b9fda); the same sixteen sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328/#329 plan 1 Task 4: three more ALTER TABLE statements in the existing loop, routes ADD COLUMN egress_allow, size and policy_expires_at, each TEXT NOT NULL DEFAULT '' and idempotent through the duplicate-column rule; the same sixteen sites, no read added.;rev3=census-ruling-region-ha-p1a;basis=one more ALTER TABLE in the existing loop: routes ADD COLUMN ha INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule; the same sixteen sites, no read added;rev3=census-ruling-ha-p1a-433;basis=the registry's SQLite side as carlos (agent, registry child; a box CLI verb that opens the registry directly runs it as whoever runs it), on every registry open: the ALTER TABLE routes statements are now built from the one migration definition routeAddedColumns (addedColumn name, type, default; review r1 P2): for each entry without the Claim mark, "ALTER TABLE routes ADD COLUMN " + spec(), byte for byte the statements main runs, in main's order, under the same duplicate-column rule. +registry:Claim is that mark, +whole:addedColumn the struct. Every name, type and default is an in-binary literal; no statement added, removed or changed; no read added.;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: one more CREATE TABLE IF NOT EXISTS regional_domains (host TEXT PRIMARY KEY, target, account, app, region TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL DEFAULT 0), beside wildcard_domains; the added sites are that statement (+file:Exec, +registry:sql), an in-binary literal; additive, no existing statement changed;rev3=census-ruling-region-ha-p1b3b-t;basis=Create local HA duty/replay tables and revision triggers in the existing registry connection; no new database path.;rev3=census-ruling-agent-start-demo-3;basis=Create moved-notice storage as a single (id, wire) row; fingerprints include the stored wire bytes. Census read-site delta: +file:Exec, +registry:sql.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: calls migrateLinks after migrateHADuties (one CREATE TABLE IF NOT EXISTS link_channels, an in-binary literal); additive, no existing statement changed; linked deployments slice 1 Task 7: also runs migrateHomeLink (CREATE TABLE IF NOT EXISTS home_link and home_link_apps) after migrateLinks; additive, the box's own registry database, as carlos file:Exec@1124,file:Exec@1855,file:Exec@212,file:Exec@2409,file:Exec@3347,file:Exec@3626,file:Exec@4489,file:Exec@4665,file:Exec@51,file:Exec@761,registry:Claim@686,registry:sql@1124,registry:sql@1855,registry:sql@212,registry:sql@2409,registry:sql@3347,registry:sql@3626,registry:sql@4489,registry:sql@4665,registry:sql@51,registry:sql@761,whole:addedColumn@661 63fc63e2dd8bcd22c23e590d7e79f2996c31e0edc94aa1da2d48646f99c64ef2
internal/edge/fleetforward.go linkServeEligible legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: new pure rule for a link-placed forward row: refused off the hub, when not inert, when it carries a fleet box, label or replica set, when its link is not in the active link owners, or when its raw Account is empty or not the link's owner; reads only the row and the owners map registry:Account@567,registry:Account@636,registry:Account@720,registry:FleetBox@277,registry:FleetBoxes@321,registry:FleetLabel@298 e15bfdfc2c2928ccd325b8844346be778eb5e186bd7898c2f21bf84c7574dde7
-internal/registry/homelink.go CheckCredentialFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): Lstat of the registry path the Registry was opened with (never a caller-named path in production: PutHomeLink passes r.path, the console passes its configured registry); refuses a symbolic link, a non-regular file and a world-readable mode; reads only the mode, refuses more file:Lstat@58 e81e54320614a3ef75aeba1ceb9e9184c2f097fb697802665e747ca5ec0c02b8
+internal/registry/homelink.go CheckCredentialFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): Lstat of the registry path the Registry was opened with (never a caller-named path in production: PutHomeLink passes r.path, the console passes its configured registry); refuses a symbolic link, a non-regular file and a world-readable mode; reads only the mode, refuses more; fix round 1: also Lstats registry.db-wal, -shm and -journal beside the same path (the WAL holds the token first in WAL mode); a missing journal is skipped, an existing one must be a regular non-symlink file with no world-read bit, else refused naming it; reads only modes, refuses more file:Lstat@150 e721b4422cf333532c8e47d2c99553b6d71d7c8763c1ae4cbbbd29e72b6c3c69
internal/registry/homelink.go Registry.ClaimHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one conditional UPDATE home_link SET box_label WHERE box_label = '' (the agent's claim), reporting whether it applied file:Exec@321,registry:Changed@288,registry:remote@169,registry:remote@201,registry:sql@321,whole:remoteClient@171,whole:remoteClient@203 b2aeb29bea79d56169650a976c811d670b49ff2e40d516750fab647e508ef2ad
internal/registry/homelink.go Registry.DeleteHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one transaction deleting home_link_apps and home_link file:Exec@220,file:Exec@302,registry:remote@48,registry:remote@78,whole:remoteClient@50,whole:remoteClient@80 8b984285e4e482cff9c4c61bf9ad301df7a733b97e7578e57e0019467c0ec289
internal/registry/homelink.go Registry.DeleteHomeLinkApp legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one IMMEDIATE transaction deleting the name and, when it existed, bumping conn_gen file:Exec@289,registry:Changed@191,registry:remote@102,registry:remote@70,whole:remoteClient@104,whole:remoteClient@72 dc3de197a7a9e9bc760dc47cd182b440acd71cdc44c7d032a29a58ae504383d4
@@ -60,10 +61,11 @@ internal/registry/homelink.go Registry.HomeLinkConnGen legacy accepted-legacy ac
internal/registry/homelink.go Registry.PutHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): validates the link ID and a non-empty token, then CheckCredentialFile on the registry's own path, then one IMMEDIATE transaction writing home_link (deleting another ID's row and the published set); written by the home console only file:Exec@572,file:Exec@759,file:Exec@846,registry:Account@1216,registry:AppsDomain@1227,registry:CreatedAt@455,registry:CreatedAt@490,registry:ID@1174,registry:ID@139,registry:ID@217,registry:ID@619,registry:ID@80,registry:ServingURL@1180,registry:Token@1207,registry:Token@151,registry:TunnelURL@1194,registry:path@382,registry:remote@230,registry:remote@260,whole:HomeLink@316,whole:HomeLink@326,whole:remoteClient@232,whole:remoteClient@262 81dd1dd9c16e821cfd39ca335e1d9f1fa55a18fc1bcbc75ae8d53e7f99415967
internal/registry/homelink.go Registry.PutHomeLinkApp legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one IMMEDIATE transaction: refuses with no home_link row, inserts a new name, or rewrites a changed one and bumps conn_gen (bumpHomeLinkConnGen) file:Exec@1147,file:Exec@811,file:QueryRow@423,file:QueryRow@622,registry:HomeAccount@1057,registry:HomeAccount@1248,registry:HomeAccount@77,registry:HomeAccount@938,registry:HomeApp@100,registry:HomeApp@1081,registry:HomeApp@1263,registry:HomeApp@953,registry:HomeHost@1102,registry:HomeHost@119,registry:HomeHost@1274,registry:HomeHost@964,registry:Name@1286,registry:Name@61,registry:Name@713,registry:Name@930,registry:remote@224,registry:remote@254,whole:HomeLinkApp@214,whole:HomeLinkApp@313,whole:HomeLinkApp@326,whole:remoteClient@226,whole:remoteClient@256 60200100b330969fe5d76a7aef03f389fb1229bc29ee8845b98c99d9a1b2fdd8
internal/registry/homelink.go Registry.SetHomeLinkState legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): validates the state against a closed set, then one UPDATE of home_link.state; not hashed by Fingerprint file:Exec@380,registry:remote@241,registry:remote@271,registry:sql@380,whole:remoteClient@243,whole:remoteClient@273 dc43156360a1fc86911d84f382623acc07baadd3d3420dcb5fa0f7b2a481fa34
-internal/registry/homelink.go Registry.migrateHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): CREATE TABLE IF NOT EXISTS home_link and home_link_apps on the box's own registry database, as carlos; additive file:Exec@433,file:Exec@59,registry:sql@433,registry:sql@59 c433ed81b9d0009bb2f1a0d293aa6427894a0d3d9fd6a60f305fdf9c75b4e4b7
+internal/registry/homelink.go Registry.SetHomeLinkUnlinkPending legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7 fix round 1): validates the link ID, then one UPDATE home_link SET unlink_pending WHERE id (or the remote call); the home console's record that a serving-side unlink answered 202; not hashed by Fingerprint file:Exec@353,registry:remote@163,registry:remote@193,registry:sql@353,whole:remoteClient@165,whole:remoteClient@195 c6caeb94d768f23359c73f66bca16f53462424ecd2143f7d7e1bf84a01cf900d
+internal/registry/homelink.go Registry.migrateHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): CREATE TABLE IF NOT EXISTS home_link and home_link_apps on the box's own registry database, as carlos; additive; fix round 1: one more additive statement, ALTER TABLE home_link ADD COLUMN unlink_pending INTEGER NOT NULL DEFAULT 0, duplicate-column error swallowed; the box's own registry database, as carlos file:Exec@521,file:Exec@59,file:Exec@705,registry:sql@521,registry:sql@59,registry:sql@705 e89e23e2ef451502d0fc7c8259dede51a2e32462bb531ac301210d4e34bd9fb7
internal/registry/homelink.go bumpHomeLinkConnGen legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): one UPDATE home_link SET conn_gen = conn_gen + 1 inside the caller's transaction file:Exec@53 2fdb6872763f94c49336351be7aa0d96cbe22dace51c1eb466133635f0325c2c
internal/registry/homelink.go fingerprintHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): two SELECTs (home_link, home_link_apps) on Fingerprint's own fresh connection, folded into its hash; hashes the token's sha256, never the token file:Query@655,file:Query@72,registry:Account@507,registry:AppsDomain@518,registry:BoxLabel@532,registry:ConnGen@544,registry:HomeAccount@1095,registry:HomeAccount@891,registry:HomeApp@1110,registry:HomeApp@907,registry:HomeHost@1121,registry:HomeHost@919,registry:ID@439,registry:Name@1087,registry:Name@882,registry:ServingURL@445,registry:Token@496,registry:TunnelURL@459 6c9c95eba507d65fe3845f19c68bf5ba76f2edfb12e2b0296c09fec485c0a7a8
-internal/registry/homelink.go scanHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): scans one home_link row into HomeLink; pure registry:Account@167,registry:AppsDomain@179,registry:BoxLabel@196,registry:ConnGen@270,registry:CreatedAt@315,registry:ID@121,registry:ServingURL@128,registry:State@209,registry:Token@157,registry:TunnelURL@143,whole:HomeLink@363 ab62e4389ecbc628b62aaed5c989c77862457243e3c77acb5db973028f21744c
+internal/registry/homelink.go scanHomeLink legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new (linked deployments slice 1 Task 7): scans one home_link row into HomeLink; pure; fix round 1: also scans unlink_pending into HomeLink.UnlinkPending; pure registry:Account@176,registry:AppsDomain@188,registry:BoxLabel@205,registry:ConnGen@289,registry:CreatedAt@366,registry:ID@130,registry:ServingURL@137,registry:State@218,registry:Token@166,registry:TunnelURL@152,registry:UnlinkPending@314,whole:HomeLink@414 002d3dc1ce6e59195638c9aa04e25c90e87031ca33be0395911aca87c76f1d0b
internal/registry/links.go Registry.DeleteLinkForward legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new: deletes host's row only while it is a forward row placed exactly link/<linkID> (validated ID); remote-or-local shape of every narrow setter file:Exec@346,registry:Changed@312,registry:remote@175,registry:remote@207,registry:sql@346,whole:remoteClient@177,whole:remoteClient@209 b4eb7a228abe47f59f7d7b24e852014f1bc0eb1a468b88510b51239371d53e22
internal/registry/links.go Registry.LinkChannelAuth legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new: active link_channels token hashes keyed by link:<id>/home, via activeLinkMap; remote-or-local shape registry:StringMap@177,registry:remote@102,registry:remote@70,whole:remoteClient@104,whole:remoteClient@72 7dd9c9b6f9df7401d71b9dfaec929083111f19aa96c37f4dd058d8d2664deb3f
internal/registry/links.go Registry.LinkForwards legacy accepted-legacy accepted-legacy;rev3=census-ruling-linked-deployments-slice1;basis=new: SELECT routeCols FROM routes for forward rows placed link/<linkID> over a fresh connection to the box's own registry database; remote-or-local shape file:Query@407,registry:Routes@285,registry:remote@165,registry:remote@197,whole:Route@289,whole:Route@702,whole:Route@715,whole:Route@720,whole:Route@734,whole:remoteClient@167,whole:remoteClient@199 0e111abd6943c2f4c6c0be4100df66d1b06f7f98589ce9e5980e6cf6c47e2111
@@ -79,7 +81,7 @@ internal/registry/links.go linkAdmits legacy accepted-legacy accepted-legacy;rev
internal/edge/fleetforward.go DispatchArm 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): review R2: Reload's dispatch order as one function over a row it serves (forward only when admitted to the fleet arm, own Tunnel where tunnels are on, fleet arm, socket, AddrList, static, status, else none), moved out of Reload's switch unchanged; read by Reload and FleetArmVerdict. Pure; no I/O.;rev3=census-ruling-stateless-replicas-3;basis=Task 3: read FleetBoxes and ValidReplicaProjection on the supplied row before the legacy forward/tunnel/fleet arms. An admitted valid set selects ArmReplica; a set without fleet authority selects no arm. Local non-hub resident socket dispatch remains unchanged. No external read.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: a link-placed forward row (registry.LinkPlacement over Region) dispatches to ArmLink when the verdict's Arm holds it and to ArmNone otherwise, ahead of every other case; +registry:Region is that parse registry:FleetBoxes@219,registry:Kind@603,registry:Kind@649,registry:Region@106,registry:Socket@513,registry:Tunnel@426 319127d0441ea71dc3acb0a24426a85b02eb31ee1b780b5037f51b6b2bf97c59
internal/provision/forward.go forwardPhase.mint 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 10: mints a forward row through PutForward for an owner's fleet-placed record; a host another row holds is left alone and logged naming the holding row (+registry:Account, +registry:App, +registry:Kind, +whole:Route x4). Agent only.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 2: before any write, an existing forward row whose Region registry.LinkPlacement parses is reported held (the existing held log line, naming the link, its app and account) and nothing is written; reads only the listed row (Region, App, Account); the pass writes less, never more registry:Account@335,registry:Account@488,registry:App@321,registry:App@474,registry:Kind@306,registry:Region@182,whole:Route@121,whole:Route@543,whole:Route@553,whole:Route@762 ff5165ed5028b296f57b4877b8c36d6c30ec764db8a7085711c3e884b6d11f79
internal/provision/forward.go forwardView.retirements 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 10: the forward rows to retire over the snapshot re-walk (+registry:Host x5, +whole:Route): only forward rows; disputed hosts kept. Agent only.;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 2: a forward row whose Region registry.LinkPlacement parses is never listed for retirement, on the hub or off it; reads only the listed row's Region; the pass deletes less, never more (DeleteForward already refuses link rows) registry:Host@299,registry:Host@368,registry:Host@416,registry:Host@443,registry:Host@606,registry:Region@245,whole:Route@160 04c5190f27d514ec8a95eb0149324ed64ef79411c5f792fb6456c60eae2eb72e
-internal/registry/remote_dispatch.go Registry.dispatchRemote hint E2 rev3=census-ruling-self-serve-moves-1;basis=the registry child (carlos __registry-child, the service user a root pass forks): plan14-root-reads-e's mixed declaration (E2 adds only the ArtifactHosts read; every other arm is the local method of the same name), with three more write arms, SetHoldIfSeq, ReleaseHoldSeq and InstallLifetimeIf, each calling the local setter; no read operation added; self-serve moves 1 Task 7;rev3=census-ruling-instance-egress-sizes-328-329;identity=the registry child (carlos __registry-child, the service user a root pass forks);basis=#328/#329 plan 1 Task 4: one more write arm, SetPolicy, calling the local Registry.SetPolicy with the request's Host, EgressAllow, Size and PolicyExpiresAt (remoteRequest fields sent by the remote handle's holder); the new kinds registry:EgressAllow, registry:Size and registry:PolicyExpiresAt, one site each, plus one more registry:Host site, all of the request; no read operation added; the read-only worker never reaches it (serveRemote's method gate); no production root pass sends SetPolicy;rev3=census-ruling-region-ha-p1a;basis=the registry child (carlos __registry-child, the service user a root pass forks): one more write arm, SetHA, calling the local Registry.SetHA with the request's Host (+registry:Host); no read operation added; only the provision pass sends it;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 2 and 8: two new remote methods, UpsertUnlessRootfs (carlos add's guarded write) and ResidentInstances (the residency sweep's list), each calling the same-named Registry method;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: two more methods on the existing remote registry transport, ListRegional and ReplaceRegionalSet (request field RDs, response field Regional), each calling the local method of the same name, which validates its own input; no new kind of read;rev3=census-ruling-fleet-secrets-key;basis=one new case, SetFleetSecretsKey, reading the request's Name, Pub, KeyFP, By and At fields and calling SetFleetSecretsKey;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 1-2: three new cases (SetFleetBoxIf reads the request's Fleet and answers Changed; PutForward reads TValue, a whole Route; DeleteForward reads Host and answers Changed); SetFleetBox gone (+registry:Changed x2, +registry:Fleet, +registry:Host, +registry:TValue, +whole:Route). Each case calls the local writer with its own guards.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Tasks 2 and 6b): three more remote methods dispatched to their local forms, SetFleetBoxDraining (q.Fleet, q.Label, q.At, answering Number64), MarkFleetBoxLabelled (q.Fleet, q.Label, q.At) and SetFleetAssignment (q.Host, q.Assigned, q.Moved); remoteRequest gains Assigned and Moved. The registry child, not root.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Add SetServingMode dispatch using the existing remote request Host, Ver and On fields; the same local narrow writer handles it. No new transport or root path. Task 4 R24: dispatch SeedStateless with the existing Observed Route and On carriers to its symmetric guarded local method. No new transport; the existing read-only service gate still refuses writes.;rev3=census-ruling-region-ha-p1b3b-t;basis=Dispatch typed duty, import, exact replacement and guarded receipt operations through the existing service-user registry transport, preserving comparisons and errors. B2 fix r1: dispatch AdvanceHADuty through the existing service-user registry channel and error mapping, reading the request Host only. Read-only method allowlist remains unchanged. B3b: transport bounded typed local journal requests and results over the existing authenticated registry channel; no arbitrary SQL or disk path.;rev3=census-ruling-managed-fleets-2a;basis=Expose the two owned managed preparation methods with Fleet envelope fields, preserving conditional result. Witness TestManagedRegistryPreparationMethods local/remote parity. Dispatch ClearFleetBoxDraining with fleet, label and timestamp to validated local method; no new transport or root path. Witness TestManagedConditionalDrainClear. Dispatch managed insert with FleetBox and At, and return Changed for conditional drain clear. Existing transport and local validation; no new root path. Witness TestAddManagedFleetBox local/remote parity.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: adds ClearReplicaAssignment over the existing typed registry RPC; local writer checks the complete observed row. Existing read-only RPC gate unchanged. merge of origin/main 9b8b2c50: retain all HA journal/duty/wake/adoption RPCs alongside replica assignment RPCs; union of request/response fields and error sentinels, unchanged transport and read-only gate. Merge 0b3098cb also retains main's two managed fleet RPCs; the replica RPCs and shared refusal gate remain intact.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 1: the registry child (carlos __registry-child, the service user a root pass forks) answers GetFleet and ListFleetBoxes with GetFleetContext(ctx, q.Name) and ListFleetBoxesContext(ctx, q.Fleet), passing its existing request context so a cancelled caller ends the child's SQL read; same request fields (Name, Fleet) and same local queries; no method, field or read operation added; read-only method gate unchanged;rev3=census-ruling-edge-page-cache-1;basis=adds the SetPages method: r.SetPages(q.Host, q.PagesOff), the request's PagesOff field (the +registry:Host and +registry:PagesOff sites); the same dispatch as SetAssets. Merged onto main's body at 04dc1dc0 (managed fleets 2b-1: GetFleet and ListFleetBoxes now go through their Context forms with the dispatch ctx), which this branch does not change;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: nine more cases (PutLinkChannel, RevokeLinkChannel, LinkChannelAuth, LinkOwners, SetLinkSeen, ResetLinkSeen, LinkSeen, LinkForwards, DeleteLinkForward), each calling the local method with request fields; no other case changed; linked deployments slice 1 Task 7: ten cases for the home link methods (HomeLink, PutHomeLink, DeleteHomeLink, ClaimHomeLink, SetHomeLinkState, HomeLinkConnGen, HomeLinkApps, HomeLinkAppByName, PutHomeLinkApp, DeleteHomeLinkApp), each passing the request's HomeLink, HomeLinkApp, Label, Status or Name to the registry method of that name; the same transport, no read added registry:A@10754,registry:Account@2988,registry:Account@3087,registry:Account@6970,registry:Accounts@5632,registry:Addr@7547,registry:Addrs@7555,registry:Adoption@1013,registry:Adoption@818,registry:Alias@10802,registry:Alias@10866,registry:Alias@10954,registry:Aliases@10676,registry:Alive@12629,registry:Args@10378,registry:AssetGen@7754,registry:AssetsOff@7741,registry:Assigned@8232,registry:Assignment@9648,registry:Assignment@9746,registry:At@10885,registry:At@10963,registry:At@12377,registry:At@3322,registry:At@3390,registry:At@3782,registry:At@3879,registry:At@3964,registry:At@9126,registry:Attempts@12399,registry:B@3385,registry:B@3439,registry:Backing@7366,registry:Bucket@3100,registry:BuildState@7991,registry:By@3316,registry:Changed@12309,registry:Changed@2860,registry:Changed@2933,registry:Changed@3034,registry:Changed@322,registry:Changed@3721,registry:Changed@4152,registry:Changed@4225,registry:Changed@464,registry:Changed@4674,registry:Changed@4915,registry:Changed@5363,registry:Changed@564,registry:Changed@6055,registry:Changed@6142,registry:Changed@6231,registry:Changed@6302,registry:Changed@6406,registry:Changed@6493,registry:Changed@6586,registry:Changed@6668,registry:Changed@832,registry:Changed@8579,registry:Changed@8716,registry:Changed@929,registry:Changed@9313,registry:Changed@9501,registry:Channel@7030,registry:Channel@8422,registry:Channel@8971,registry:CheckedAt@9052,registry:Class@7485,registry:DoneBefore@12638,registry:Due@10079,registry:Due@10143,registry:Due@12421,registry:Duty@312,registry:Duty@390,registry:Duty@634,registry:EgressAllow@7894,registry:Env@8490,registry:Env@8882,registry:Env@8982,registry:ExcludeHosts@12104,registry:ExcludeHosts@12199,registry:ExpectGood@9251,registry:ExpectOp@6110,registry:ExpectOp@6360,registry:ExpectPair@6540,registry:Expected@1001,registry:Expected@1153,registry:Expected@1626,registry:Expected@1803,registry:Expected@2114,registry:F@2832,registry:F@2893,registry:F@2978,registry:F@2988,registry:F@3077,registry:F@3087,registry:F@3100,registry:Fleet@3132,registry:Fleet@3497,registry:Fleet@3579,registry:Fleet@3660,registry:Fleet@3764,registry:Fleet@3861,registry:Fleet@3946,registry:Fleet@4047,registry:Fleet@8622,registry:FleetBoxes@3996,registry:Fleets@3202,registry:From@7141,registry:From@7202,registry:FromDB@7277,registry:FromOp@6198,registry:FromSock@7287,registry:HAJournal@183,registry:HAJournal@221,registry:Hash@8296,registry:Health@7564,registry:HomeLink@4751,registry:HomeLink@4827,registry:HomeLinkApp@5219,registry:HomeLinkApp@5319,registry:HomeLinkApps@5149,registry:Host@10016,registry:Host@10071,registry:Host@10135,registry:Host@10319,registry:Host@10370,registry:Host@10437,registry:Host@10512,registry:Host@10575,registry:Host@11172,registry:Host@11298,registry:Host@1136,registry:Host@11452,registry:Host@11740,registry:Host@11804,registry:Host@11863,registry:Host@11946,registry:Host@12029,registry:Host@12260,registry:Host@12345,registry:Host@12477,registry:Host@12558,registry:Host@12721,registry:Host@1888,registry:Host@1999,registry:Host@286,registry:Host@350,registry:Host@422,registry:Host@4713,registry:Host@501,registry:Host@5816,registry:Host@5857,registry:Host@6010,registry:Host@602,registry:Host@6086,registry:Host@6172,registry:Host@6264,registry:Host@6336,registry:Host@6442,registry:Host@6532,registry:Host@6620,registry:Host@6712,registry:Host@694,registry:Host@6962,registry:Host@7022,registry:Host@7080,registry:Host@7133,registry:Host@7194,registry:Host@7269,registry:Host@7358,registry:Host@7412,registry:Host@7477,registry:Host@7539,registry:Host@7617,registry:Host@7674,registry:Host@772,registry:Host@7733,registry:Host@7821,registry:Host@7886,registry:Host@7983,registry:Host@8048,registry:Host@8109,registry:Host@8159,registry:Host@8224,registry:Host@8288,registry:Host@8349,registry:Host@8482,registry:Host@8536,registry:Host@8614,registry:Host@869,registry:Host@8751,registry:Host@8804,registry:Host@9034,registry:Host@9118,registry:Host@9175,registry:Host@9243,registry:Host@9458,registry:Host@9723,registry:Host@973,registry:Host@9880,registry:Host@9956,registry:Hosts@1051,registry:Hosts@5695,registry:Hosts@8413,registry:Hosts@8873,registry:Hosts@8962,registry:Id@2108,registry:Id@2419,registry:Id@2518,registry:Id@2598,registry:Id@2749,registry:IdValue@5451,registry:Idle@10445,registry:Import@734,registry:Journal@1306,registry:Journal@2126,registry:Journal@2425,registry:Journal@2604,registry:Keep@12737,registry:KeyFP@3307,registry:Kind@12566,registry:Kind@12729,registry:Label@3506,registry:Label@3588,registry:Label@3669,registry:Label@3773,registry:Label@3870,registry:Label@3955,registry:Label@4950,registry:Label@8631,registry:Lifetime@358,registry:Lifetime@430,registry:Lifetime@517,registry:Lifetime@610,registry:Lifetime@877,registry:Limit@12095,registry:Limit@12190,registry:Link@4188,registry:LinkID@4264,registry:LinkID@4443,registry:LinkID@4635,registry:LinkID@4721,registry:LinkSeen@4545,registry:MaxRun@10453,registry:Method@151,registry:Moved@8244,registry:Ms@12393,registry:Name@11812,registry:Name@11871,registry:Name@11954,registry:Name@12268,registry:Name@12353,registry:Name@12485,registry:Name@1896,registry:Name@2007,registry:Name@2978,registry:Name@3077,registry:Name@3172,registry:Name@3292,registry:Name@5262,registry:Name@5402,registry:Name@5470,registry:Next@1165,registry:NextAt@12411,registry:NextGood@9265,registry:NextValue@2678,registry:NextValue@2776,registry:Now@10646,registry:Now@12088,registry:Now@12183,registry:Now@12276,registry:Now@2031,registry:Number64@3819,registry:Number64@5099,registry:Number64@5558,registry:Number@12526,registry:Number@12597,registry:Number@12682,registry:Observed@1229,registry:Observed@9359,registry:Observed@9446,registry:Observed@9546,registry:Observed@9621,registry:Observed@9813,registry:ObservedValue@1507,registry:Old@2671,registry:Old@2769,registry:On@10024,registry:On@10520,registry:On@10583,registry:On@4460,registry:On@9760,registry:On@9825,registry:On@9895,registry:Op@6028,registry:Op@6104,registry:Op@6272,registry:Op@6354,registry:Op@6450,registry:Op@6628,registry:Op@6720,registry:Owner@1144,registry:Owner@1241,registry:Owner@1524,registry:P@11406,registry:PagesOff@7682,registry:Pair@509,registry:Pair@6372,registry:Pair@6456,registry:Pair@6554,registry:Pair@780,registry:Pair@981,registry:Path@11637,registry:Paths@11334,registry:PolicyExpiresAt@7917,registry:Prefix@11460,registry:Prev@9190,registry:Pub@3300,registry:RDs@11306,registry:RateLimit@8357,registry:Receipt@889,registry:Regional@11204,registry:Registration@11962,registry:Registration@12361,registry:Registration@1904,registry:Registration@2015,registry:Replica@8117,registry:ReplicaLife@9633,registry:ReplicaLife@9731,registry:Replicas@8056,registry:Retirement@2755,registry:Revision@529,registry:Revision@622,registry:Revision@989,registry:Route@5793,registry:Routes@10177,registry:Routes@10244,registry:Routes@10613,registry:Routes@4602,registry:Routes@5751,registry:Routes@6746,registry:Rows@11748,registry:Seed@10327,registry:SeenAt@4466,registry:Seq@4453,registry:Size@7909,registry:Sqid@5462,registry:Sqid@5525,registry:Sqid@5604,registry:Status@10875,registry:Status@12383,registry:Status@12493,registry:Status@1920,registry:Status@3678,registry:Status@5012,registry:Status@6018,registry:Status@6094,registry:Status@6180,registry:Status@6344,registry:Status@7088,registry:Status@9042,registry:Steering@7625,registry:StringMap@4084,registry:StringMap@4301,registry:StringMap@4364,registry:T@11688,registry:T@1621,registry:T@1715,registry:T@1798,registry:TValue@5898,registry:TValue@5965,registry:TValue@8681,registry:TValue@9371,registry:Tags@3597,registry:Target@8812,registry:Targets@1317,registry:Text@11493,registry:Text@11556,registry:Text@2324,registry:Text@2471,registry:Text@5572,registry:Timer@11776,registry:Timer@1573,registry:Timer@1755,registry:Timers@11999,registry:Timers@12058,registry:Timers@12147,registry:Times@12771,registry:To@7149,registry:To@7210,registry:ToDB@7299,registry:ToOp@6190,registry:ToSock@7307,registry:TokenHash@3515,registry:Tunnel@8544,registry:Unit@7420,registry:UpdateSettings@7829,registry:Ver@9183,registry:Ver@9888,registry:Ver@9964,registry:W@11106,registry:Wake@702,registry:Wake@788,registry:Wildcards@11000,whole:Account@5636,whole:ClaimOwnership@1146,whole:ClaimOwnership@1243,whole:ClaimOwnership@1526,whole:ClaimRow@1319,whole:ClaimRowArchive@1425,whole:ClaimRowArchive@1435,whole:ColdRows@2673,whole:ColdRows@2680,whole:ColdRows@2771,whole:ColdRows@2778,whole:DutyState@316,whole:DutyState@394,whole:DutyState@636,whole:Fleet@2834,whole:Fleet@2895,whole:Fleet@2980,whole:Fleet@2990,whole:Fleet@3079,whole:Fleet@3089,whole:Fleet@3102,whole:Fleet@3136,whole:Fleet@3206,whole:FleetBox@3387,whole:FleetBox@3441,whole:FleetBox@4000,whole:GoodBuild@9253,whole:GoodBuild@9267,whole:HAAdoption@1015,whole:HAAdoption@822,whole:HAWakeImport@704,whole:HAWakeImport@790,whole:HomeLink@4755,whole:HomeLink@4829,whole:HomeLinkApp@5153,whole:HomeLinkApp@5223,whole:HomeLinkApp@5321,whole:LinkChannel@4190,whole:LinkSeen@4549,whole:Pair@511,whole:Pair@6374,whole:Pair@6458,whole:Pair@6542,whole:Pair@6556,whole:Pair@782,whole:Pair@983,whole:RegionalDomain@11208,whole:RegionalDomain@11308,whole:Route@10181,whole:Route@10248,whole:Route@10617,whole:Route@1231,whole:Route@4606,whole:Route@5755,whole:Route@5797,whole:Route@5900,whole:Route@5967,whole:Route@6750,whole:Route@6905,whole:Route@6911,whole:Route@8683,whole:Route@9361,whole:Route@9373,whole:Route@9448,whole:Route@9548,whole:Route@9623,whole:Route@9815,whole:RouteAlias@10680,whole:RouteAlias@10756,whole:RoutePath@11338,whole:RoutePath@11408,whole:Timer@11690,whole:Timer@11750,whole:Timer@11780,whole:Timer@12003,whole:Timer@12062,whole:Timer@12151,whole:Timer@1509,whole:Timer@1577,whole:Timer@1623,whole:Timer@1717,whole:Timer@1759,whole:Timer@1800,whole:WildcardDomain@11004,whole:WildcardDomain@11108,whole:haJournalRequest@223,whole:haJournalResponse@187 7b9fb6b54bfd2ed66e39aa0913098e17a56370f4351a6bcaf80bcc1303bacbd7
+internal/registry/remote_dispatch.go Registry.dispatchRemote hint E2 rev3=census-ruling-self-serve-moves-1;basis=the registry child (carlos __registry-child, the service user a root pass forks): plan14-root-reads-e's mixed declaration (E2 adds only the ArtifactHosts read; every other arm is the local method of the same name), with three more write arms, SetHoldIfSeq, ReleaseHoldSeq and InstallLifetimeIf, each calling the local setter; no read operation added; self-serve moves 1 Task 7;rev3=census-ruling-instance-egress-sizes-328-329;identity=the registry child (carlos __registry-child, the service user a root pass forks);basis=#328/#329 plan 1 Task 4: one more write arm, SetPolicy, calling the local Registry.SetPolicy with the request's Host, EgressAllow, Size and PolicyExpiresAt (remoteRequest fields sent by the remote handle's holder); the new kinds registry:EgressAllow, registry:Size and registry:PolicyExpiresAt, one site each, plus one more registry:Host site, all of the request; no read operation added; the read-only worker never reaches it (serveRemote's method gate); no production root pass sends SetPolicy;rev3=census-ruling-region-ha-p1a;basis=the registry child (carlos __registry-child, the service user a root pass forks): one more write arm, SetHA, calling the local Registry.SetHA with the request's Host (+registry:Host); no read operation added; only the provision pass sends it;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 2 and 8: two new remote methods, UpsertUnlessRootfs (carlos add's guarded write) and ResidentInstances (the residency sweep's list), each calling the same-named Registry method;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: two more methods on the existing remote registry transport, ListRegional and ReplaceRegionalSet (request field RDs, response field Regional), each calling the local method of the same name, which validates its own input; no new kind of read;rev3=census-ruling-fleet-secrets-key;basis=one new case, SetFleetSecretsKey, reading the request's Name, Pub, KeyFP, By and At fields and calling SetFleetSecretsKey;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 1-2: three new cases (SetFleetBoxIf reads the request's Fleet and answers Changed; PutForward reads TValue, a whole Route; DeleteForward reads Host and answers Changed); SetFleetBox gone (+registry:Changed x2, +registry:Fleet, +registry:Host, +registry:TValue, +whole:Route). Each case calls the local writer with its own guards.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Tasks 2 and 6b): three more remote methods dispatched to their local forms, SetFleetBoxDraining (q.Fleet, q.Label, q.At, answering Number64), MarkFleetBoxLabelled (q.Fleet, q.Label, q.At) and SetFleetAssignment (q.Host, q.Assigned, q.Moved); remoteRequest gains Assigned and Moved. The registry child, not root.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Add SetServingMode dispatch using the existing remote request Host, Ver and On fields; the same local narrow writer handles it. No new transport or root path. Task 4 R24: dispatch SeedStateless with the existing Observed Route and On carriers to its symmetric guarded local method. No new transport; the existing read-only service gate still refuses writes.;rev3=census-ruling-region-ha-p1b3b-t;basis=Dispatch typed duty, import, exact replacement and guarded receipt operations through the existing service-user registry transport, preserving comparisons and errors. B2 fix r1: dispatch AdvanceHADuty through the existing service-user registry channel and error mapping, reading the request Host only. Read-only method allowlist remains unchanged. B3b: transport bounded typed local journal requests and results over the existing authenticated registry channel; no arbitrary SQL or disk path.;rev3=census-ruling-managed-fleets-2a;basis=Expose the two owned managed preparation methods with Fleet envelope fields, preserving conditional result. Witness TestManagedRegistryPreparationMethods local/remote parity. Dispatch ClearFleetBoxDraining with fleet, label and timestamp to validated local method; no new transport or root path. Witness TestManagedConditionalDrainClear. Dispatch managed insert with FleetBox and At, and return Changed for conditional drain clear. Existing transport and local validation; no new root path. Witness TestAddManagedFleetBox local/remote parity.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: adds ClearReplicaAssignment over the existing typed registry RPC; local writer checks the complete observed row. Existing read-only RPC gate unchanged. merge of origin/main 9b8b2c50: retain all HA journal/duty/wake/adoption RPCs alongside replica assignment RPCs; union of request/response fields and error sentinels, unchanged transport and read-only gate. Merge 0b3098cb also retains main's two managed fleet RPCs; the replica RPCs and shared refusal gate remain intact.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 1: the registry child (carlos __registry-child, the service user a root pass forks) answers GetFleet and ListFleetBoxes with GetFleetContext(ctx, q.Name) and ListFleetBoxesContext(ctx, q.Fleet), passing its existing request context so a cancelled caller ends the child's SQL read; same request fields (Name, Fleet) and same local queries; no method, field or read operation added; read-only method gate unchanged;rev3=census-ruling-edge-page-cache-1;basis=adds the SetPages method: r.SetPages(q.Host, q.PagesOff), the request's PagesOff field (the +registry:Host and +registry:PagesOff sites); the same dispatch as SetAssets. Merged onto main's body at 04dc1dc0 (managed fleets 2b-1: GetFleet and ListFleetBoxes now go through their Context forms with the dispatch ctx), which this branch does not change;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 1: nine more cases (PutLinkChannel, RevokeLinkChannel, LinkChannelAuth, LinkOwners, SetLinkSeen, ResetLinkSeen, LinkSeen, LinkForwards, DeleteLinkForward), each calling the local method with request fields; no other case changed; linked deployments slice 1 Task 7: ten cases for the home link methods (HomeLink, PutHomeLink, DeleteHomeLink, ClaimHomeLink, SetHomeLinkState, HomeLinkConnGen, HomeLinkApps, HomeLinkAppByName, PutHomeLinkApp, DeleteHomeLinkApp), each passing the request's HomeLink, HomeLinkApp, Label, Status or Name to the registry method of that name; the same transport, no read added; linked deployments slice 1 Task 7 fix round 1: one more case, SetHomeLinkUnlinkPending, passing the request's LinkID and On to the registry method of that name; no read added registry:A@10839,registry:Account@2988,registry:Account@3087,registry:Account@7055,registry:Accounts@5717,registry:Addr@7632,registry:Addrs@7640,registry:Adoption@1013,registry:Adoption@818,registry:Alias@10887,registry:Alias@10951,registry:Alias@11039,registry:Aliases@10761,registry:Alive@12714,registry:Args@10463,registry:AssetGen@7839,registry:AssetsOff@7826,registry:Assigned@8317,registry:Assignment@9733,registry:Assignment@9831,registry:At@10970,registry:At@11048,registry:At@12462,registry:At@3322,registry:At@3390,registry:At@3782,registry:At@3879,registry:At@3964,registry:At@9211,registry:Attempts@12484,registry:B@3385,registry:B@3439,registry:Backing@7451,registry:Bucket@3100,registry:BuildState@8076,registry:By@3316,registry:Changed@12394,registry:Changed@2860,registry:Changed@2933,registry:Changed@3034,registry:Changed@322,registry:Changed@3721,registry:Changed@4152,registry:Changed@4225,registry:Changed@464,registry:Changed@4674,registry:Changed@4915,registry:Changed@5448,registry:Changed@564,registry:Changed@6140,registry:Changed@6227,registry:Changed@6316,registry:Changed@6387,registry:Changed@6491,registry:Changed@6578,registry:Changed@6671,registry:Changed@6753,registry:Changed@832,registry:Changed@8664,registry:Changed@8801,registry:Changed@929,registry:Changed@9398,registry:Changed@9586,registry:Channel@7115,registry:Channel@8507,registry:Channel@9056,registry:CheckedAt@9137,registry:Class@7570,registry:DoneBefore@12723,registry:Due@10164,registry:Due@10228,registry:Due@12506,registry:Duty@312,registry:Duty@390,registry:Duty@634,registry:EgressAllow@7979,registry:Env@8575,registry:Env@8967,registry:Env@9067,registry:ExcludeHosts@12189,registry:ExcludeHosts@12284,registry:ExpectGood@9336,registry:ExpectOp@6195,registry:ExpectOp@6445,registry:ExpectPair@6625,registry:Expected@1001,registry:Expected@1153,registry:Expected@1626,registry:Expected@1803,registry:Expected@2114,registry:F@2832,registry:F@2893,registry:F@2978,registry:F@2988,registry:F@3077,registry:F@3087,registry:F@3100,registry:Fleet@3132,registry:Fleet@3497,registry:Fleet@3579,registry:Fleet@3660,registry:Fleet@3764,registry:Fleet@3861,registry:Fleet@3946,registry:Fleet@4047,registry:Fleet@8707,registry:FleetBoxes@3996,registry:Fleets@3202,registry:From@7226,registry:From@7287,registry:FromDB@7362,registry:FromOp@6283,registry:FromSock@7372,registry:HAJournal@183,registry:HAJournal@221,registry:Hash@8381,registry:Health@7649,registry:HomeLink@4751,registry:HomeLink@4827,registry:HomeLinkApp@5304,registry:HomeLinkApp@5404,registry:HomeLinkApps@5234,registry:Host@10041,registry:Host@10101,registry:Host@10156,registry:Host@10220,registry:Host@10404,registry:Host@10455,registry:Host@10522,registry:Host@10597,registry:Host@10660,registry:Host@11257,registry:Host@1136,registry:Host@11383,registry:Host@11537,registry:Host@11825,registry:Host@11889,registry:Host@11948,registry:Host@12031,registry:Host@12114,registry:Host@12345,registry:Host@12430,registry:Host@12562,registry:Host@12643,registry:Host@12806,registry:Host@1888,registry:Host@1999,registry:Host@286,registry:Host@350,registry:Host@422,registry:Host@4713,registry:Host@501,registry:Host@5901,registry:Host@5942,registry:Host@602,registry:Host@6095,registry:Host@6171,registry:Host@6257,registry:Host@6349,registry:Host@6421,registry:Host@6527,registry:Host@6617,registry:Host@6705,registry:Host@6797,registry:Host@694,registry:Host@7047,registry:Host@7107,registry:Host@7165,registry:Host@7218,registry:Host@7279,registry:Host@7354,registry:Host@7443,registry:Host@7497,registry:Host@7562,registry:Host@7624,registry:Host@7702,registry:Host@772,registry:Host@7759,registry:Host@7818,registry:Host@7906,registry:Host@7971,registry:Host@8068,registry:Host@8133,registry:Host@8194,registry:Host@8244,registry:Host@8309,registry:Host@8373,registry:Host@8434,registry:Host@8567,registry:Host@8621,registry:Host@869,registry:Host@8699,registry:Host@8836,registry:Host@8889,registry:Host@9119,registry:Host@9203,registry:Host@9260,registry:Host@9328,registry:Host@9543,registry:Host@973,registry:Host@9808,registry:Host@9965,registry:Hosts@1051,registry:Hosts@5780,registry:Hosts@8498,registry:Hosts@8958,registry:Hosts@9047,registry:Id@2108,registry:Id@2419,registry:Id@2518,registry:Id@2598,registry:Id@2749,registry:IdValue@5536,registry:Idle@10530,registry:Import@734,registry:Journal@1306,registry:Journal@2126,registry:Journal@2425,registry:Journal@2604,registry:Keep@12822,registry:KeyFP@3307,registry:Kind@12651,registry:Kind@12814,registry:Label@3506,registry:Label@3588,registry:Label@3669,registry:Label@3773,registry:Label@3870,registry:Label@3955,registry:Label@4950,registry:Label@8716,registry:Lifetime@358,registry:Lifetime@430,registry:Lifetime@517,registry:Lifetime@610,registry:Lifetime@877,registry:Limit@12180,registry:Limit@12275,registry:Link@4188,registry:LinkID@4264,registry:LinkID@4443,registry:LinkID@4635,registry:LinkID@4721,registry:LinkID@5091,registry:LinkSeen@4545,registry:MaxRun@10538,registry:Method@151,registry:Moved@8329,registry:Ms@12478,registry:Name@11897,registry:Name@11956,registry:Name@12039,registry:Name@12353,registry:Name@12438,registry:Name@12570,registry:Name@1896,registry:Name@2007,registry:Name@2978,registry:Name@3077,registry:Name@3172,registry:Name@3292,registry:Name@5347,registry:Name@5487,registry:Name@5555,registry:Next@1165,registry:NextAt@12496,registry:NextGood@9350,registry:NextValue@2678,registry:NextValue@2776,registry:Now@10731,registry:Now@12173,registry:Now@12268,registry:Now@12361,registry:Now@2031,registry:Number64@3819,registry:Number64@5184,registry:Number64@5643,registry:Number@12611,registry:Number@12682,registry:Number@12767,registry:Observed@1229,registry:Observed@9444,registry:Observed@9531,registry:Observed@9631,registry:Observed@9706,registry:Observed@9898,registry:ObservedValue@1507,registry:Old@2671,registry:Old@2769,registry:On@10109,registry:On@10605,registry:On@10668,registry:On@4460,registry:On@5101,registry:On@9845,registry:On@9910,registry:On@9980,registry:Op@6113,registry:Op@6189,registry:Op@6357,registry:Op@6439,registry:Op@6535,registry:Op@6713,registry:Op@6805,registry:Owner@1144,registry:Owner@1241,registry:Owner@1524,registry:P@11491,registry:PagesOff@7767,registry:Pair@509,registry:Pair@6457,registry:Pair@6541,registry:Pair@6639,registry:Pair@780,registry:Pair@981,registry:Path@11722,registry:Paths@11419,registry:PolicyExpiresAt@8002,registry:Prefix@11545,registry:Prev@9275,registry:Pub@3300,registry:RDs@11391,registry:RateLimit@8442,registry:Receipt@889,registry:Regional@11289,registry:Registration@12047,registry:Registration@12446,registry:Registration@1904,registry:Registration@2015,registry:Replica@8202,registry:ReplicaLife@9718,registry:ReplicaLife@9816,registry:Replicas@8141,registry:Retirement@2755,registry:Revision@529,registry:Revision@622,registry:Revision@989,registry:Route@5878,registry:Routes@10262,registry:Routes@10329,registry:Routes@10698,registry:Routes@4602,registry:Routes@5836,registry:Routes@6831,registry:Rows@11833,registry:Seed@10412,registry:SeenAt@4466,registry:Seq@4453,registry:Size@7994,registry:Sqid@5547,registry:Sqid@5610,registry:Sqid@5689,registry:Status@10960,registry:Status@12468,registry:Status@12578,registry:Status@1920,registry:Status@3678,registry:Status@5012,registry:Status@6103,registry:Status@6179,registry:Status@6265,registry:Status@6429,registry:Status@7173,registry:Status@9127,registry:Steering@7710,registry:StringMap@4084,registry:StringMap@4301,registry:StringMap@4364,registry:T@11773,registry:T@1621,registry:T@1715,registry:T@1798,registry:TValue@5983,registry:TValue@6050,registry:TValue@8766,registry:TValue@9456,registry:Tags@3597,registry:Target@8897,registry:Targets@1317,registry:Text@11578,registry:Text@11641,registry:Text@2324,registry:Text@2471,registry:Text@5657,registry:Timer@11861,registry:Timer@1573,registry:Timer@1755,registry:Timers@12084,registry:Timers@12143,registry:Timers@12232,registry:Times@12856,registry:To@7234,registry:To@7295,registry:ToDB@7384,registry:ToOp@6275,registry:ToSock@7392,registry:TokenHash@3515,registry:Tunnel@8629,registry:Unit@7505,registry:UpdateSettings@7914,registry:Ver@10049,registry:Ver@9268,registry:Ver@9973,registry:W@11191,registry:Wake@702,registry:Wake@788,registry:Wildcards@11085,whole:Account@5721,whole:ClaimOwnership@1146,whole:ClaimOwnership@1243,whole:ClaimOwnership@1526,whole:ClaimRow@1319,whole:ClaimRowArchive@1425,whole:ClaimRowArchive@1435,whole:ColdRows@2673,whole:ColdRows@2680,whole:ColdRows@2771,whole:ColdRows@2778,whole:DutyState@316,whole:DutyState@394,whole:DutyState@636,whole:Fleet@2834,whole:Fleet@2895,whole:Fleet@2980,whole:Fleet@2990,whole:Fleet@3079,whole:Fleet@3089,whole:Fleet@3102,whole:Fleet@3136,whole:Fleet@3206,whole:FleetBox@3387,whole:FleetBox@3441,whole:FleetBox@4000,whole:GoodBuild@9338,whole:GoodBuild@9352,whole:HAAdoption@1015,whole:HAAdoption@822,whole:HAWakeImport@704,whole:HAWakeImport@790,whole:HomeLink@4755,whole:HomeLink@4829,whole:HomeLinkApp@5238,whole:HomeLinkApp@5308,whole:HomeLinkApp@5406,whole:LinkChannel@4190,whole:LinkSeen@4549,whole:Pair@511,whole:Pair@6459,whole:Pair@6543,whole:Pair@6627,whole:Pair@6641,whole:Pair@782,whole:Pair@983,whole:RegionalDomain@11293,whole:RegionalDomain@11393,whole:Route@10266,whole:Route@10333,whole:Route@10702,whole:Route@1231,whole:Route@4606,whole:Route@5840,whole:Route@5882,whole:Route@5985,whole:Route@6052,whole:Route@6835,whole:Route@6990,whole:Route@6996,whole:Route@8768,whole:Route@9446,whole:Route@9458,whole:Route@9533,whole:Route@9633,whole:Route@9708,whole:Route@9900,whole:RouteAlias@10765,whole:RouteAlias@10841,whole:RoutePath@11423,whole:RoutePath@11493,whole:Timer@11775,whole:Timer@11835,whole:Timer@11865,whole:Timer@12088,whole:Timer@12147,whole:Timer@12236,whole:Timer@1509,whole:Timer@1577,whole:Timer@1623,whole:Timer@1717,whole:Timer@1759,whole:Timer@1800,whole:WildcardDomain@11089,whole:WildcardDomain@11193,whole:haJournalRequest@223,whole:haJournalResponse@187 b980809009dd01a889894a597029b1f29441100f50a2aebdd735468335da5ee0
internal/edge/edge.go Edge.Reload legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-design-edge-rate-limit-358;basis=each route's upstream entry gains rate: e.parseRateSettings(t), the row's rate_limit column parsed once per reload; the one added site is that whole:Route pass of t (parseRateSettings is a new unit, classified in the decisions overlay); no other read added;rev3=census-ruling-certwarm-wake;basis=the single reload hook call becomes runReloadHooks(), which runs every registered hook in order (#386); no read added, same 57 sites (56 before #358 landed on main);rev3=census-ruling-edge-asset-cache-3;basis=each tenant reverse proxy built in the switch (the tunnel, fleet, socket and TCP arms, every *httputil.ReverseProxy) is installed behind assetScrubbedProxy, which hands the proxy an assetInformationalScrub writer so an app's 1xx (103) loses the asset cache's reserved headers (X-Carlos-Asset-Fill, -Fill-Ack, -Expires, Carlos-Cache) on every local path, as the backhaul already does (final review F6); a type check of the proxy it just built and a wrapper around it; static and status handlers untouched; read sites unchanged (57), offsets moved; no read added;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: after the path fold, a resolved platform alias takes its source's own upstream entry (same proxy, route, hibernating: the existing activator wake, lease and fence), keeping its own prefix map (none for a minted apex) and never inheriting the source's (Astra r2 P1); a refused alias, or one whose source has no entry, is dropped from the map (not served, not Allowed); the attached-hostname fold clears platformAlias;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test (generation proxy, hib, no-activator 404) is Route.ActivatorOwned instead of Kind and Hibernate inline, so a resident rootfs instance goes through the activator; binary rows unchanged;rev3=census-ruling-edge-roll-blip;basis=the tcpProxy and multiProxy calls pass e.hold (the per-Edge localHold set once in newEdge): a loopback TCP upstream that refuses is redialled for up to 13 s and a probed route with a local upstream waits for prober readmission instead of answering 502/503 (#434 part B); edge-side dial policy only, no read added, same 52 sites;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: after the alias fold, reads the regional_domains rows (e.reg.ListRegional; an error aborts the reload as every registry read here does) and applies them with foldRegional against the routes slice the same reload read; the added reads are that one registry list and the routes already read;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 4 and 6: the forward case (fleetProxy toward the binding's FleetBox, throttled refusal); one refusal check before the switch from FleetArmVerdict (sidecar not judged; a non-ready forward row refused; a forward row always judged by FleetServeEligible, any other row only where tunnels are on; an alias of a refused source refused with it); the accountless note; path rows of a forward host not folded; no alias folded onto a refused row; refusedHosts held through every fold. ListFleets and FleetChannelAuth read before the loop (+registry:FleetBox, +registry:Host x7, +whole:Route x3). Serving only; the hub's agent, not root. Review R1 finding 2: the switch reads verdict.Served (FleetArmVerdict) by host; the forward case and the fleet-placed case take their fleet from it (served.Fleet) instead of FleetPlacement(t.Region), and an admitted forward row not Served continues rather than falling through (+registry:Host, -registry:Region); the same rows take the same arms; no read added. Review R2: the switch is on DispatchArm(t, viaFleet, tunnels) (the order moved there unchanged: forward only when in Arm, own Tunnel, fleet, socket, addrs, static, status, else continue), the fleet cases read verdict.Arm (renamed from Served), and the platform-alias fold is foldPlatformAliases with the same take (source entry, own paths, alias marks) and the same refusal log (-registry:Kind x2, -registry:Socket, -registry:Tunnel, +whole:Route: those reads moved into DispatchArm); same rows, same arms, same entries; no read added.;rev3=census-ruling-fleet-routes-followups;basis=the owners map is now e.reg.FleetOwners() instead of ListFleets folded inline: the same fresh-connection ListFleets read and the same name->account map (-registry:Account, -registry:Name, -whole:Fleet x2 move into Registry.FleetOwners); no read added; same error path (abort the reload);rev3=census-ruling-tunnel-websockets;basis=The ArmTunnel arm now records its tenancy (Account, App, Tunnel) copied from the row t that Reload already lists; no new registry query, no file read. Also the reload mutex taken first and held to return, five nil-in-production test hooks, and the sweepUpgrades call after the swap, which reads only the map Reload has just built (spec 7, Tasks 3 and 4).;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 5, rule 3): the two fleet proxy builds pass the row to fleetBoxOf(t) instead of reading t.FleetBox (-registry:FleetBox x2, +whole:Route x2); fleetBoxOf answers FleetLabel as authoritative when set, else FleetBox; an authoritative box has no fallback to another of the fleet's channels (503 errFleetDark instead). The edge in the agent, not root; it routes to fewer channels, never more.;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): after the new upstream map is published, closes the held streams of any host the new map no longer holds (absent, not hibernating, route no longer Hibernate). Reads the freshly built in-memory map m and the in-memory held set; no read added beyond the rebuild Reload already does.;rev3=census-ruling-devbox-identity;basis=#486 A: only the devbox edge created by newDevboxEdge (carlos-devbox service user, not root) enables the new proxy hooks. Saves the existing DispatchArm result and reads t.Socket from an already-listed route when that arm is ArmSocket, passing it to configureDevboxProxy for per-request expected-owner validation and visitor-header rewriting. Adds one registry:Socket field site; no new registry query or file open, and ordinary fleet/agent edges leave the hook disabled. Final fix wave: its devbox-only outgoing-header/trailer hooks now also strip case-insensitive underscore/hyphen aliases through stripVisitorHeaders; no new read.;rev3=census-ruling-agent-start-demo-1;basis=Checks demo route eligibility and filters the final folded map using the existing registry listing; no new registry or store query. Merge resolution against origin/main 9bd45488 retains main's devbox proxy hooks (reading the existing route Socket) alongside demo filtering; no additional registry query.;rev3=census-ruling-stateless-replicas-3;basis=Task 3: dispatch admitted stateless set rows through replicaProxy before legacy fleetBoxOf. Read Host and supplied whole Route values from the existing listing to build and filter the set probe inputs after all registry reads and alias folds; synchronize before map publication. Tenancy comes only from FleetArmVerdict. No new external read; no set row reaches legacy fallback, local addresses, provision.Health or hibernation on the hub. Fix round 1 M2: comment and whitespace correction only; read sites and routing behavior unchanged.;rev3=census-ruling-agent-start-demo-2;basis=edge.go:1175-1177 passes an already-listed demo Route to demoProxy; :1358 passes existing Route and RouteAlias slices to demoRefusalNames; :1401 publishes refusal names before upstreams. Adds whole-value uses only, no new registry query; retained names refuse fallback after filtering.;rev3=census-ruling-demo-api-site-route;basis=Build a dedicated demo API proxy from the selected existing socket, TCP or probed console transport in the same atomic route snapshot, before ordinary wrappers. Reads existing route Host twice, Version and two whole Route values for exact operator-configured console eligibility. No additional registry query or external read.;rev3=census-ruling-agent-start-demo-3;basis=Refresh the verified moved snapshot from registry on reload before route-independent serving. Census read-site delta: unchanged (87).;rev3=census-ruling-region-ha-g2-fixes;basis=Derive blocked ingress names from already listed unready/held/import-gated/sidecar and fleet-refused rows; added field reads only.;rev3=census-ruling-edge-page-cache-1;basis=keeps every row this reload already read from the registry (e.pageRoutes, e.pageRoutesRead = routes, true, under reloadMu) for the page reload hook; the +whole:Route sites are that assignment of the same slice; no new read;rev3=census-ruling-held-move-speed;basis=the six tenant reverse proxies' ModifyResponse is now classifyMoveStreams(e.responseModifier(t)): MarkMoveStream first reads the response head (status 101, or Content-Type text/event-stream) and sets a flag on the request's in-memory StreamEnd, then responseModifier runs unchanged (byte-identical to main). The hook never wraps or touches the body, so the trailer scrubs keep the proxy as their one closer (Astra r2 F2.1: the graceful boundary end and its watcher were cut). No read added;rev3=census-ruling-linked-deployments-slice1;basis=linked deployments slice 1 Task 3: with tunnels on, the pass also reads LinkChannelAuth and LinkOwners from the box's own registry (fresh connection, as FleetChannelAuth and FleetOwners) and merges each well-formed link channel's hash into the set SetDynamicAuth takes; the verdict judges link-placed forward rows by the link owners; an admitted one takes the new ArmLink case (linkProxy down the link's channel, tenancy with the link); the door's fleet snapshot stays fleet owners only and link owners go to a separate snapshot; +whole:Route is the row handed to the new case's responseModifier; the edge process as carlos, no root decision registry:Account@11643,registry:Alias@26948,registry:Alias@27035,registry:Alias@27615,registry:App@11659,registry:Health@15426,registry:Health@15552,registry:Hibernate@31899,registry:HoldOp@30695,registry:Host@12970,registry:Host@13027,registry:Host@13063,registry:Host@13827,registry:Host@16035,registry:Host@16130,registry:Host@16418,registry:Host@16444,registry:Host@16496,registry:Host@19326,registry:Host@19359,registry:Host@21382,registry:Host@23289,registry:Host@23597,registry:Host@23624,registry:Host@24467,registry:Host@25039,registry:Host@27369,registry:Host@27418,registry:Host@30131,registry:Host@30156,registry:Host@30173,registry:Host@30772,registry:Host@5253,registry:Host@5622,registry:Host@5676,registry:Host@5726,registry:Host@6746,registry:Host@6935,registry:ImportGate@30714,registry:Kind@19718,registry:Kind@19740,registry:Prefix@25014,registry:Socket@13891,registry:Socket@19597,registry:Socket@23605,registry:Status@30671,registry:Status@5547,registry:Target@25026,registry:Tunnel@11482,registry:Tunnel@11674,registry:Version@19449,registry:Version@19699,registry:Version@19801,whole:RegionalDomain@28257,whole:Route@11564,whole:Route@13118,whole:Route@13246,whole:Route@13967,whole:Route@16589,whole:Route@16654,whole:Route@16705,whole:Route@19376,whole:Route@19383,whole:Route@19507,whole:Route@23685,whole:Route@23692,whole:Route@23788,whole:Route@24902,whole:Route@26070,whole:Route@28249,whole:Route@28305,whole:Route@28345,whole:Route@30037,whole:Route@30071,whole:Route@30159,whole:Route@30238,whole:Route@30657,whole:Route@313,whole:Route@31901,whole:Route@31958,whole:Route@31989,whole:Route@4273,whole:Route@4331,whole:Route@5261,whole:Route@6775,whole:Route@7058,whole:Route@7192,whole:Route@7215,whole:Route@7230,whole:Route@8076,whole:Route@8204,whole:Route@9021,whole:RouteAlias@26919,whole:RouteAlias@28313,whole:RoutePath@24445 5befddca06ff514c9cb3fe3aada4e3dd4edae9760ad697e5e835f23a12c0b148
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
@@ -91,6 +93,6 @@ internal/registry/registry.go Registry.Fingerprint legacy accepted-legacy accept
@coverage internal/host 0a8907da434ef77fbc1abed6aff4bef5cd86810ab5013ef33230dd7810dcfcb5
@coverage internal/provision 6c3f9188cfe17a2f7f87d78cf5f60e9104f5bcd55941947129a5bcea3e4c586c
@coverage internal/regionlabel 8d831085b7e3ce7bb1ea1f20f443b4529c5b7177de18e7c4889e4ca330aa6a00
-@coverage internal/registry 45de204c9b1f90eb12fd726ca598b5ecf125b3bb3eee3b5732f8a4a1816ca374
+@coverage internal/registry d160203302b7508294b6568f2a452e32c64921b5b1a1196ec358ee1128e335ba
@coverage internal/tunnelclient a3661e839ab9e18977dfad0ebe846a38f7c8e327c6c85047d1e3cef42d80aff6
-@fields ?,A,Account,Accounts,AcquiredGeneration,AddedAt,Addr,Addrs,Adoption,Alias,Aliases,Alive,AllowAbsent,App,AppsDomain,Archives,Args,AssetGen,AssetsOff,Assigned,Assignment,At,Attempts,B,Backing,Basis,Binding,Blocked,Body,BoxLabel,Bucket,BuildState,By,Callback,CallbackError,CallbackFailed,Canary,Caps,CertExpiresAt,Changed,Channel,CheckedAt,Claim,ClaimIncarnation,ClaimOwner,ClaimOwnership,ClaimRowID,ClaimStamp,Class,Code,Column,ConnGen,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,HomeAccount,HomeApp,HomeHost,HomeLink,HomeLinkApp,HomeLinkApps,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,ServingURL,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,Token,TokenHash,Tunnel,TunnelURL,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
+@fields ?,A,Account,Accounts,AcquiredGeneration,AddedAt,Addr,Addrs,Adoption,Alias,Aliases,Alive,AllowAbsent,App,AppsDomain,Archives,Args,AssetGen,AssetsOff,Assigned,Assignment,At,Attempts,B,Backing,Basis,Binding,Blocked,Body,BoxLabel,Bucket,BuildState,By,Callback,CallbackError,CallbackFailed,Canary,Caps,CertExpiresAt,Changed,Channel,CheckedAt,Claim,ClaimIncarnation,ClaimOwner,ClaimOwnership,ClaimRowID,ClaimStamp,Class,Code,Column,ConnGen,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,HomeAccount,HomeApp,HomeHost,HomeLink,HomeLinkApp,HomeLinkApps,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,ServingURL,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,Token,TokenHash,Tunnel,TunnelURL,Type,Unit,UnlinkPending,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/registry/homelink.go b/internal/registry/homelink.go
index f0cbb966f..90a8577ac 100644
--- a/internal/registry/homelink.go
+++ b/internal/registry/homelink.go
@@ -9,6 +9,7 @@ import (
"io/fs"
"math"
"os"
+ "strings"
"time"
)
@@ -22,20 +23,26 @@ import (
// plaintext: the home dials with it. It lives only in the registry file,
// which no app can see (instances run with an explicit mount layout that
// excludes /data) and which a fresh bootstrap creates 0640 inside a 0750
-// /data. PutHomeLink refuses to write it into a registry file other users
-// can read (CheckCredentialFile). No console API returns the column and
+// /data. The registry runs in WAL mode, so the token is also written to
+// registry.db-wal (and its pages may sit in -shm); PutHomeLink refuses to
+// write it while the file or any journal beside it can be read by other
+// users (CheckCredentialFile). No console API returns the column and
// nothing logs it; Fingerprint hashes only its sha256.
// HomeLink is the link this deployment holds to a serving console: at most
// one row in slice 1. State ("connected", "reconnecting" or "") is the
// claiming agent's report, written by SetHomeLinkState and not hashed by
-// Fingerprint. ConnGen counts the changes that must replace the link's
+// Fingerprint. UnlinkPending records that the serving console answered an
+// unlink with 202 (revoked there, its connection not cut yet), so the home
+// keeps the link and a later remove finishes it; set by the home console,
+// not hashed by Fingerprint. ConnGen counts the changes that must replace the link's
// tunnel connection (DeleteHomeLinkApp, and PutHomeLinkApp retargeting a
// name); it is hashed, so each one reloads the agent.
type HomeLink struct {
ID, ServingURL, TunnelURL, Token, Account, AppsDomain string
BoxLabel, State string
ConnGen uint64
+ UnlinkPending bool
CreatedAt time.Time
}
@@ -56,26 +63,43 @@ const (
// link: a publication needs one. Nothing is written. One of remoteErrors.
var ErrHomeNotLinked = errors.New("registry: this deployment is not linked")
-// ErrCredentialFileReadable is PutHomeLink's answer when the registry file
-// can be read by users other than its owner and group (CheckCredentialFile).
+// ErrCredentialFileReadable is PutHomeLink's answer when the registry file,
+// or a journal beside it, can be read by users other than its owner and
+// group (CheckCredentialFile).
// Nothing is written. One of remoteErrors.
var ErrCredentialFileReadable = errors.New("registry: the registry file is readable by other users, so it cannot hold a link credential")
+// credentialJournals are the files SQLite keeps beside a database that can
+// hold its pages, and so the link credential: the WAL (where every write
+// lands first in WAL mode), its shared-memory index, and the rollback
+// journal.
+var credentialJournals = []string{"-wal", "-shm", "-journal"}
+
// CheckCredentialFile is nil when the registry file at path is a regular
-// file that other users cannot read (no world-read bit), and an error
-// wrapping ErrCredentialFileReadable when they can. A missing file, a
-// symbolic link or any other stat failure is an error too: the credential is
-// written only where its file has been seen.
+// file that other users cannot read (no world-read bit), and so is every
+// journal beside it that exists (credentialJournals). Otherwise it is an
+// error wrapping ErrCredentialFileReadable naming the file. A missing
+// database, a symbolic link (the database or a journal), anything other
+// than a regular file, or any other stat failure is an error too: the
+// credential is written only where every file it can land in has been
+// seen. A journal that does not exist is fine: SQLite creates it with the
+// database's own mode.
func CheckCredentialFile(path string) error {
- fi, err := os.Lstat(path)
- if err != nil {
- return err
- }
- if fi.Mode()&fs.ModeSymlink != 0 || !fi.Mode().IsRegular() {
- return fmt.Errorf("%w: %s is not a regular file", ErrCredentialFileReadable, path)
- }
- if perm := fi.Mode().Perm(); perm&0o004 != 0 {
- return fmt.Errorf("%w: %s has mode %04o", ErrCredentialFileReadable, path, perm)
+ for _, suffix := range append([]string{""}, credentialJournals...) {
+ p := path + suffix
+ fi, err := os.Lstat(p)
+ if err != nil {
+ if suffix != "" && errors.Is(err, fs.ErrNotExist) {
+ continue
+ }
+ return err
+ }
+ if fi.Mode()&fs.ModeSymlink != 0 || !fi.Mode().IsRegular() {
+ return fmt.Errorf("%w: %s is not a regular file", ErrCredentialFileReadable, p)
+ }
+ if perm := fi.Mode().Perm(); perm&0o004 != 0 {
+ return fmt.Errorf("%w: %s has mode %04o", ErrCredentialFileReadable, p, perm)
+ }
}
return nil
}
@@ -99,6 +123,10 @@ CREATE TABLE IF NOT EXISTS home_link (
);`); err != nil {
return err
}
+ // unlink_pending: additive, beside the brief's columns (SetHomeLinkUnlinkPending).
+ if _, err := r.sql.Exec(`ALTER TABLE home_link ADD COLUMN unlink_pending INTEGER NOT NULL DEFAULT 0`); err != nil && !strings.Contains(err.Error(), "duplicate column") {
+ return err
+ }
_, err := r.sql.Exec(`
CREATE TABLE IF NOT EXISTS home_link_apps (
name TEXT PRIMARY KEY,
@@ -111,16 +139,17 @@ CREATE TABLE IF NOT EXISTS home_link_apps (
}
const homeLinkCols = `id, COALESCE(serving_url, ''), COALESCE(tunnel_url, ''), COALESCE(token, ''),
- COALESCE(account, ''), COALESCE(apps_domain, ''), box_label, state, conn_gen, COALESCE(created_at, 0)`
+ COALESCE(account, ''), COALESCE(apps_domain, ''), box_label, state, conn_gen, unlink_pending, COALESCE(created_at, 0)`
func scanHomeLink(scan func(...any) error) (*HomeLink, error) {
var l HomeLink
- var gen, created int64
+ var gen, pending, created int64
if err := scan(&l.ID, &l.ServingURL, &l.TunnelURL, &l.Token, &l.Account, &l.AppsDomain,
- &l.BoxLabel, &l.State, &gen, &created); err != nil {
+ &l.BoxLabel, &l.State, &gen, &pending, &created); err != nil {
return nil, err
}
l.ConnGen = uint64(gen)
+ l.UnlinkPending = pending != 0
if created != 0 {
l.CreatedAt = time.Unix(created, 0)
}
@@ -245,6 +274,25 @@ func (r *Registry) SetHomeLinkState(state string) error {
return err
}
+// SetHomeLinkUnlinkPending records whether link id's serving-side unlink is
+// pending (the serving console answered 202). Another ID, or no link,
+// changes nothing. Not hashed by Fingerprint.
+func (r *Registry) SetHomeLinkUnlinkPending(id string, pending bool) error {
+ if !ValidLinkID(id) {
+ return fmt.Errorf("registry: invalid link id %q", id)
+ }
+ if r.remote != nil {
+ _, err := r.remote.call(nil, remoteRequest{Method: "SetHomeLinkUnlinkPending", LinkID: id, On: pending}, nil)
+ return err
+ }
+ v := 0
+ if pending {
+ v = 1
+ }
+ _, err := r.sql.Exec(`UPDATE home_link SET unlink_pending = ? WHERE id = ?`, v, id)
+ return err
+}
+
// HomeLinkConnGen returns the link's conn_gen, 0 when there is no link.
// Fresh connection.
func (r *Registry) HomeLinkConnGen() (uint64, error) {
@@ -394,8 +442,9 @@ func bumpHomeLinkConnGen(tx txer) error {
// its own section marker written only when a row exists, so a registry that
// holds no link digests as it did before the tables existed. home_link
// hashes everything the agent's link loop acts on, conn_gen and the token's
-// sha256 included (never the token itself); state and created_at are not
-// hashed: the agent writes state on every connect and disconnect.
+// sha256 included (never the token itself); state, unlink_pending and
+// created_at are not hashed: the agent writes state on every connect and
+// disconnect, and unlink_pending is the home console's own bookkeeping.
func fingerprintHomeLink(db *sql.DB, h hash.Hash) error {
rows, err := db.Query(`SELECT ` + homeLinkCols + ` FROM home_link ORDER BY id`)
if err != nil {
diff --git a/internal/registry/homelink_test.go b/internal/registry/homelink_test.go
index 1502552fa..ba59c33ce 100644
--- a/internal/registry/homelink_test.go
+++ b/internal/registry/homelink_test.go
@@ -2,8 +2,10 @@ package registry
import (
"errors"
+ "io/fs"
"os"
"path/filepath"
+ "strings"
"sync"
"testing"
)
@@ -11,14 +13,24 @@ import (
// Linked deployments, Task 7 (spec §5.1-§5.3, §6.2 home shapes): the home
// side's link and published set.
-// openHomeRegistry is openTestRegistry with the registry file at the mode a
-// fresh bootstrap gives it (0640), so it may hold a link credential.
+// chmodRegistry sets the mode of the registry file at path and of every
+// journal beside it that exists.
+func chmodRegistry(t *testing.T, path string, mode os.FileMode) {
+ t.Helper()
+ for _, sfx := range []string{"", "-wal", "-shm", "-journal"} {
+ if err := os.Chmod(path+sfx, mode); err != nil && !errors.Is(err, fs.ErrNotExist) {
+ t.Fatal(err)
+ }
+ }
+}
+
+// openHomeRegistry is openTestRegistry with the registry file and its
+// journals at the mode a fresh bootstrap gives them (0640), so it may hold
+// a link credential.
func openHomeRegistry(t *testing.T) *Registry {
t.Helper()
reg := openTestRegistry(t)
- if err := os.Chmod(reg.path, 0o640); err != nil {
- t.Fatal(err)
- }
+ chmodRegistry(t, reg.path, 0o640)
return reg
}
@@ -278,25 +290,133 @@ func TestHomeLinkRefusesReadableRegistry(t *testing.T) {
if err := CheckCredentialFile(link); !errors.Is(err, ErrCredentialFileReadable) {
t.Fatalf("CheckCredentialFile(symlink) = %v", err)
}
- if err := os.Chmod(reg.path, 0o640); err != nil {
- t.Fatal(err)
- }
+ chmodRegistry(t, reg.path, 0o640)
if err := reg.PutHomeLink(testHomeLink()); err != nil {
t.Fatalf("PutHomeLink into a 0640 registry = %v", err)
}
}
-func TestHomeLinkCallsOverRemote(t *testing.T) {
- reg, path := remoteTestRegistry(t)
- if err := os.Chmod(path, 0o644); err != nil {
+// TestHomeLinkRefusesReadableJournal: the registry runs in WAL mode, so
+// the token lands in registry.db-wal first. A 0640 database beside a
+// nonempty 0644 WAL (a registry first opened 0644, then only the .db
+// tightened) is refused, and so is a readable -shm or -journal.
+func TestHomeLinkRefusesReadableJournal(t *testing.T) {
+ for _, sfx := range []string{"-wal", "-shm", "-journal"} {
+ t.Run(sfx, func(t *testing.T) {
+ reg := openTestRegistry(t)
+ chmodRegistry(t, reg.path, 0o644)
+ if err := reg.Upsert(Route{Host: "shop.example.com", Kind: "instance", Status: "ready", App: "shop", Addr: "127.0.0.1:9"}); err != nil {
+ t.Fatal(err)
+ }
+ if sfx == "-journal" {
+ if err := os.WriteFile(reg.path+sfx, []byte("x"), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ }
+ fi, err := os.Stat(reg.path + sfx)
+ if err != nil || fi.Size() == 0 {
+ t.Fatalf("%s = %v, %v; want a nonempty file", sfx, fi, err)
+ }
+ chmodRegistry(t, reg.path, 0o640)
+ if err := os.Chmod(reg.path+sfx, 0o644); err != nil {
+ t.Fatal(err)
+ }
+ err = reg.PutHomeLink(testHomeLink())
+ if !errors.Is(err, ErrCredentialFileReadable) || !strings.Contains(err.Error(), "registry.db"+sfx) {
+ t.Fatalf("PutHomeLink beside a 0644 %s = %v; want ErrCredentialFileReadable naming it", sfx, err)
+ }
+ if sfx == "-journal" {
+ // A stray rollback journal beside a WAL database is not one
+ // SQLite wrote (a new connection would wait on it as hot):
+ // gone before the database is read again, once its mode
+ // has been checked below.
+ if err := os.Chmod(reg.path+sfx, 0o640); err != nil {
+ t.Fatal(err)
+ }
+ if err := CheckCredentialFile(reg.path); err != nil {
+ t.Fatalf("CheckCredentialFile with every file 0640 = %v", err)
+ }
+ os.Remove(reg.path + sfx)
+ }
+ if l, _ := reg.HomeLink(); l != nil {
+ t.Fatalf("the refused link was written: %+v", l)
+ }
+ if err := os.Chmod(reg.path+sfx, 0o640); err != nil && !errors.Is(err, fs.ErrNotExist) {
+ t.Fatal(err)
+ }
+ if err := CheckCredentialFile(reg.path); err != nil {
+ t.Fatalf("CheckCredentialFile with every file 0640 = %v", err)
+ }
+ if err := reg.PutHomeLink(testHomeLink()); err != nil {
+ t.Fatalf("PutHomeLink with every file 0640 = %v", err)
+ }
+ })
+ }
+ // A journal that is a symbolic link is refused too.
+ reg := openHomeRegistry(t)
+ target := reg.path + ".elsewhere"
+ if err := os.WriteFile(target, nil, 0o600); err != nil {
t.Fatal(err)
}
- if err := reg.PutHomeLink(testHomeLink()); !errors.Is(err, ErrCredentialFileReadable) {
- t.Fatalf("remote PutHomeLink into a 0644 registry = %v; want ErrCredentialFileReadable", err)
+ if err := os.Symlink(target, reg.path+"-journal"); err != nil {
+ t.Fatal(err)
+ }
+ if err := CheckCredentialFile(reg.path); !errors.Is(err, ErrCredentialFileReadable) {
+ t.Fatalf("CheckCredentialFile with a symlinked journal = %v", err)
+ }
+}
+
+// TestHomeLinkUnlinkPending: the flag round-trips, survives a rotation,
+// names its link, and does not move the fingerprint.
+func TestHomeLinkUnlinkPending(t *testing.T) {
+ reg := openHomeRegistry(t)
+ mustPutHomeLink(t, reg, testHomeLink())
+ before, err := reg.Fingerprint()
+ if err != nil {
+ t.Fatal(err)
}
- if err := os.Chmod(path, 0o640); err != nil {
+ if err := reg.SetHomeLinkUnlinkPending(testLinkB, true); err != nil {
t.Fatal(err)
}
+ if l, _ := reg.HomeLink(); l.UnlinkPending {
+ t.Fatal("another link's ID set the flag")
+ }
+ if err := reg.SetHomeLinkUnlinkPending(testLinkA, true); err != nil {
+ t.Fatal(err)
+ }
+ if l, _ := reg.HomeLink(); !l.UnlinkPending {
+ t.Fatal("the flag was not recorded")
+ }
+ if after, _ := reg.Fingerprint(); after != before {
+ t.Fatal("the pending flag moved the fingerprint")
+ }
+ // Reopened, as a restarted console would.
+ again, err := Open(reg.path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer again.Close()
+ if l, _ := again.HomeLink(); l == nil || !l.UnlinkPending {
+ t.Fatalf("after reopen HomeLink = %+v", l)
+ }
+ if err := reg.SetHomeLinkUnlinkPending(testLinkA, false); err != nil {
+ t.Fatal(err)
+ }
+ if l, _ := reg.HomeLink(); l.UnlinkPending {
+ t.Fatal("the flag was not cleared")
+ }
+ if err := reg.SetHomeLinkUnlinkPending("nope", true); err == nil {
+ t.Fatal("a malformed ID was taken")
+ }
+}
+
+func TestHomeLinkCallsOverRemote(t *testing.T) {
+ reg, path := remoteTestRegistry(t)
+ chmodRegistry(t, path, 0o644)
+ if err := reg.PutHomeLink(testHomeLink()); !errors.Is(err, ErrCredentialFileReadable) {
+ t.Fatalf("remote PutHomeLink into a 0644 registry = %v; want ErrCredentialFileReadable", err)
+ }
+ chmodRegistry(t, path, 0o640)
if err := reg.PutHomeLinkApp(HomeLinkApp{Name: "shop", HomeAccount: "acct1", HomeApp: "shop", HomeHost: "h"}); !errors.Is(err, ErrHomeNotLinked) {
t.Fatalf("remote PutHomeLinkApp with no link = %v; want ErrHomeNotLinked", err)
}
@@ -310,6 +430,12 @@ func TestHomeLinkCallsOverRemote(t *testing.T) {
if err := reg.SetHomeLinkState(HomeLinkConnected); err != nil {
t.Fatal(err)
}
+ if err := reg.SetHomeLinkUnlinkPending(testLinkA, true); err != nil {
+ t.Fatal(err)
+ }
+ if l, _ := reg.HomeLink(); !l.UnlinkPending {
+ t.Fatal("remote SetHomeLinkUnlinkPending did not record the flag")
+ }
shop := HomeLinkApp{Name: "shop", HomeAccount: "acct1", HomeApp: "shop", HomeHost: "h"}
if err := reg.PutHomeLinkApp(shop); err != nil {
t.Fatal(err)
diff --git a/internal/registry/remote_dispatch.go b/internal/registry/remote_dispatch.go
index 2280ecca0..5bb4c2e7d 100644
--- a/internal/registry/remote_dispatch.go
+++ b/internal/registry/remote_dispatch.go
@@ -299,6 +299,8 @@ func (r *Registry) dispatchRemote(ctx context.Context, q remoteRequest, callback
out.Changed, err = r.ClaimHomeLink(q.Label)
case "SetHomeLinkState":
err = r.SetHomeLinkState(q.Status)
+ case "SetHomeLinkUnlinkPending":
+ err = r.SetHomeLinkUnlinkPending(q.LinkID, q.On)
case "HomeLinkConnGen":
var gen uint64
gen, err = r.HomeLinkConnGen()