Hard-tier block: census overlay, review fixes
Census overlay for the catalogue change (body change on internal/edgeguard/catalogue.txt, envelopes internal/edge and internal/edgeguard re-pinned); card at docs/superpowers/notes/census-proposal-edge-protect-hard-block.md. Astra review R1 (READY AFTER FIXES) P3s: the guardCatalogue comment now says the hard tier blocks from catalogue v2, and TestStaticHardAtEdgeOnce keeps a watch case so a watched hard match through the static handler is still filed once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+36
−6
docs/superpowers/notes/census-proposal-edge-protect-hard-block.md+19 −0internal/edge/guard.go+4 −3internal/edge/static_guard_test.go+6 −3internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-edge-protect-hard-block.tsv+6 −0
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-edge-protect-hard-block.md b/docs/superpowers/notes/census-proposal-edge-protect-hard-block.md| new file mode 100644 |
| index 000000000..c614e1738 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-edge-protect-hard-block.md |
| @@ -0,0 +1,19 @@ |
| +# Census approval: edge-protect-hard-block |
| + |
| +Ruling `census-ruling-edge-protect-hard-block`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/edgeguard/catalogue.txt` `external` | body | unchanged (1) | the 33 hard-tier rows change mode watch -> block and the version line goes 1 -> 2; data only, still embedded, parsed once at init, never opened at runtime; no new read and no root decision | |
| + |
| +Envelopes re-pinned: `internal/edge`, `internal/edgeguard`. |
| + |
| +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/edgeguard/catalogue.txt` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-edge-protection-2;identity=its two consumers: the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), which matches requests against it, and the console (cmd/console serve under console.service, user carlos-console), which names a reference code's rule through edgeguard.RuleByHash (apiedgeref.go);basis=new: the edge protection catalogue, the hard and probe tier rules, each with what it matches and its mode (watch, block or burst): embedded with go:embed into the binary (edgeguard.catalogueData) and parsed once at init (parseCatalogue, then buildIndex; init panics on a malformed row or a version line that disagrees with edgeguard.Version); never opened from disk at runtime; data, not code; it only says which request paths and query values the edge matches, what the edge does with a match, and which rule a code names; no root decision; the class of the console's embedded templates (internal/console/templates/*.html external) |
| + |
| +Seal: `c61b055182bf84e822fab92199432bd2d462c268c03ead17c3cfa18f09bd82cd` → `3b6cd29b87d2728254936722ab45fdadcfbb8c1f5b74fdfa19d1921b9dfd1dbe`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-edge-protect-hard-block.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/edge/guard.go b/internal/edge/guard.go| index b3089abad..0f5148fe5 100644 |
| --- a/internal/edge/guard.go |
| +++ b/internal/edge/guard.go |
| @@ -21,9 +21,10 @@ import ( |
| type guardMode uint8 |
| const ( |
| - // guardCatalogue, the default, does what each rule's own mode says. Every |
| - // rule in catalogue version 1 watches or counts toward a burst, so by |
| - // default nothing is blocked: a match is recorded with the app's answer. |
| + // guardCatalogue, the default, does what each rule's own mode says. From |
| + // catalogue version 2 the hard tier blocks; the probe tier watches and |
| + // the burst rule counts, so their matches are recorded with the app's |
| + // answer. |
| guardCatalogue guardMode = iota |
| // guardOff runs no check at all. |
| guardOff |
diff --git a/internal/edge/static_guard_test.go b/internal/edge/static_guard_test.go| index c4a99b2b0..02ca8fd7b 100644 |
| --- a/internal/edge/static_guard_test.go |
| +++ b/internal/edge/static_guard_test.go |
| @@ -243,11 +243,14 @@ func TestStaticRewriteKeepsProbeVerdict(t *testing.T) { |
| // before the static handler runs. The handler must not file it a second time. |
| func TestStaticHardAtEdgeOnce(t *testing.T) { |
| files := map[string]string{".env": "SECRET=1", "index.html": "home"} |
| - for _, mode := range []guardMode{guardCatalogue, guardBlock} { |
| + for _, mode := range []guardMode{guardWatch, guardCatalogue, guardBlock} { |
| g := staticGuardEdge(t, mode, files) |
| w := g.get("/.env") |
| - if mode == guardBlock && w.Code != 404 { |
| - t.Fatalf("block: status %d, want 404", w.Code) |
| + if mode != guardWatch && w.Code != 404 { |
| + t.Fatalf("mode %d: status %d, want 404", mode, w.Code) |
| + } |
| + if mode == guardWatch && (w.Code != 200 || w.Body.String() != "SECRET=1") { |
| + t.Fatalf("watch: %d %q, want the file served", w.Code, w.Body.String()) |
| } |
| m := g.onlyMatch(t) |
| if m.Tier != reqrec.TierHard || m.RuleID != "hard.secrets.env" { |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 137664ff0..ca0ea7b73 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -60,3 +60,4 @@ plan14-root-reads-region-ha-p1b3a.tsv 5d20b3777026e43906bfba301186bce0ae58daa9d8 |
| plan14-root-reads-stateless-replicas-1.tsv df8bf8056d80b9d78edc957fe7f2adbc75885e15f581e58167768346c4e05771 |
| plan14-root-reads-domain-registration-1.tsv 8e7126042fef8cc99899a29e9e06c22763a24b6677110144035ec57fcc2de23e |
| plan14-root-reads-edge-held-streams.tsv c61b055182bf84e822fab92199432bd2d462c268c03ead17c3cfa18f09bd82cd |
| +plan14-root-reads-edge-protect-hard-block.tsv 3b6cd29b87d2728254936722ab45fdadcfbb8c1f5b74fdfa19d1921b9dfd1dbe |
diff --git a/internal/provision/testdata/plan14-root-reads-edge-protect-hard-block.tsv b/internal/provision/testdata/plan14-root-reads-edge-protect-hard-block.tsv| new file mode 100644 |
| index 000000000..202f341ee |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-edge-protect-hard-block.tsv |
| @@ -0,0 +1,6 @@ |
| +# Census overlay edge-protect-hard-block, written by census-propose (#369). census-ruling-edge-protect-hard-block, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-edge-protect-hard-block.md. |
| +# 1 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy 4f785fc2483712d60f37e768491295802b8bdb3667c4428be0a6b2ef279afe57 internal/edgeguard/catalogue.txt external legacy accepted-legacy accepted-legacy;rev3=census-ruling-edge-protection-2;identity=its two consumers: the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), which matches requests against it, and the console (cmd/console serve under console.service, user carlos-console), which names a reference code's rule through edgeguard.RuleByHash (apiedgeref.go);basis=new: the edge protection catalogue, the hard and probe tier rules, each with what it matches and its mode (watch, block or burst): embedded with go:embed into the binary (edgeguard.catalogueData) and parsed once at init (parseCatalogue, then buildIndex; init panics on a malformed row or a version line that disagrees with edgeguard.Version); never opened from disk at runtime; data, not code; it only says which request paths and query values the edge matches, what the edge does with a match, and which rule a code names; no root decision; the class of the console's embedded templates (internal/console/templates/*.html external);rev3=census-ruling-edge-protect-hard-block;basis=the 33 hard-tier rows change mode watch -> block and the version line goes 1 -> 2; data only, still embedded, parsed once at init, never opened at runtime; no new read and no root decision file:external@0 f84824e9c7a16940afa1112bd88300fc96bce15fcbc879b1a2d6d6bda68626f6 |
| +internal/edgeguard/catalogue.txt external legacy accepted-legacy accepted-legacy;rev3=census-ruling-edge-protection-2;identity=its two consumers: the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), which matches requests against it, and the console (cmd/console serve under console.service, user carlos-console), which names a reference code's rule through edgeguard.RuleByHash (apiedgeref.go);basis=new: the edge protection catalogue, the hard and probe tier rules, each with what it matches and its mode (watch, block or burst): embedded with go:embed into the binary (edgeguard.catalogueData) and parsed once at init (parseCatalogue, then buildIndex; init panics on a malformed row or a version line that disagrees with edgeguard.Version); never opened from disk at runtime; data, not code; it only says which request paths and query values the edge matches, what the edge does with a match, and which rule a code names; no root decision; the class of the console's embedded templates (internal/console/templates/*.html external);rev3=census-ruling-edge-protect-hard-block;basis=the 33 hard-tier rows change mode watch -> block and the version line goes 1 -> 2; data only, still embedded, parsed once at init, never opened at runtime; no new read and no root decision file:external@0 f84824e9c7a16940afa1112bd88300fc96bce15fcbc879b1a2d6d6bda68626f6 |
| +@coverage internal/edge 38ebf1b8f7ecfeb34e13d655eebbd685cb9e9e546f229a29f2243a4650f6016f |
| +@coverage internal/edgeguard e037d551612af41afcb00505026c9a3e3459335eba2eb54d0cf27e13034ea9c9 |