media-conversion
Written by claude agent, operated by paul@keymail.dev — this branch has no commits of its own to compare against, so how current this is cannot be said
Where it stands
Media conversion merged and live on dev with the door on; R1-R4 passed; Paul's browser checks passed 2026-11-26. Follow-ups merged: spike values (2b5b5b77), results cleanup A8 (bac71e00, in v0.43.6), 3-hour SDR A9 (c340dd43), LiveKit BYO guide (edaed836, 39073a9b), write-only store credential phase 1 (2cadcb43) and phase 2 fixes (cc6c77b2, still off). Live LiveKit recording test passed on dev.
Next
R6 flagship once Paul answers licensing and pack price: catalog media_minutes_month + media pack, apply the engine to carloku-infrastructure at a tag carrying c340dd43, run R3 gates and R4 drills once, set the door. Small fixes: status done lag, F3 charge overrun, store status approval message, GB/GiB, image check, silent adoption. Weekly image refresh per Paul's choice. Switch write credentials to phase 2 after cc6c77b2 reaches every box, with Paul's go.
Blocked on
Paul: H.264/AAC licensing, pack price, flagship go, passkey drills and test-account deletion (baj/bak/bam/ban), weekly refresh choice.
Already decided
See memory media-conversion and the plan 3 ledger for every ruling.
Recently
A
<task-notification> <task-id>a4b6b52cf7f49ad4e</task-id> <tool-use-id>toolu_01FQQEGZ21pyzJBYMwkvSMyq</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/a4b6b52cf7f49ad4e.output</output-file> <status>completed</status> <summary>Agent "Fable branch review round 2 of media" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>## Round 1 findings - **Astra P1 (ECS reasons bypass the allowlist): resolved.** `knownFailure` is the only reader of a failure reason (`internal/mediaaws/engine.go:174-187`). Both the RunTask and DescribeTasks paths show table words only (`engine.go:125-131`, `:262-263`), and stop codes are kept only when the SDK's enum defines them (`:191-196`, `:277`). Retry classification matches the old rule. - **Fable P1-1 (no TLS roots in the image): resolved.** `cmd/carlos-media/main.go:36` blank-imports the fallback roots. `buildImage` refuses a binary whose build record does not link that module (`cmd/mediaimage/build.go:112-123`, called at `:180`). Selftest verifies an embedded S3 chain at a fixed time (`internal/mediahandler/selftesttls.go`). The only seam into verification is the unexported `Config.tlsRoots`, read only by selftest (`selftest.go:127`); no transfer client reads it. - **Fable P2-1 (dispatched row with no task held and charged): resolved.** Release is detached from the pass context (`internal/mediajobs/dispatch.go:422-426`). The never-started proof is in `track.go:317-325` with the window in `bounds.go:74-77`. - **Fable P2-2 (boot cloud failure leaves rows untracked): resolved.** `cmd/console/media.go:216-249` returns the retry, and `internal/console/mediapass.go:27-71, 104-133` runs it. No direct `s.cfg.Media*` or `s.cfg.Store*` reads remain outside the accessors. - **Fable P2-3 (`source_too_long` names the wrong maximum): resolved.** Failure results carry the probe's facts (`internal/mediahandler/run.go:84-89, 316-323`), and `ParseResult` checks them on error results (`internal/media/result.go:82-86`). No duration cap is applied there, so a very long source still parses as `source_too_long`. Targeted tests I ran all pass: `TestNoTask*`, `TestLaunchReleases*`, `TestWitnessRejectedVersusAmbiguous`, `TestMediaPass*`, `TestMediaRetry*`, the `mediaaws` reason and stop-code tests, and the result, TLS and selftest-chain tests. I did not run the 200-seed simulation or the serve witness. ## What I checked on items 1 and 2 **A5 (termination and money): sound as built.** - **Slow grant or late RunTask:** each grant assumes the role afresh (`internal/mediaaws/grants.go:303`), so the expiry check at `dispatch.go:347` is a real-clock bound even though the first staleness check is not. That justifies the implementer's extra 30 s (deviation 1). - **Same-process race:** dispatch, launch and recover run on one goroutine (`jobs.go:423-433, 501-518`), and `CompareAndSwap` keeps one loop per console. Recover cannot judge a row whose launch is still in flight; the window's opening only matters across a restart. - **Stale console clock:** the window's end is judged on a fresh reading taken after the lists answer (`bounds.go:83-93`), so deviation 2 is correct. A clock that steps backwards falls back to the pass's `now`, which is the safe direction. - **Double charge or double requeue:** not possible. Every settle is keyed on `execution_id` (`jobs.go:251`) and guarded on running, not stopped, not settled, and `task_arn = ''`. A second never-started fails `engine_unavailable`, uncharged (`dispatch.go:458-465`). - **Retired rows and teardown:** a retired row in the window fails `retired`, uncharged. With no engine, `Retire` still counts pending rows and refuses teardown (`retire.go:57-70`), so the media-off window cannot tear down under a live task. **A6 (retry): sound.** - **Second pass:** none. The retry and the pass share one goroutine, plus the guard at `mediapass.go:44`. - **Partial config:** none. `mediaFromEnv` returns whole or empty, and the install is a single atomic pointer store from nothing to everything (`mediawire.go:140-147`). Handlers check "configured" first, so no nil dereference. - **Retry after a settings error:** stops, logged once (`mediapass.go:128-130`). Cancellation also stops it. ## New findings No P1. No P2. **P3-1. The never-started proof rests on one list read.** - Evidence: `track.go:296-303, 319-322`; `internal/mediaaws/engine.go:302-332`. - Scenario: a single false-empty answer inside the 6 to 60 minute window requeues a row whose task is running. Possible causes are a task between the RUNNING and STOPPED indexes, or page shift on a cluster with over 100 tasks. I could not show ECS does this. The task then runs uncharged, and its outputs under the old execution prefix are never cleaned, because the requeue clears `execution_id` and sets no `cleanup_due`. - Fix: require the empty answer on two passes before settling, or record the orphan prefix for cleanup. Follow-up list. - Invariant: I3 (charge matches what ran). **P3-2. The window's opening has no margin for console clock skew.** - Evidence: `dispatch.go:329, 347`; `bounds.go:76`. - Scenario: the expiry check compares STS's clock with the console's `dispatched_at`. If the console clock runs ahead by s, Run can end up to s after the window opens. Reaching it needs a stall of about five minutes in the grant, then a kill and a restart that recovers within seconds. - Fix: add a minute of margin to the window's start, or say so in the comment. **P3-3. The simulation does not hold its own coverage.** - Evidence: `internal/sim/mediajobs/invariants_test.go:259` counts `requeued-with-a-task` and nothing reads it. `never-started-proved` and `crash-before-launch` have no floor. The fake engine has no list lag and no grant latency, which the report admits for the opening-value mutant. - Consequence: the crash and the window interior are exercised, at random points; the edges are held only by the unit test `TestNoTaskInsideTheWindowIsNeverStarted`. - Fix: assert a floor on the two events, and either fail on or delete the unread counter. **P3-4. A shutdown mid-grant now costs the row one of its two strikes.** - Evidence: `dispatch.go:343-345, 458`. - Scenario: two deploys that each catch the same row mid-grant fail it `engine_unavailable`. It is uncharged, but it is a tenant-visible failure the engine did not cause. - Fix: release without counting a strike when the launch's own context was cancelled. **P3-5. A settings error found only on a retry leaves running rows untracked until the next start, which then refuses to boot.** - Evidence: `mediapass.go:128-130`; `cmd/console/media.go:182-184`. - This is the implementer's concern 4 and is reasonable. A6 in the spec does not mention it; add a sentence. **P3-6. The `task_arn = ''` guard has no test** (`track.go:322`). The report says so; it is defensive given the single goroutine. **READY**</result> <usage><subagent_tokens>139308</subagent_tokens><tool_uses>25</tool_uses><duration_ms>334980</duration_ms></usage> </task-notification>
<task-notification> <task-id>b2uww5drc</task-id> <tool-use-id>toolu_01G8RjHvfh4WewA8gB1jm53r</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/b2uww5drc.output</output-file> <status>completed</status> <summary>Background command "Commit the spec amendments and run Astra round 2" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>bw66je3ye</task-id> <tool-use-id>toolu_01VQCYhHeCVjchLipjqrmAWw</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/bw66je3ye.output</output-file> <status>completed</status> <summary>Background command "Push Task 13 and run Astra round 1" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>a3df513f15409bc44</task-id> <tool-use-id>toolu_015ntenBxFvFUPYBZfS63h7j</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/a3df513f15409bc44.output</output-file> <status>completed</status> <summary>Agent "Review plan 2 Task 3 (spec + quality)" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>### Spec Compliance: ✅ with two gaps to close (no bucket-minting hole found on real AWS) - ✅ **Minted only from this walk's own successful create**: `internal/objstore/aws.go:306-322`, `internal/objstore/walk.go:283` and `:339-363`. `BucketAlreadyOwnedByYou`, us-east-1 or no-region success, a re-run, an adopt, and a provisioner without `BucketCreator` all stay unminted. - ✅ **Claim wrappers never mint**: `claimStoreProvisioner`, `claimEffectProvisioner` and `claimPurgeStore` hold the raw provisioner in a named field, so `CreateNewBucket` is not promoted. - ✅ **Verification order and checks** match §5.2 and the brief: `internal/storecfg/storecfg.go:189-215`. Empty `Account` or `Region` fails closed. - ✅ **`mediaStoreEligible`** matches the brief: `internal/console/mediastore.go:45-88`. It writes by CAS on the ETag it read, a refusal writes nothing, and `Inspect` runs outside any transaction. - ✅ **F6 and F7** applied: the console test asserts `(code, check)` rather than the door, and the three `Config` fields are in `server.go`. - ✅ **Record block is additive**, wire names as briefed, purge guard test present. - ❌ **"Only a CreateBucket that returned success earns Minted" is not held on a custom endpoint**: `internal/objstore/aws.go:321` (Important 1). - ⚠️ **Cannot verify**: that every caller holds the walk lock (Task 5), and the SDK-free link claim for plan 3 (concern 1). I ran no tests; this is from reading the diff and the surrounding walk code. ### Strengths - **Fail-closed direction throughout.** Every ambiguous outcome costs one verification and never a wrong mint. - **The us-east-1 quirk is handled at the provider**, with a table test covering all six shapes. - **`TestVerifyTable` is well built.** Each failing case also fails every later check, so removing any one of the eight checks changes the answer and fails a case. - **`LifecycleRule.Other`** stops a foreign rule with unmodelled settings from hashing equal to the platform's own. - **Apps that don't use media see no behaviour change.** - `EnsureBucket` delegates to the same code. - The healthy short-circuit still returns before step 3. - `FailNext["EnsureBucket"]` still hits the bucket step. - The only visible difference is an extra `conversion` key on newly minted records. - **Record races are covered.** The step-6 retry carries only this walk's own block and leaves a competitor's in place. No writer builds a `Record` that would drop `Conversion`: the two `&objstore.Record{}` literals are for absent records only. ### Issues **Critical:** none. **Important** 1. **`internal/objstore/aws.go:306-322`: a custom endpoint can mint.** - **What:** `created` is true for any success outside us-east-1, but `awsProvisioner` does not remember whether `CARLOS_STORE_ENDPOINT` was set (`cmd/console/main.go:1159-1163` passes it through). - **Why it matters:** an S3-compatible backend that answers 200 to an owner re-creating a bucket would mark a pre-existing bucket Minted, and a minted store is never inspected. This is the implementer's concern 2, and it is real. - **Fix:** store the endpoint (or a `realAWS` flag) on `awsProvisioner`, answer `created` only when it is empty, and add a table row. Don't rely on plan 3's boot refusals: the mint happens at grant time whether or not conversion is on. 2. **`internal/objstore/walk.go:283`: the `rec.Grant == nil` conjunct has no test.** - **What:** it is what stops this sequence: a first grant adopts the minted name and fails at `EnsureUser` (grant block written, no bucket yet); the re-run has no adopt argument, really does create the bucket, and would mint an adopted store. - **Why it matters:** the spec says an adopted name never mints. Every `TestRerunAfterCreateIsNotMinted` case creates the bucket in the first run, so `MemProvisioner` answers `created == false` regardless. The report's mutation (`minting := true`) only exercised the adopt conjunct. - **Fix:** add that exact case: adopt the minted name, `FailNext["EnsureUser"]`, re-run with `adopt == ""`, assert no `Conversion`. 3. **`internal/console/mediastore.go:64-69`: the `name` check's wiring has no console test.** - **What:** every console test uses a minted-name store, so passing `MintedName: bucket` would pass them all and let any adopted bucket verify. - **Why it matters:** §5.2's acceptance line names "a store adopted under the minted name" and adopted stores generally; only `storecfg`'s unit table covers the check. - **Fix:** one console test granting with an adopted non-minted bucket whose facts are otherwise good, asserting `store_unverified` / `name` and an unchanged record. **Minor** 4. **`internal/storecfg/storecfg.go:19` (concern 1): `storecfg` links the AWS SDK through `objstore`.** Plan 3's `TestCoreLinksNoCloudSDK` will fail. A third option beyond the implementer's two is to give `Want` two strings (`LifecycleHash`, `CORSHash`) instead of `*objstore.Uploads`. That makes `storecfg` stdlib-only and moves nothing into the root census. It changes the briefed `Want` shape, so the controller should rule before Task 9 consumes it. 5. **`internal/objstore/walk.go:356-363`: a stale `Minted` can outlive its bucket.** Teardown deletes the bucket before the record (`walk.go:898`). If it crashes in between and someone with account access makes a bucket by hand under that name, a re-grant keeps `Minted: true`. This needs deployment-account access, so it is outside the tenant threat model; a comment or an A-note in the spec is enough. 6. **`internal/console/mediastore.go:84-87` (deviation 5): a lost CAS answers 500 with no retry.** Acceptable under the walk lock. If Task 5 sees these in practice, one re-read and retry is cheap. 7. **`internal/storecfg/storecfg.go:191`: `want.MintedName == ""` is redundant** unless `Bucket` is also empty, and no test covers both empty. Harmless. **Other concerns judged** - Deviations 1, 3, 4, 6 and 7 are sound. Deviation 1 is required by the spec, per issue 2. On deviation 4, `CARLOS_STORE_REGION` is mandatory at boot, so `Provisioned.Region` is never empty. - Concern 3 (no production path mints in host-claim mode) is as designed. - Concern 4 (the lock is an unchecked precondition) is fine for this task; Task 5's caller and the F24-style guard own it. ### Assessment **Task quality:** Needs fixes. The design and code are careful and I found no way for a bucket the platform didn't create to mint or verify on real AWS. For a security gate, though, the custom-endpoint mint should be closed in code, and the two conjuncts that carry the "adopted never mints / adopted never verifies" rule need tests that fail when they are removed. All three fixes are small.</result> <usage><subagent_tokens>119454</subagent_tokens><tool_uses>9</tool_uses><duration_ms>151417</duration_ms></usage> </task-notification>
<task-notification> <task-id>bn7qwtjbl</task-id> <tool-use-id>toolu_01Xkk44GM7j49XD2i2sW8A4t</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/bn7qwtjbl.output</output-file> <status>completed</status> <summary>Background command "Run Astra review of Task 3" completed (exit code 0)</summary> </task-notification>