census static-sweep: the startup sweep's two new legacy rows (hand-written), internal/edge re-pinned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+36
−0
docs/superpowers/notes/census-proposal-static-sweep.md+26 −0internal/provision/testdata/plan14-root-reads-chain.tsv+2 −0internal/provision/testdata/plan14-root-reads-static-sweep-new.tsv+5 −0internal/provision/testdata/plan14-root-reads-static-sweep.tsv+3 −0
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-static-sweep.md b/docs/superpowers/notes/census-proposal-static-sweep.md| new file mode 100644 |
| index 000000000..f20cb80e9 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-static-sweep.md |
| @@ -0,0 +1,26 @@ |
| +# Census approval: static-sweep |
| + |
| +Ruling `census-ruling-static-sweep`. Every change below keeps the disposition it already has, so it needs an approval, not a 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. Escalate 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. An escalation goes to the census owner as a decision. |
| + |
| +Seal: `c0d9880432c2cd59e42c6259494db4d7b6476a0fb486aaeedada10beb5879fec` → `c0d9880432c2cd59e42c6259494db4d7b6476a0fb486aaeedada10beb5879fec`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-static-sweep.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
| + |
| +## The decision: two new units, written by hand |
| + |
| +`internal/edge/static_sweep_unix.go` adds two units that read the disk, so census-propose leaves them to a decision. Their rows are in `internal/provision/testdata/plan14-root-reads-static-sweep-new.tsv`, chained before the overlay above. They are `@legacy` rows, so the seal moves to `c0d98804…9fec`. |
| + |
| +| unit | reads | proposed disposition | |
| +|---|---|---| |
| +| `sweepStaticCache` | `OpenFile` of `<cacheDir>/.edge.lock` (created if absent), then `flock` on it | `legacy`/`accepted-legacy`, J4 footing (`root-input`), as the edge's other static units are | |
| +| `renameUnserved` | `ReadDir` of the cache, each account and each app; `Readlink` of each app's `current`; `Lstat` of each entry | the same | |
| + |
| +Both run in the agent (`carlos-edge.service`, user carlos), not root. They run once, at startup, from `EnableStatic`, before any static handler exists, and only when this process takes the cache's lock exclusively. Every running edge holds that lock shared for its life, so the sweep never runs while another edge serves from the cache. |
| + |
| +In each app directory, the sweep keeps the tree the `current` link names and renames every other directory to `.sweep-<name>-<stamp>`. It never touches files or links. The renamed trees, and earlier `.sweep-` and `.extract-` leftovers, are removed in the background. Nothing removed is lost: every tree is a cache of a signed release, and `ensureExtracted` verifies the release again before extracting a fresh copy. |
| + |
| +The first design, a sweep at each version swap, was dropped after Astra's review: it raced handlers selecting trees and edge processes overlapping on a restart. |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 024e21cd2..9d8259785 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -21,3 +21,5 @@ plan14-root-reads-edge-request-records.tsv 84cb1e17c2f9cabddcc1e6ed5b39b00ffa703 |
| plan14-root-reads-data-lifecycle-336.tsv 539ae875b4a089bc6512ae2e047fa9e353e8b760c18312b81ec3400e5e1f6d48 |
| plan14-root-reads-plans-4a-store.tsv 72dc835c04caf5b2b49cc6ecbfd865bb3123b997ee932e8ab7c0df239935a26b |
| plan14-root-reads-plans-4-notices-grace.tsv 43e430a3b3edf9333bfe2c64f24ca9e4c04475dc45ae4983d4e8bcab6a9c0bc4 |
| +plan14-root-reads-static-sweep-new.tsv c0d9880432c2cd59e42c6259494db4d7b6476a0fb486aaeedada10beb5879fec |
| +plan14-root-reads-static-sweep.tsv c0d9880432c2cd59e42c6259494db4d7b6476a0fb486aaeedada10beb5879fec |
diff --git a/internal/provision/testdata/plan14-root-reads-static-sweep-new.tsv b/internal/provision/testdata/plan14-root-reads-static-sweep-new.tsv| new file mode 100644 |
| index 000000000..ec0cd5085 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-static-sweep-new.tsv |
| @@ -0,0 +1,5 @@ |
| +# Census overlay static-sweep-new, hand-written: the two new units census-propose leaves to a decision (the static cache startup sweep). census-ruling-static-sweep, asked of the census owner with the approval card (docs/superpowers/notes/census-proposal-static-sweep.md). |
| +@legacy 435245bcb853d5f5c462f90ef60551650427980c33b177c1e1b9aa42bab50ddb internal/edge/static_sweep_unix.go renameUnserved legacy accepted-legacy accepted-legacy;rev3=census-ruling-static-sweep;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input; once at startup, before any static handler exists and only under an exclusive flock no other edge holds, reads its own static cache (<cacheDir>/<acct>/<app>: entries, each current link, each entry lstat) and renames every directory but the current link target to a .sweep- name for removal, with earlier .sweep- and .extract- leftovers; never touches files or links; every tree is a cache of a signed release that ensureExtracted re-verifies before extracting it again; no root decision file:Lstat@762,file:ReadDir@282,file:ReadDir@599,file:ReadDir@84,file:Readlink@536 9782b5863da22fd871d880f669c4edd34a2e41a2e1465d9b1e85f14e66aa7f54 |
| +@legacy 45230ff8fe9ff826e8fd8dc359b0f26fe6634c4245ba85f89bf9e9c6ca1a4094 internal/edge/static_sweep_unix.go sweepStaticCache legacy accepted-legacy accepted-legacy;rev3=census-ruling-static-sweep;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input; opens or creates <cacheDir>/.edge.lock and flocks it (exclusive non-blocking to sweep, then shared for the process life); the lock decides only whether this start sweeps; no root decision file:OpenFile@270 0ac57f7880540bafbd015364d4ff5db8bb9a739afd1d5d2b600ffec6feb509f1 |
| +internal/edge/static_sweep_unix.go renameUnserved legacy accepted-legacy accepted-legacy;rev3=census-ruling-static-sweep;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input; once at startup, before any static handler exists and only under an exclusive flock no other edge holds, reads its own static cache (<cacheDir>/<acct>/<app>: entries, each current link, each entry lstat) and renames every directory but the current link target to a .sweep- name for removal, with earlier .sweep- and .extract- leftovers; never touches files or links; every tree is a cache of a signed release that ensureExtracted re-verifies before extracting it again; no root decision file:Lstat@762,file:ReadDir@282,file:ReadDir@599,file:ReadDir@84,file:Readlink@536 9782b5863da22fd871d880f669c4edd34a2e41a2e1465d9b1e85f14e66aa7f54 |
| +internal/edge/static_sweep_unix.go sweepStaticCache legacy accepted-legacy accepted-legacy;rev3=census-ruling-static-sweep;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-input; opens or creates <cacheDir>/.edge.lock and flocks it (exclusive non-blocking to sweep, then shared for the process life); the lock decides only whether this start sweeps; no root decision file:OpenFile@270 0ac57f7880540bafbd015364d4ff5db8bb9a739afd1d5d2b600ffec6feb509f1 |
diff --git a/internal/provision/testdata/plan14-root-reads-static-sweep.tsv b/internal/provision/testdata/plan14-root-reads-static-sweep.tsv| new file mode 100644 |
| index 000000000..cc4674016 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-static-sweep.tsv |
| @@ -0,0 +1,3 @@ |
| +# Census overlay static-sweep, written by census-propose (#369). census-ruling-static-sweep, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-static-sweep.md. |
| +# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@coverage internal/edge 9d8ff80aa1b71953d2452257a20590c10a19bcf874e0d43730520b969adde57f |