census: edge protection Plan 2 record-write layer for carlos explain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+38
−1
internal/provision/edge_protection_2_census_test.go+37 −0internal/provision/plan9_b8_census_test.go+1 −1
CI failed — run details
diff --git a/internal/provision/edge_protection_2_census_test.go b/internal/provision/edge_protection_2_census_test.go| new file mode 100644 |
| index 000000000..1035a9d0e |
| --- /dev/null |
| +++ b/internal/provision/edge_protection_2_census_test.go |
| @@ -0,0 +1,37 @@ |
| +package provision |
| + |
| +// Record-write census entries for edge protection Plan 2 (branch |
| +// edge-protection-2: the hard and probe tiers, watch by default; Plan 2 of |
| +// docs/superpowers/specs/2026-10-24-edge-request-protection-design.md), |
| +// layered on edgeRateLimitWriteCensusInventory (the top layer the census |
| +// calls at this branch's base). Reviewed by the branch author; the census |
| +// owner rules on #280 (census-ruling-edge-protection-2, with the root-read |
| +// card docs/superpowers/notes/census-proposal-edge-protection-2.md). |
| +// - main dispatches the new `carlos explain` verb (runExplain), which reads |
| +// what a block page's reference code says; the change is that dispatch |
| +// case and one help line. Its instance and sidecar literals are |
| +// unchanged: key-site. Re-digested on main's body as of |
| +// design-edge-rate-limit-358 (its `carlos ratelimit` dispatch) plus this |
| +// branch's case and help line. |
| +// |
| +// The edge's guard matches requests in memory, and its matches go into the |
| +// box's in-memory applog.Sink beside the other request records. Nothing in |
| +// this plan writes an instance or sidecar record, and no write site is added. |
| +func edgeProtection2WriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), edgeRateLimitWriteCensusInventory()...) |
| + replacements := []censusEntry{ |
| + {"main.go", "main", "key-site", "lit:instances,lit:sidecars", "b87e01b06addfddd75c864bdaaa806bfe9319d39d52dbe5074f7f3076cbb27e5"}, |
| + } |
| + for _, r := range replacements { |
| + found := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + entries = append(entries, r) |
| + } |
| + } |
| + return entries |
| +} |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index 180079532..efde07750 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 := edgeRateLimitWriteCensusInventory() |
| + inventory := edgeProtection2WriteCensusInventory() |
| 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 ")) |