carlos / platform Public

census: static-markdown-twins overlay for edge Markdown twins

Record per-unit claims for representation selection and serving, re-pin the edge envelope and append the generated census overlay. Independent cross-family approval remains with the controller before merge.
codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev 70cab1d61fef294de85a8b568b38d4a535d67e57 parent 69ee35b
4 files changed, +39 −0
  • docs/superpowers/notes/census-proposal-static-markdown-twins.md +25 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-static-markdown-twins.tsv +10 −0
  • testdata/static-markdown-twins-claims.tsv +3 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/notes/census-proposal-static-markdown-twins.md b/docs/superpowers/notes/census-proposal-static-markdown-twins.md
new file mode 100644
index 000000000..d702fa005
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-static-markdown-twins.md
@@ -0,0 +1,25 @@
+# Census approval: static-markdown-twins
+
+Ruling `census-ruling-static-markdown-twins`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/edge/static.go` `staticSite.serveFile` | body | unchanged (2) | Accepts a forced representation content type for ordinary and non-200 responses, including tag fallback; existing os.Open and open-file Stat now operate on the selected HTML or Markdown file inside the extracted digest-verified tree; no additional read site and no root decision. |
+| `internal/edge/static.go` `staticSite.serveTree` | body | unchanged (2) | Selects an existing regular Markdown sibling only after HTML resolution and redirects, checks the selected target against the hard tier, adds Vary: Accept and passes path/info/type to serveFile; existing Stat sites are unchanged; the selector adds the sibling Lstat described below; no root decision. |
+
+Envelopes re-pinned: `internal/edge`.
+
+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/static.go` `staticSite.serveFile`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=PROPOSED-static-redirects;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input; serveTree's former Open and open-file Stat of the file serveTree resolved inside the extracted, digest-verified tree, unchanged, plus a non-200 branch that copies the same open file under a _redirects 404 status; no root decision;rev3=census-ruling-static-headers;basis=takes the in-memory _headers lookup result (extra) and, on the 200 branch only, wraps the writer in headerWriter, which sets those header values on 200/206/304 at status time; the same Open and open-file Stat of the same resolved file; no read added, no root decision
+- `internal/edge/static.go` `staticSite.serveTree`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=PROPOSED-static-redirects;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=the same index-aware Stat lookup inside the extracted tree, now run at most twice (the request path, then once for a _redirects rewrite destination cleaned rooted inside the same tree); the Open moves to serveFile; the _redirects file itself is never answered; no root decision;rev3=census-ruling-edge-protection-2;basis=consults the edge protection matcher (internal/edgeguard, pure and in-memory) on the request path (probe tier, only when no file and no _redirects rule names it) and on a rewrite target (hard tier, only when the file is there), and may answer the guard's 404 block page through guardDecide before a redirect or the rewritten file; the _redirects lookup gains an in-memory names check; the same index-aware Stat lookups inside the extracted tree, unchanged; no read added;rev3=census-ruling-static-dir-slash;basis=A directory requested without its trailing slash now answers a 301 to a relative "./<base>/" (query kept) instead of serving its index.html, unless the request was rewritten, the path ends in "/", a _redirects rule names the path, or the rules would redirect its slash form (redirectsSlashForm, the existing in-memory resolve with exists=true). It opens and stats exactly the files it did before; the new branch only writes a Location header and a status, from the request path and the rules it already parsed.;rev3=census-ruling-static-headers;basis=computes the in-memory _headers lookup once on the cleaned request path and host and passes it to serveFile; the _headers file itself is never answered (found excludes it, as _redirects); the same index-aware Stat lookups inside the extracted tree; no read added;rev3=census-ruling-probe-burst-limit;basis=where the guard already checks the probe tier for a path the tree does not have, it also asks whether the path is in the catalogue (staticBurstHit, the in-memory edgeguard matcher) and, for a client in a probe-burst cool-down, may answer the 429 burst refusal (staticBurstDecide, the in-memory limiter) before a redirect or rewrite; the same index-aware Stat lookups inside the extracted tree; no new root read or write kind
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/edge/static_markdown.go:selectStaticRepresentation`: reads +file:Lstat; written legacy, accepted-legacy, frozen
+
+Seal: `526d434888d043a8b09d8fe196f6324782d6ca20d759b080f99daa528adf6a32` → `98b428c0ddd2fa8533bfee1a5089cc7eb4a7635ba91fe8f1601c5c2af914c203`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-static-markdown-twins.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index d9cc40bbc..0b163cbb8 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -87,3 +87,4 @@ plan14-root-reads-stateless-replicas-3.tsv 703d9a189185e2075ec088bf9349e58132573
plan14-root-reads-region-ha-p3b.tsv face84b4c688cd3c179b0a34ced4d3521e71de8e63cbd45f21c27972c5b1a921
plan14-root-reads-stateless-coordinator-oneboxfleet.tsv face84b4c688cd3c179b0a34ced4d3521e71de8e63cbd45f21c27972c5b1a921
plan14-root-reads-region-ha-group-rtb.tsv 526d434888d043a8b09d8fe196f6324782d6ca20d759b080f99daa528adf6a32
+plan14-root-reads-static-markdown-twins.tsv 98b428c0ddd2fa8533bfee1a5089cc7eb4a7635ba91fe8f1601c5c2af914c203
diff --git a/internal/provision/testdata/plan14-root-reads-static-markdown-twins.tsv b/internal/provision/testdata/plan14-root-reads-static-markdown-twins.tsv
new file mode 100644
index 000000000..ffa4c4bb7
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-static-markdown-twins.tsv
@@ -0,0 +1,10 @@
+# Census overlay static-markdown-twins, written by census-propose (#369). census-ruling-static-markdown-twins, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-static-markdown-twins.md.
+# 2 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 392266769a135ba47f8ec3d084be1a5133fac870b47a3b694c816de14e1d4b55 internal/edge/static.go staticSite.serveFile legacy accepted-legacy accepted-legacy;rev3=PROPOSED-static-redirects;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input; serveTree's former Open and open-file Stat of the file serveTree resolved inside the extracted, digest-verified tree, unchanged, plus a non-200 branch that copies the same open file under a _redirects 404 status; no root decision;rev3=census-ruling-static-headers;basis=takes the in-memory _headers lookup result (extra) and, on the 200 branch only, wraps the writer in headerWriter, which sets those header values on 200/206/304 at status time; the same Open and open-file Stat of the same resolved file; no read added, no root decision;rev3=census-ruling-static-markdown-twins;basis=Accepts a forced representation content type for ordinary and non-200 responses, including tag fallback; existing os.Open and open-file Stat now operate on the selected HTML or Markdown file inside the extracted digest-verified tree; no additional read site and no root decision. file:Open@165,file:Stat@1746 2c19c03112e08234ed04ae6f53f644b440466731ec31c26400429e11bca56c85
+@legacy 863ec330adedf2a0dff76d6cec165149fe3a1747f8f5e668530da16d81d89e91 internal/edge/static.go staticSite.serveTree legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=PROPOSED-static-redirects;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=the same index-aware Stat lookup inside the extracted tree, now run at most twice (the request path, then once for a _redirects rewrite destination cleaned rooted inside the same tree); the Open moves to serveFile; the _redirects file itself is never answered; no root decision;rev3=census-ruling-edge-protection-2;basis=consults the edge protection matcher (internal/edgeguard, pure and in-memory) on the request path (probe tier, only when no file and no _redirects rule names it) and on a rewrite target (hard tier, only when the file is there), and may answer the guard's 404 block page through guardDecide before a redirect or the rewritten file; the _redirects lookup gains an in-memory names check; the same index-aware Stat lookups inside the extracted tree, unchanged; no read added;rev3=census-ruling-static-dir-slash;basis=A directory requested without its trailing slash now answers a 301 to a relative "./<base>/" (query kept) instead of serving its index.html, unless the request was rewritten, the path ends in "/", a _redirects rule names the path, or the rules would redirect its slash form (redirectsSlashForm, the existing in-memory resolve with exists=true). It opens and stats exactly the files it did before; the new branch only writes a Location header and a status, from the request path and the rules it already parsed.;rev3=census-ruling-static-headers;basis=computes the in-memory _headers lookup once on the cleaned request path and host and passes it to serveFile; the _headers file itself is never answered (found excludes it, as _redirects); the same index-aware Stat lookups inside the extracted tree; no read added;rev3=census-ruling-probe-burst-limit;basis=where the guard already checks the probe tier for a path the tree does not have, it also asks whether the path is in the catalogue (staticBurstHit, the in-memory edgeguard matcher) and, for a client in a probe-burst cool-down, may answer the 429 burst refusal (staticBurstDecide, the in-memory limiter) before a redirect or rewrite; the same index-aware Stat lookups inside the extracted tree; no new root read or write kind;rev3=census-ruling-static-markdown-twins;basis=Selects an existing regular Markdown sibling only after HTML resolution and redirects, checks the selected target against the hard tier, adds Vary: Accept and passes path/info/type to serveFile; existing Stat sites are unchanged; the selector adds the sibling Lstat described below; no root decision. file:Stat@1301,file:Stat@1415 40e516ea7af516647a44bd22c45f3a6b010fa122d9b52b911d691ae6da56d3e7
+@legacy 9638867b5cdd5ca6638dd15de3401258c2369af0663e5c1d3c8667a5e23bd95e internal/edge/static_markdown.go selectStaticRepresentation legacy accepted-legacy accepted-legacy;rev3=census-ruling-static-markdown-twins;basis=Adds file:Lstat of the .md sibling of an already resolved regular .html file inside the extracted digest-verified tree; refuses symlinks and non-regular twins, then selects only on strict positive Accept preference; edge runs as carlos, with no root decision. file:Lstat@292 798868afa1f365c942c7a5a72593fd5e18d818b874677fffcc3a45fa932930a4
+internal/edge/static.go staticSite.serveFile legacy accepted-legacy accepted-legacy;rev3=PROPOSED-static-redirects;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input; serveTree's former Open and open-file Stat of the file serveTree resolved inside the extracted, digest-verified tree, unchanged, plus a non-200 branch that copies the same open file under a _redirects 404 status; no root decision;rev3=census-ruling-static-headers;basis=takes the in-memory _headers lookup result (extra) and, on the 200 branch only, wraps the writer in headerWriter, which sets those header values on 200/206/304 at status time; the same Open and open-file Stat of the same resolved file; no read added, no root decision;rev3=census-ruling-static-markdown-twins;basis=Accepts a forced representation content type for ordinary and non-200 responses, including tag fallback; existing os.Open and open-file Stat now operate on the selected HTML or Markdown file inside the extracted digest-verified tree; no additional read site and no root decision. file:Open@165,file:Stat@1746 2c19c03112e08234ed04ae6f53f644b440466731ec31c26400429e11bca56c85
+internal/edge/static.go staticSite.serveTree legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=PROPOSED-static-redirects;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=the same index-aware Stat lookup inside the extracted tree, now run at most twice (the request path, then once for a _redirects rewrite destination cleaned rooted inside the same tree); the Open moves to serveFile; the _redirects file itself is never answered; no root decision;rev3=census-ruling-edge-protection-2;basis=consults the edge protection matcher (internal/edgeguard, pure and in-memory) on the request path (probe tier, only when no file and no _redirects rule names it) and on a rewrite target (hard tier, only when the file is there), and may answer the guard's 404 block page through guardDecide before a redirect or the rewritten file; the _redirects lookup gains an in-memory names check; the same index-aware Stat lookups inside the extracted tree, unchanged; no read added;rev3=census-ruling-static-dir-slash;basis=A directory requested without its trailing slash now answers a 301 to a relative "./<base>/" (query kept) instead of serving its index.html, unless the request was rewritten, the path ends in "/", a _redirects rule names the path, or the rules would redirect its slash form (redirectsSlashForm, the existing in-memory resolve with exists=true). It opens and stats exactly the files it did before; the new branch only writes a Location header and a status, from the request path and the rules it already parsed.;rev3=census-ruling-static-headers;basis=computes the in-memory _headers lookup once on the cleaned request path and host and passes it to serveFile; the _headers file itself is never answered (found excludes it, as _redirects); the same index-aware Stat lookups inside the extracted tree; no read added;rev3=census-ruling-probe-burst-limit;basis=where the guard already checks the probe tier for a path the tree does not have, it also asks whether the path is in the catalogue (staticBurstHit, the in-memory edgeguard matcher) and, for a client in a probe-burst cool-down, may answer the 429 burst refusal (staticBurstDecide, the in-memory limiter) before a redirect or rewrite; the same index-aware Stat lookups inside the extracted tree; no new root read or write kind;rev3=census-ruling-static-markdown-twins;basis=Selects an existing regular Markdown sibling only after HTML resolution and redirects, checks the selected target against the hard tier, adds Vary: Accept and passes path/info/type to serveFile; existing Stat sites are unchanged; the selector adds the sibling Lstat described below; no root decision. file:Stat@1301,file:Stat@1415 40e516ea7af516647a44bd22c45f3a6b010fa122d9b52b911d691ae6da56d3e7
+internal/edge/static_markdown.go selectStaticRepresentation legacy accepted-legacy accepted-legacy;rev3=census-ruling-static-markdown-twins;basis=Adds file:Lstat of the .md sibling of an already resolved regular .html file inside the extracted digest-verified tree; refuses symlinks and non-regular twins, then selects only on strict positive Accept preference; edge runs as carlos, with no root decision. file:Lstat@292 798868afa1f365c942c7a5a72593fd5e18d818b874677fffcc3a45fa932930a4
+@coverage internal/edge 3f3ff9e696eb227bb4f0a2da386a71643b3ca13d8f4a2ac39e9fe37dc331ac24
diff --git a/testdata/static-markdown-twins-claims.tsv b/testdata/static-markdown-twins-claims.tsv
new file mode 100644
index 000000000..5e19c8147
--- /dev/null
+++ b/testdata/static-markdown-twins-claims.tsv
@@ -0,0 +1,3 @@
+internal/edge/static.go:staticSite.serveFile Accepts a forced representation content type for ordinary and non-200 responses, including tag fallback; existing os.Open and open-file Stat now operate on the selected HTML or Markdown file inside the extracted digest-verified tree; no additional read site and no root decision.
+internal/edge/static.go:staticSite.serveTree Selects an existing regular Markdown sibling only after HTML resolution and redirects, checks the selected target against the hard tier, adds Vary: Accept and passes path/info/type to serveFile; existing Stat sites are unchanged; the selector adds the sibling Lstat described below; no root decision.
+internal/edge/static_markdown.go:selectStaticRepresentation Adds file:Lstat of the .md sibling of an already resolved regular .html file inside the extracted digest-verified tree; refuses symlinks and non-regular twins, then selects only on strict positive Accept preference; edge runs as carlos, with no root decision.