| 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 |