carlos / platform Public

census: console protection tab

Root-read census proposal (census-propose NAME=console-protection-tab):
two edge units gain a whole-route pass (ServeHTTP, serveAssetFar), two
new in-memory units (observeGuardCount, RecordGuard) are written
accepted-legacy, and five envelopes are re-pinned. The record-write
census (9B8) re-pins UpsertEdgeDay and NewServer, no class changed.
Pending the cross-model reviewer's verdict on #280.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 14791cf0e6fdc0582619e7bdad58b9ea7a90460f parent e25aa3f
6 files changed, +108 −1
  • docs/superpowers/notes/census-console-protection-tab-claims.md +8 −0
  • docs/superpowers/notes/census-proposal-console-protection-tab.md +39 −0
  • internal/provision/console_protection_tab_census_test.go +43 −0
  • internal/provision/plan9_b8_census_test.go +1 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-console-protection-tab.tsv +16 −0
diff --git a/docs/superpowers/notes/census-console-protection-tab-claims.md b/docs/superpowers/notes/census-console-protection-tab-claims.md
new file mode 100644
index 000000000..94f77e473
--- /dev/null
+++ b/docs/superpowers/notes/census-console-protection-tab-claims.md
@@ -0,0 +1,8 @@
+# CLAIMS for the root-read census, branch design-console-protection-tab (console Protection tab, Task 8).
+# Format (AGENTS.md "The census"): <file>:<unit><TAB><what changed>. Lines starting with # are ignored.
+# Base: main 65fd8060; branch tip e25aa3f0 when written.
+
+internal/edge/edge.go:Edge.ServeHTTP 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.
+internal/edge/assetcatch.go:Edge.serveAssetFar the far catch's defer now also calls observeGuardCount(rt, out) for the same synthetic registry.Route{Host, Account, App, Kind: instance} it already hands the meter and observeRecords (+whole:Route), under the same "this edge answered it" condition (billed, or a hop never reached the home), whether or not the guard matched; observeRecords still runs only on a match, as before. A count in memory only; no new kind of read; the guard check, block page and backhaul are unchanged.
+internal/edge/guard.go:Edge.observeGuardCount new: loads the usage meter (an atomic pointer the agent set at start) and, when it and the guard state exist, passes the route row it was given (+whole:Route) with the verdict's rule and block flag (nil when nothing matched) to UsageMeter.RecordGuard. Pure in-memory; reads no file, registry or bucket; no root decision.
+internal/edge/usagemeter.go:UsageMeter.RecordGuard new: under the meter's mutex, adds one to the checked count (and to watch or block, and one rule-group tally capped at 32 names with "other" taking the overflow, unless the rule is a burst rule) in an in-memory map keyed by the route's Host, App and release.RouteAccount (+registry:Host, +registry:App, +whole:Route): fields of the route row the edge already resolved. No I/O; the counts reach the bucket only through Drain and UpsertEdgeDay into the box's own usage/edge/<box>/days/<date>.json, the key and conditional put the traffic rows already use.
diff --git a/docs/superpowers/notes/census-proposal-console-protection-tab.md b/docs/superpowers/notes/census-proposal-console-protection-tab.md
new file mode 100644
index 000000000..243a4136c
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-console-protection-tab.md
@@ -0,0 +1,39 @@
+# Census approval: console-protection-tab
+
+Ruling `census-ruling-console-protection-tab`. The independent reviewer approves or rejects every change below, 2 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/edge/assetcatch.go` `Edge.serveAssetFar` | sites | +whole:Route | the far catch's defer now also calls observeGuardCount(rt, out) for the same synthetic registry.Route{Host, Account, App, Kind: instance} it already hands the meter and observeRecords (+whole:Route), under the same "this edge answered it" condition (billed, or a hop never reached the home), whether or not the guard matched; observeRecords still runs only on a match, as before. A count in memory only; no new kind of read; the guard check, block page and backhaul are unchanged. |
+| `internal/edge/edge.go` `Edge.ServeHTTP` | sites | +whole:Route | 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. |
+
+Envelopes re-pinned: `internal/applog`, `internal/edge`, `internal/edgeguard`, `internal/host`, `internal/usage`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `internal/edge/assetcatch.go` `Edge.serveAssetFar`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-edge-asset-cache-3;basis=in the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): new (asset cache plan 3 Task 6): the far catch on a box with no route row for the host. It answers from this box's asset store, or fills over the backhaul from the home box under a signed fill assertion (carlos-asset-fill-v1) and stores only an acknowledged response. Its three sites are one synthetic row, registry.Route{Host, Account, App, Kind: instance}, built from the request host and the owner the home box's edges file publishes, passed to the usage meter and to the account throttle (planThrottleAdmit), so a far delivery is metered and throttled under the published owner (drift D8). No registry row is read; nothing local is dialled; no root decision. Since then: runs the hard and probe checks before the store is read, as ServeHTTP runs them (final review F1): edgeguard.Check, a pure in-memory matcher on r.URL.Path and RawQuery, through guardDecide, unless protection is off or the request came over a tunnel; a block is answered with the block page and metered under the synthetic row; a matched request is recorded through observeRecords(rt, false, r, ...) whenever this edge wrote the answer itself: a hit, the block page, a throttle refusal, or any answer written before a hop reached the home (a backhaul refusal, the no-key 503, a failed dial's 502; arrival is seen by an httptrace WroteHeaders hook on the request's context, a callback that reads nothing); a request a hop delivered to the home is judged and recorded there under the home's own mode, as for any backhauled request (fix waves 4 and 5: ordinary-backhaul parity); refusals and forwards write through the counting writer so the record carries the client's status; the one added site is that observeRecords pass of the same synthetic registry.Route{Host, Account, App, Kind: instance} (+whole:Route); no new kind of read;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: one call to observeRegional("asset-fill", host), a test hook that is a nil atomic pointer in production; no read added, no behaviour changed
+- `internal/edge/edge.go` `Edge.ServeHTTP`: legacy, task accepted-legacy. Basis: 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.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/edge/guard.go:Edge.observeGuardCount`: reads +whole:Route; written legacy, accepted-legacy, frozen
+- new `internal/edge/usagemeter.go:UsageMeter.RecordGuard`: reads +registry:App, +registry:Host, +whole:Route; written legacy, accepted-legacy, frozen
+
+Seal: `bca6ef741a96b72767b1747789cd01b3111d61b68548cbe368258c31f3d53a2e` → `ce015664cb83070928f4cc01ee70c74c318788a12b8a0a3fbc09904b6e9edb90`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-console-protection-tab.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
+
+## Record-write census (TestPlan9B8RecordWriteCensus)
+
+The inventory is re-pinned by `internal/provision/console_protection_tab_census_test.go`
+(`consoleProtectionTabWriteCensusInventory`, which the test now uses), layered on
+`fleetPublicRoutesWriteCensusInventory`. Two re-pins, no new unit, no class or kinds changed:
+
+| Unit | Kinds | Class | What changed |
+|---|---|---|---|
+| `internal/usage/edge.go:UpsertEdgeDay` | `sel:Put` | `nonrecord` | Takes a `usage.EdgeFlush` (the traffic rows by host, as before, and the protection counts by host and owner) and folds both into the box's own `usage/edge/<box>/days/<date>.json` through `AddFlush`. Same key, same read (etag), same conditional put and three-attempt retry; a flush with no rows and no counts writes nothing. Not a record. Digest `5664888d…efb5b`. |
+| `internal/console/server.go:NewServer` | `lit:instances` | `key-site` | Registers the Protection tab and its JSON door (`GET /a/{sqid}/apps/{app}/protection`, `.../protection/data`) and the operator page (`GET /fleet/protection`, `/fleet/protection/data`). Those handlers read edge days and app logs and render; they write nothing. Same `instances` literal. Digest `061a6467…2356e`. |
+
+Claims for the root-read units: `docs/superpowers/notes/census-console-protection-tab-claims.md`.
diff --git a/internal/provision/console_protection_tab_census_test.go b/internal/provision/console_protection_tab_census_test.go
new file mode 100644
index 000000000..acfe49a33
--- /dev/null
+++ b/internal/provision/console_protection_tab_census_test.go
@@ -0,0 +1,43 @@
+package provision
+
+// Record-write census entries for the console Protection tab (branch
+// design-console-protection-tab; spec
+// docs/superpowers/specs/2026-10-30-console-protection-tab-design.md),
+// layered on fleetPublicRoutesWriteCensusInventory (main's newest at
+// 65fd8060). Reviewed by the branch author against the source; the census
+// approval is recorded on #280 with the root-read card. No record write is
+// added, moved or reclassified:
+// - internal/usage/edge.go UpsertEdgeDay (nonrecord): it takes a
+// usage.EdgeFlush (the traffic rows by host, as before, and the
+// protection counts by host and owner) and folds both into the box's
+// own usage/edge/<box>/days/<date>.json through AddFlush. Same key, same
+// read (etag), same conditional put and three-attempt retry; a flush
+// with no rows and no counts still writes nothing. Not a record.
+// - internal/console/server.go NewServer (key-site): registers the
+// Protection tab and its JSON door (GET /a/{sqid}/apps/{app}/protection
+// and .../protection/data) and the operator page (GET /fleet/protection
+// and /fleet/protection/data). Those handlers read edge days and app
+// logs and render; they write nothing. Same "instances" literal: still
+// key-site.
+func consoleProtectionTabWriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), fleetPublicRoutesWriteCensusInventory()...)
+ repins := []censusEntry{
+ {"internal/usage/edge.go", "UpsertEdgeDay", "nonrecord", "sel:Put", "5664888dfdf78bc578926d7972c775f6e75cec3d23149398c41bfbca44befb5b"},
+ {"internal/console/server.go", "NewServer", "key-site", "lit:instances", "061a6467bbdee76458ac44de61acd63e36a9ed97b3a786df9fd9612dc992356e"},
+ }
+ for _, r := range repins {
+ found := false
+ for i, e := range entries {
+ if e.File == r.File && e.Unit == r.Unit {
+ if e.Class != r.Class || e.Kinds != r.Kinds {
+ panic("console-protection-tab re-pin changes the class or kinds of " + r.File + ":" + r.Unit)
+ }
+ entries[i], found = r, true
+ }
+ }
+ if !found {
+ panic("console-protection-tab re-pin of an unlisted unit " + r.File + ":" + r.Unit)
+ }
+ }
+ return entries
+}
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go
index 893794f4d..ad61affab 100644
--- a/internal/provision/plan9_b8_census_test.go
+++ b/internal/provision/plan9_b8_census_test.go
@@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) {
if len(got) < 100 {
t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root)
}
- inventory := fleetPublicRoutesWriteCensusInventory()
+ inventory := consoleProtectionTabWriteCensusInventory()
problems := append(censusDiff(inventory, got), censusPolicy(inventory)...)
if len(problems) > 0 {
t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n "))
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 4005745f0..c9add330b 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -42,3 +42,4 @@ plan14-root-reads-analytics-agents.tsv 5b559ba7a42084908cb0fec08083bb2b9b3c9d960
plan14-root-reads-region-ha-dead-holder-backoff.tsv 8f6a1865b0abcea9d4fb68232cc2a25263a106ec87f73bd4b3f2fb388971ebe5
plan14-root-reads-managed-fleets-1c-451.tsv af326671321edda76c7e6217a47892605a9e3b886fa880ad6d049c2f28f63873
plan14-root-reads-fleet-public-routes.tsv bca6ef741a96b72767b1747789cd01b3111d61b68548cbe368258c31f3d53a2e
+plan14-root-reads-console-protection-tab.tsv ce015664cb83070928f4cc01ee70c74c318788a12b8a0a3fbc09904b6e9edb90
diff --git a/internal/provision/testdata/plan14-root-reads-console-protection-tab.tsv b/internal/provision/testdata/plan14-root-reads-console-protection-tab.tsv
new file mode 100644
index 000000000..5b2aa93cd
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-console-protection-tab.tsv
@@ -0,0 +1,16 @@
+# Census overlay console-protection-tab, written by census-propose (#369). census-ruling-console-protection-tab, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-console-protection-tab.md.
+# 0 body, 2 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 2 new dispositions: 0 reads re-frozen at their disposition with the claim, 2 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 9c24a6cc3fb75dc95527d7c6c947e7e87c3bcae81622aa4d0f050cb1a0d611ea internal/edge/guard.go Edge.observeGuardCount legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-protection-tab;basis=new: loads the usage meter (an atomic pointer the agent set at start) and, when it and the guard state exist, passes the route row it was given (+whole:Route) with the verdict's rule and block flag (nil when nothing matched) to UsageMeter.RecordGuard. Pure in-memory; reads no file, registry or bucket; no root decision. whole:Route@290 dfe66a93b43b08e297b6eeab7efa37d9e4e6a2679ce706cb5eab122178dbde8c
+@legacy 8e7467ba31c9e0b26fa7d4d7d9e3be03682496f5538afb7d955a7833b544af7b internal/edge/usagemeter.go UsageMeter.RecordGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-protection-tab;basis=new: under the meter's mutex, adds one to the checked count (and to watch or block, and one rule-group tally capped at 32 names with "other" taking the overflow, unless the rule is a burst rule) in an in-memory map keyed by the route's Host, App and release.RouteAccount (+registry:Host, +registry:App, +whole:Route): fields of the route row the edge already resolved. No I/O; the counts reach the bucket only through Drain and UpsertEdgeDay into the box's own usage/edge/<box>/days/<date>.json, the key and conditional put the traffic rows already use. registry:App@162,registry:Host@113,whole:Route@152 693791df34de638e42a3b370d82b036a092789202b5221dd36cda9bf29153ae9
+@legacy 89d36d2bd3a9fc4d5eacaa8f3c9343507e86592141fdad41563a0e1b85737bd5 internal/edge/assetcatch.go Edge.serveAssetFar legacy accepted-legacy accepted-legacy;rev3=census-ruling-edge-asset-cache-3;basis=in the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): new (asset cache plan 3 Task 6): the far catch on a box with no route row for the host. It answers from this box's asset store, or fills over the backhaul from the home box under a signed fill assertion (carlos-asset-fill-v1) and stores only an acknowledged response. Its three sites are one synthetic row, registry.Route{Host, Account, App, Kind: instance}, built from the request host and the owner the home box's edges file publishes, passed to the usage meter and to the account throttle (planThrottleAdmit), so a far delivery is metered and throttled under the published owner (drift D8). No registry row is read; nothing local is dialled; no root decision. Since then: runs the hard and probe checks before the store is read, as ServeHTTP runs them (final review F1): edgeguard.Check, a pure in-memory matcher on r.URL.Path and RawQuery, through guardDecide, unless protection is off or the request came over a tunnel; a block is answered with the block page and metered under the synthetic row; a matched request is recorded through observeRecords(rt, false, r, ...) whenever this edge wrote the answer itself: a hit, the block page, a throttle refusal, or any answer written before a hop reached the home (a backhaul refusal, the no-key 503, a failed dial's 502; arrival is seen by an httptrace WroteHeaders hook on the request's context, a callback that reads nothing); a request a hop delivered to the home is judged and recorded there under the home's own mode, as for any backhauled request (fix waves 4 and 5: ordinary-backhaul parity); refusals and forwards write through the counting writer so the record carries the client's status; the one added site is that observeRecords pass of the same synthetic registry.Route{Host, Account, App, Kind: instance} (+whole:Route); no new kind of read;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: one call to observeRegional("asset-fill", host), a test hook that is a nil atomic pointer in production; no read added, no behaviour changed;rev3=census-ruling-console-protection-tab;basis=the far catch's defer now also calls observeGuardCount(rt, out) for the same synthetic registry.Route{Host, Account, App, Kind: instance} it already hands the meter and observeRecords (+whole:Route), under the same "this edge answered it" condition (billed, or a hop never reached the home), whether or not the guard matched; observeRecords still runs only on a match, as before. A count in memory only; no new kind of read; the guard check, block page and backhaul are unchanged. whole:Route@1063,whole:Route@1828,whole:Route@1879,whole:Route@3128,whole:Route@3135 fbe6cf0b5e0a1539e781b50dbc4ec6d80072928e4996bc3add1bef860748bf3b
+@legacy 177c411a4b102585c1437fda140964c9a832b00cab51373b91ed3ca10c358427 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-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. registry:Gate@19705,registry:Gate@19765,registry:Gate@19823,registry:Host@19808,registry:ImportGate@25537,registry:Kind@15087,registry:Kind@17838,registry:Kind@25479,registry:Kind@25508,whole:Route@11116,whole:Route@12895,whole:Route@13107,whole:Route@13299,whole:Route@15090,whole:Route@16393,whole:Route@16488,whole:Route@16564,whole:Route@16608,whole:Route@16910,whole:Route@17841,whole:Route@19708,whole:Route@19768,whole:Route@19811,whole:Route@19826,whole:Route@21459,whole:Route@25482,whole:Route@25511,whole:Route@25540,whole:Route@25572,whole:Route@27399 77d1dfb988a7b2685f0034f44fc828e6ac0355fb44e5d99a4bf54081e88bb6b8
+internal/edge/guard.go Edge.observeGuardCount legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-protection-tab;basis=new: loads the usage meter (an atomic pointer the agent set at start) and, when it and the guard state exist, passes the route row it was given (+whole:Route) with the verdict's rule and block flag (nil when nothing matched) to UsageMeter.RecordGuard. Pure in-memory; reads no file, registry or bucket; no root decision. whole:Route@290 dfe66a93b43b08e297b6eeab7efa37d9e4e6a2679ce706cb5eab122178dbde8c
+internal/edge/usagemeter.go UsageMeter.RecordGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-protection-tab;basis=new: under the meter's mutex, adds one to the checked count (and to watch or block, and one rule-group tally capped at 32 names with "other" taking the overflow, unless the rule is a burst rule) in an in-memory map keyed by the route's Host, App and release.RouteAccount (+registry:Host, +registry:App, +whole:Route): fields of the route row the edge already resolved. No I/O; the counts reach the bucket only through Drain and UpsertEdgeDay into the box's own usage/edge/<box>/days/<date>.json, the key and conditional put the traffic rows already use. registry:App@162,registry:Host@113,whole:Route@152 693791df34de638e42a3b370d82b036a092789202b5221dd36cda9bf29153ae9
+internal/edge/assetcatch.go Edge.serveAssetFar legacy accepted-legacy accepted-legacy;rev3=census-ruling-edge-asset-cache-3;basis=in the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): new (asset cache plan 3 Task 6): the far catch on a box with no route row for the host. It answers from this box's asset store, or fills over the backhaul from the home box under a signed fill assertion (carlos-asset-fill-v1) and stores only an acknowledged response. Its three sites are one synthetic row, registry.Route{Host, Account, App, Kind: instance}, built from the request host and the owner the home box's edges file publishes, passed to the usage meter and to the account throttle (planThrottleAdmit), so a far delivery is metered and throttled under the published owner (drift D8). No registry row is read; nothing local is dialled; no root decision. Since then: runs the hard and probe checks before the store is read, as ServeHTTP runs them (final review F1): edgeguard.Check, a pure in-memory matcher on r.URL.Path and RawQuery, through guardDecide, unless protection is off or the request came over a tunnel; a block is answered with the block page and metered under the synthetic row; a matched request is recorded through observeRecords(rt, false, r, ...) whenever this edge wrote the answer itself: a hit, the block page, a throttle refusal, or any answer written before a hop reached the home (a backhaul refusal, the no-key 503, a failed dial's 502; arrival is seen by an httptrace WroteHeaders hook on the request's context, a callback that reads nothing); a request a hop delivered to the home is judged and recorded there under the home's own mode, as for any backhauled request (fix waves 4 and 5: ordinary-backhaul parity); refusals and forwards write through the counting writer so the record carries the client's status; the one added site is that observeRecords pass of the same synthetic registry.Route{Host, Account, App, Kind: instance} (+whole:Route); no new kind of read;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: one call to observeRegional("asset-fill", host), a test hook that is a nil atomic pointer in production; no read added, no behaviour changed;rev3=census-ruling-console-protection-tab;basis=the far catch's defer now also calls observeGuardCount(rt, out) for the same synthetic registry.Route{Host, Account, App, Kind: instance} it already hands the meter and observeRecords (+whole:Route), under the same "this edge answered it" condition (billed, or a hop never reached the home), whether or not the guard matched; observeRecords still runs only on a match, as before. A count in memory only; no new kind of read; the guard check, block page and backhaul are unchanged. whole:Route@1063,whole:Route@1828,whole:Route@1879,whole:Route@3128,whole:Route@3135 fbe6cf0b5e0a1539e781b50dbc4ec6d80072928e4996bc3add1bef860748bf3b
+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-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. registry:Gate@19705,registry:Gate@19765,registry:Gate@19823,registry:Host@19808,registry:ImportGate@25537,registry:Kind@15087,registry:Kind@17838,registry:Kind@25479,registry:Kind@25508,whole:Route@11116,whole:Route@12895,whole:Route@13107,whole:Route@13299,whole:Route@15090,whole:Route@16393,whole:Route@16488,whole:Route@16564,whole:Route@16608,whole:Route@16910,whole:Route@17841,whole:Route@19708,whole:Route@19768,whole:Route@19811,whole:Route@19826,whole:Route@21459,whole:Route@25482,whole:Route@25511,whole:Route@25540,whole:Route@25572,whole:Route@27399 77d1dfb988a7b2685f0034f44fc828e6ac0355fb44e5d99a4bf54081e88bb6b8
+@coverage internal/applog 20bbd9da7e0ca3894bfebb5935a4e0e54ed99a3e2d09bf438924742a82e3396d
+@coverage internal/edge bad3397d16c7e2080eca81552e464254d35f9326cd648c97ce6cf9fdaa5b7a92
+@coverage internal/edgeguard 15b82bb18aa3b30aff597aabf84a2a75b857356c568b89d0dc6eaab944c232cf
+@coverage internal/host 0e19bcb30beeb0ff4e6ab95f0fad7ee2472b47ac364d034482d940a3c446da2b
+@coverage internal/usage afe4bb4b9e3a29f310d3a6ebd6fdaab8a1ee43787f407b0ec0b40cce54e9cb6c