carlos / platform Public

census: proposal for sqlite-integrity-safe (4 units)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 3aa2a4819e76b8f4434d8e42a4d961437efc3060 parent efecf7b
3 files changed, +41 −0
  • docs/superpowers/notes/census-proposal-sqlite-integrity-safe.md +26 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-sqlite-integrity-safe.tsv +14 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/notes/census-proposal-sqlite-integrity-safe.md b/docs/superpowers/notes/census-proposal-sqlite-integrity-safe.md
new file mode 100644
index 000000000..3aae05377
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-sqlite-integrity-safe.md
@@ -0,0 +1,26 @@
+# Census approval: sqlite-integrity-safe
+
+Ruling `census-ruling-sqlite-integrity-safe`. The independent reviewer approves or rejects every change below, 2 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/ops/litestream.go` `RestoreVerify` | body | unchanged (1) | Output and counting only: prints restore result and freshness separately and counts current vs could-not-judge; exit status unchanged. No read added or changed; restore call and its one retry unchanged. |
+| `third_party/ltx/decoder.go` `Decoder.Close` | body | unchanged (1) | Reads through inputReader; a tail shorter than 8 bytes returns io.ErrUnexpectedEOF instead of panicking on a negative slice bound; lz4 end-frame error keeps its cause. No read added; same LTX object the restore already opened. |
+
+Envelopes re-pinned: `.`, `internal/ops`, `third_party/ltx`.
+
+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/ops/litestream.go` `RestoreVerify`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input
+- `third_party/ltx/decoder.go` `Decoder.Close`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-litestream-pin-1443;basis=vendored byte-for-byte from upstream ltx v0.5.1 (until now compiled into root from the module cache, outside the census); no read added or changed. Only acquireReadLock (BeginTx context) and ltx Compactor.Compact (header error returned) differ from upstream (#1443)
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/ops/freshness.go:sourceHeader`: reads +file:Open; written legacy, accepted-legacy, frozen
+- new `third_party/ltx/decoder.go:inputReader.Read`: reads +file:Read ×2; written legacy, accepted-legacy, frozen
+
+Seal: `dc00dc6bab094e8c81ab4e083a0b6a122ea886a70f8dca4885b5cf8a2bc3b177` → `b0b709d35006d8c1ade021e1d58c8387161479fe1c074a02d9dd1cab565111d6`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-sqlite-integrity-safe.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 279531f3c..494fd1bf1 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -334,3 +334,4 @@ plan14-root-reads-alias-with-mint-1653.tsv ce9536904e10de3f5e5c582061f130f870515
plan14-root-reads-private-store-scan-1653.tsv ce9536904e10de3f5e5c582061f130f870515ae0999de2946658ea49e4a17bf8
plan14-root-reads-canary-retire-orphan-1634.tsv 83cd5238dcd073e8fc89934a72f9c60b96081f15054f32a168f6cd594c88f49c
plan14-root-reads-backhaul-streams-1535.tsv dc00dc6bab094e8c81ab4e083a0b6a122ea886a70f8dca4885b5cf8a2bc3b177
+plan14-root-reads-sqlite-integrity-safe.tsv b0b709d35006d8c1ade021e1d58c8387161479fe1c074a02d9dd1cab565111d6
diff --git a/internal/provision/testdata/plan14-root-reads-sqlite-integrity-safe.tsv b/internal/provision/testdata/plan14-root-reads-sqlite-integrity-safe.tsv
new file mode 100644
index 000000000..3b371e4e3
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-sqlite-integrity-safe.tsv
@@ -0,0 +1,14 @@
+# Census overlay sqlite-integrity-safe, written by census-propose (#369). census-ruling-sqlite-integrity-safe, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-sqlite-integrity-safe.md.
+# 2 body, 0 sites, 3 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 c109695ab92e5cc735ade2d02bcd7447f7042dd1ec9bdf3ef3e95eb372776de8 internal/ops/litestream.go RestoreVerify legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-sqlite-integrity-safe;basis=Output and counting only: prints restore result and freshness separately and counts current vs could-not-judge; exit status unchanged. No read added or changed; restore call and its one retry unchanged. file:ReadFile@79 6c892a8d1dbcf5b6c6bc00a322e366133c12a24e11ab713065afa5a938907d24
+@legacy a40a02c2dd0d85ece306d2f194e4c53c840448767e2e8e12c69350cd0adb3231 third_party/ltx/decoder.go Decoder.Close legacy accepted-legacy accepted-legacy;rev3=census-ruling-litestream-pin-1443;basis=vendored byte-for-byte from upstream ltx v0.5.1 (until now compiled into root from the module cache, outside the census); no read added or changed. Only acquireReadLock (BeginTx context) and ltx Compactor.Compact (header error returned) differ from upstream (#1443);rev3=census-ruling-sqlite-integrity-safe;basis=Reads through inputReader; a tail shorter than 8 bytes returns io.ErrUnexpectedEOF instead of panicking on a negative slice bound; lz4 end-frame error keeps its cause. No read added; same LTX object the restore already opened. file:ReadAll@516 96ece0fb16711d0734af662cd07573b843caa34587c9bc83bc07e09cc2da051e
+@legacy 669999ee2b7d160232627631c0425a6643574a3f5fcaf320da268241ea8ef68d internal/ops/freshness.go sourceHeader legacy accepted-legacy accepted-legacy;rev3=census-ruling-sqlite-integrity-safe;basis=New helper replacing the ChangeCounter call in replicaFreshnessCounter: opens the same source path from the generated litestream config and reads the first 28 header bytes (counter plus WAL-mode bytes 18-19) in one read. Same file, same open, no new path. file:Open@82 85e75e33a94f533d2412e25570e5bc4d208451994afb2acc6e7a73fdd9a02fb1
+@legacy e7a953a21f3117bc8d2c9106f897f7123cedce1b00f231a8082d71f3b63ce5cd third_party/ltx/decoder.go inputReader.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-sqlite-integrity-safe;basis=New wrapper around the decoder's existing input reader: maps a premature io.EOF to io.ErrUnexpectedEOF unless the decoded zero-page terminator was reached; passes other errors through. Reads only the LTX stream the decoder already reads. file:Read@23,file:Read@64 7bb1baa719abcf75a1cfab2d123b0c0f37a4818c536617e57c2b363afff8298b
+internal/ops/litestream.go RestoreVerify legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-sqlite-integrity-safe;basis=Output and counting only: prints restore result and freshness separately and counts current vs could-not-judge; exit status unchanged. No read added or changed; restore call and its one retry unchanged. file:ReadFile@79 6c892a8d1dbcf5b6c6bc00a322e366133c12a24e11ab713065afa5a938907d24
+third_party/ltx/decoder.go Decoder.Close legacy accepted-legacy accepted-legacy;rev3=census-ruling-litestream-pin-1443;basis=vendored byte-for-byte from upstream ltx v0.5.1 (until now compiled into root from the module cache, outside the census); no read added or changed. Only acquireReadLock (BeginTx context) and ltx Compactor.Compact (header error returned) differ from upstream (#1443);rev3=census-ruling-sqlite-integrity-safe;basis=Reads through inputReader; a tail shorter than 8 bytes returns io.ErrUnexpectedEOF instead of panicking on a negative slice bound; lz4 end-frame error keeps its cause. No read added; same LTX object the restore already opened. file:ReadAll@516 96ece0fb16711d0734af662cd07573b843caa34587c9bc83bc07e09cc2da051e
+internal/ops/freshness.go sourceHeader legacy accepted-legacy accepted-legacy;rev3=census-ruling-sqlite-integrity-safe;basis=New helper replacing the ChangeCounter call in replicaFreshnessCounter: opens the same source path from the generated litestream config and reads the first 28 header bytes (counter plus WAL-mode bytes 18-19) in one read. Same file, same open, no new path. file:Open@82 85e75e33a94f533d2412e25570e5bc4d208451994afb2acc6e7a73fdd9a02fb1
+third_party/ltx/decoder.go inputReader.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-sqlite-integrity-safe;basis=New wrapper around the decoder's existing input reader: maps a premature io.EOF to io.ErrUnexpectedEOF unless the decoded zero-page terminator was reached; passes other errors through. Reads only the LTX stream the decoder already reads. file:Read@23,file:Read@64 7bb1baa719abcf75a1cfab2d123b0c0f37a4818c536617e57c2b363afff8298b
+@coverage . 66d3445f86ea99dd88e2209717e7f0c357e1507923b07426993c10b6cf8df03e
+@coverage internal/ops fec19eaf2786925518f2bc78997b61a6753388049837e7db04cfafba557a2665
+@coverage third_party/ltx c9722f3e80379a8d8fb86b9a8061849e748e5d6dc537d8927ed3daa9ccc8bc2b