carlos / platform Public

census: media conversion console side

Plan 2 Task 12. Root-read census: make census-card lists no unit, only
three envelopes re-pinned (`.`, internal/objstore, internal/plans).
census-propose NAME=media-conversion wrote the overlay
plan14-root-reads-media-conversion.tsv, its chain line and the card
docs/superpowers/notes/census-proposal-media-conversion.md; the claims
file records what changed in each envelope (no new root read) for the
reviewer, as comments, since an envelope takes no claim.

Record-write census (9B8): media_conversion_census_test.go re-pins four
units on boundedSystemctlWriteCensusInventory with kinds unchanged and
no record write moved (demo_claim_transfer.go finishDemoClaimAbort,
linkedpolicy.go linkedPolicies, plangrace.go const#1, routedecls.go
routeDecls), and TestPlan9B8RecordWriteCensus points at it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 63b1cc0ea1e044cd5b4f23ec9cb49e4adef074a1 parent 7247946
6 files changed, +101 −1
  • docs/superpowers/notes/census-claims-media-conversion.tsv +36 −0
  • docs/superpowers/notes/census-proposal-media-conversion.md +11 −0
  • internal/provision/media_conversion_census_test.go +47 −0
  • internal/provision/plan9_b8_census_test.go +1 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-media-conversion.tsv +5 −0
diff --git a/docs/superpowers/notes/census-claims-media-conversion.tsv b/docs/superpowers/notes/census-claims-media-conversion.tsv
new file mode 100644
index 000000000..94cbb126e
--- /dev/null
+++ b/docs/superpowers/notes/census-claims-media-conversion.tsv
@@ -0,0 +1,36 @@
+# Census claims for media conversion, plan 2 (console side), branch media-conversion. <file>:<unit> TAB <what changed>.
+# No census unit changes: make census-card lists no unit, only three envelopes re-pinned (`.`, internal/objstore,
+# internal/plans), which census-propose takes without a claim (a claim for an envelope is refused as "not a change
+# the census sees"). What changed in each, kept here for the reviewer. No new root read in any of them.
+# internal/media, internal/mediajobs and internal/storecfg are new and outside the root binary (go list -deps . for
+# linux amd64 and arm64 names none of them); only the console imports them.
+#
+# `.` (root CLI): client-side commands only, each one HTTPS round trip to the console through the existing
+# apiSession (getJSON/postJSON), with output printed from the reply. No file, process, environment variable, path or
+# root-owned state is read; nothing runs as root.
+# media_cli.go (new): `carlos media convert|status` (POST/GET .../media/conversions[/<id>], --wait polls the same GET
+# and stops on Ctrl-C) and `carlos system media status` (GET /api/cli/system/media); cleanControl strips control
+# characters from the console's text before printing.
+# store_uploads.go (new): `carlos store uploads enable|status|disable` (POST/GET .../store/uploads), API mode only via
+# requireStoreAPISession; app names checked with validAppName.
+# apimode.go: apiUploadsReply and storeUploadsCall/storeUploadsSet/storeUploadsStatus, the uploads door's client.
+# commands.go: registers mediaCommand(). system.go: registers systemMediaCommand() and one usage line.
+# store.go: storeUsage turns from const to var to append the uploads usage row; storeCommand registers
+# storeUploadsCommand().
+#
+# internal/objstore: no new read; root reads nothing new.
+# aws.go storePolicyJSON: the store user's object Allow gains s3:AbortMultipartUpload and s3:ListMultipartUploadParts
+# on <bucket>/*. Neither writes object data or tags; multipart create, upload-part and complete are s3:PutObject and
+# stay under the existing tag-key Deny and the storage-grace write Deny. The app's credential, not root, holds it.
+# objstore.go Record: an additive optional field `conversion` (Conversion{Incarnation, VerifiedAt, Uploads{Origins,
+# CORSHash, LifecycleHash, At, By}}), written only by the console. release.PurgeApp's local struct ignores it
+# (TestPurgeGuardIgnoresConversionBlock), as it ignores `scanning`.
+# walk.go: new claimRawConvergePolicyIn/ConvergePolicyIn: under the existing app mutation, reads the store record
+# (GetIn, as every walk does), refuses an unprovisioned store or a grant/provisioned bucket mismatch, and rewrites the
+# user's inline policy through the existing EnsureUser with the same inputs the grant walk uses. Never mints or reaps
+# a key, never writes the record or delivered config, never creates a bucket. Only caller: the console's
+# `store uploads enable` door.
+#
+# internal/plans catalog.go: Limits gains MediaMinutesMonth (json media_minutes_month, 0 is no limit), carried
+# through validate (packs may add it), nonNegative, additive, Effective (a pack never turns no-limit into a limit),
+# the ceilings clamp and generous. Pure arithmetic over the catalog already loaded; no I/O.
diff --git a/docs/superpowers/notes/census-proposal-media-conversion.md b/docs/superpowers/notes/census-proposal-media-conversion.md
new file mode 100644
index 000000000..393558ace
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-media-conversion.md
@@ -0,0 +1,11 @@
+# Census approval: media-conversion
+
+Ruling `census-ruling-media-conversion`. 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).
+
+Envelopes re-pinned: `.`, `internal/objstore`, `internal/plans`.
+
+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.
+
+Seal: `16cae3931aadfa57a5293d69becf318645681400777cc08972cf08eb449c2457` → `16cae3931aadfa57a5293d69becf318645681400777cc08972cf08eb449c2457`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-media-conversion.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/provision/media_conversion_census_test.go b/internal/provision/media_conversion_census_test.go
new file mode 100644
index 000000000..f73afcef0
--- /dev/null
+++ b/internal/provision/media_conversion_census_test.go
@@ -0,0 +1,47 @@
+package provision
+
+// Record-write census re-pin for media conversion, plan 2 (console side,
+// branch media-conversion), layered on boundedSystemctlWriteCensusInventory
+// (main's newest at 61ed5486). Reviewed by the branch author and, with the
+// branch, the cross-model reviewer. No record write is added, moved or
+// reclassified; each unit's kinds are unchanged and only its source moved:
+// - Server.finishDemoClaimAbort (demo_claim_transfer.go): after TrashApp
+// and before the existing PurgeAppExcept, it asks release.PurgeAppGuards
+// (the purge's own guards, read only) and then s.mediaPurgeRetire, which
+// retires the target app's media jobs in the console's job table (SQLite,
+// not the record store) under the store-walk lock; a refusal or error
+// stops the abort before anything is swept. The PurgeAppExcept call and
+// its provision.IsRecordKey keep are unchanged. Kinds: key:IsRecordKey.
+// - var linkedPolicies (linkedpolicy.go): four more linkedRefuse entries
+// for the new doors (store/uploads GET and POST, media/conversions POST
+// and GET). Kinds: lit:instances,lit:sidecars, unchanged.
+// - const#1 (plangrace.go): a new capMedia capID ("media") in the same
+// const block. Kinds: lit:sidecars, unchanged.
+// - var routeDecls (routedecls.go): five more route declarations
+// (store/uploads GET and POST, media/conversions POST and
+// media/conversions/{id} GET, system/media GET) with their roles and
+// handlers. Kinds: lit:instances,lit:sidecars, unchanged.
+func mediaConversionWriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), boundedSystemctlWriteCensusInventory()...)
+ repins := []censusEntry{
+ {"internal/console/demo_claim_transfer.go", "Server.finishDemoClaimAbort", "key-site", "key:IsRecordKey", "5a97f8cbaf1aa25da0d8c2c68b7c53848a1c9346ba7913faab1cfcca55ca2c7b"},
+ {"internal/console/linkedpolicy.go", "var linkedPolicies", "key-site", "lit:instances,lit:sidecars", "df97ea6dcc53b7c9d9cbcc3c1a344eaa188f43f3a14238a138b0b792aba037fe"},
+ {"internal/console/plangrace.go", "const#1", "key-site", "lit:sidecars", "e5a2eb9f92bc5ca798758d3a620343dc645bb19837d8d035ac2b749a99abb5de"},
+ {"internal/console/routedecls.go", "var routeDecls", "key-site", "lit:instances,lit:sidecars", "933b4c0243009d914eb9f39d5f0301111ef9736dc4bbb7cb259ad7bb09987a11"},
+ }
+ for _, r := range repins {
+ found := false
+ for i, e := range entries {
+ if e.File == r.File && e.Unit == r.Unit {
+ if e.Class != r.Class || e.Kinds != r.Kinds {
+ panic("media-conversion re-pin changes the class or kinds of " + r.File + ":" + r.Unit)
+ }
+ entries[i], found = r, true
+ }
+ }
+ if !found {
+ panic("media-conversion re-pin of an unlisted unit " + r.File + ":" + r.Unit)
+ }
+ }
+ return entries
+}
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go
index 9a7c36ecf..62e0e4375 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 := boundedSystemctlWriteCensusInventory()
+ inventory := mediaConversionWriteCensusInventory()
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 "))
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index e5eb08f88..fdfef2c16 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -244,3 +244,4 @@ plan14-root-reads-fix-1193-wal-close-test.tsv 7ca068c5c146a679b4726d74fe43cf9c47
plan14-root-reads-ha-1192.tsv 8df52839a0c961d3721f3a5c3247d06202dae4e00d011844b7117f8e918803d4
plan14-root-reads-audit-bugs-2.tsv 1610abfc476fe45d259494242243756dac9cfec49cdd7f7f7b238329392241a1
plan14-root-reads-bounded-systemctl.tsv 16cae3931aadfa57a5293d69becf318645681400777cc08972cf08eb449c2457
+plan14-root-reads-media-conversion.tsv 16cae3931aadfa57a5293d69becf318645681400777cc08972cf08eb449c2457
diff --git a/internal/provision/testdata/plan14-root-reads-media-conversion.tsv b/internal/provision/testdata/plan14-root-reads-media-conversion.tsv
new file mode 100644
index 000000000..dc42b230b
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-media-conversion.tsv
@@ -0,0 +1,5 @@
+# Census overlay media-conversion, written by census-propose (#369). census-ruling-media-conversion, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-media-conversion.md.
+# 0 body, 0 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+@coverage . faae2c5b05e4c81b12144525a0ac0d719f402b06185fa5e29a307c14bb8aa554
+@coverage internal/objstore c82dfa6f554b542bd88a8abd689eebf9c4a898035b3e5172c39f3ab4de09b359
+@coverage internal/plans 9d8eda538aaee256421b22df37e64c434680c35df8414abbc1393aae870fe23f