carlos / platform Public

plans: Astra round 1 findings on media conversion plans, unedited

11 P1, 5 P2; all three plans revise.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 4dd1125b7063c2cd3c125f36f7b45aeb49eac306 parent 719e234
1 file changed, +87 −0
  • docs/superpowers/plans/CODEX-FINDINGS-MEDIA-PLANS.md +87 −0

CI cancelled — superseded by a newer push — run details

Intent

Human

<task-notification> <task-id>bqv1aq0kf</task-id> <tool-use-id>toolu_01RgqhUqGaxFxFFuRS5BhVav</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/bqv1aq0kf.output</output-file> <status>completed</status> <summary>Background command "Run Astra review of the three plans, round 1" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 9.47 g CO₂e (1,130,276 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-video-conversion, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/plans/CODEX-FINDINGS-MEDIA-PLANS.md b/docs/superpowers/plans/CODEX-FINDINGS-MEDIA-PLANS.md
new file mode 100644
index 000000000..a525fda43
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-MEDIA-PLANS.md
@@ -0,0 +1,87 @@
+Round 1 of 3, reviewing `99398b7d` against approved spec revision 8. HEAD adds only the review brief. No files changed.
+
+1. **P1 — Plans 1 and 3: endpoint activation tests can pass without proving isolation.**
+ **Invariant:** foreign credentials cannot use any of the four endpoints.
+ Plan 1 creates a foreign user with **no permissions** ([Task 1:40](./docs/superpowers/plans/2026-11-16-media-conversion-plan-1-spike.md#L40)); plan 3’s drill accepts four 403 responses ([Task 7:160](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L160)). Those requests can fail even with permissive endpoint policies. Moreover, [R2:301](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L301) enables conversion before R3 proves the activation gates.
+ **Smallest fix:** include otherwise-authorized foreign requests and a positive control with the endpoint restriction neutralised, within the scoped approval. Complete the gates before enabling the door.
+
+2. **P1 — Plan 1, Task 6: the expiry drill cannot reach its expected result.**
+ **Invariant:** separately prove grant-expiry handling and the independent deadline.
+ [Line 91](./docs/superpowers/plans/2026-11-16-media-conversion-plan-1-spike.md#L91) pauses until grant expiry plus 60 seconds and expects codec exit 75. The deadline container must stop the task by grant expiry, as already tested at [line 73](./docs/superpowers/plans/2026-11-16-media-conversion-plan-1-spike.md#L73). The reconnect therefore never runs.
+ **Smallest fix:** use an explicitly scoped diagnostic configuration to exercise the expired transfer independently, and retain a separate production-shape deadline test.
+
+3. **P1 — Plan 2, Task 3: `Minted` records intent rather than proven creation.**
+ **Invariant:** provenance establishes that this deployment created the bucket.
+ [Line 343](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L343) sets `Minted` in the first grant write when `adoptBucket == ""`. That precedes bucket creation, and existing [`EnsureBucket`](./internal/objstore/aws.go#L293) also succeeds on `BucketAlreadyOwnedByYou`. A pre-existing bucket under the minted name can therefore bypass verification.
+ **Smallest fix:** distinguish newly created from already-existing buckets. Only proven creation earns `Minted`; existing or ambiguous cases must pass verification. Test a pre-existing SSE-KMS or foreign-policy bucket without `adoptBucket`.
+
+4. **P1 — Plan 2, Task 9: enabling uploads can overwrite foreign configuration.**
+ **Invariant:** never replace CORS or lifecycle configuration the platform did not write.
+ [Line 467](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L467) calls `mediaStoreEligible`, then unconditionally `PutUploads`. But eligibility immediately accepts minted or previously verified stores ([line 350](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L350)). Foreign rules added after verification are overwritten.
+ **Smallest fix:** inspect current CORS and lifecycle immediately before every enable/update, and refuse any unowned configuration. Test both minted stores and configuration changed after verification.
+
+5. **P1 — Plan 2, Tasks 2 and 5: task-definition validation is missing from dispatch.**
+ **Invariant:** every execution uses a validated task-definition revision.
+ The POST path checks `CheckRevision` ([line 386](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L386)); neither dispatch nor launch requires it ([lines 308–309](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L308)). A queued job surviving a console restart can launch against a newly configured, unsafe revision without another POST.
+ **Smallest fix:** validate the actual selected revision before dispatch reserves or launches work. Add a queued-job/restart witness whose new revision lacks the deadline dependency.
+
+6. **P1 — Plan 2, Tasks 1 and 2: untrusted result durations can break the allowance.**
+ **Invariant:** settlement cannot create negative charges or exceed its reservation.
+ `ParseResult` requires `Source` but places no bound on `DurationMS` ([line 188](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L188)); tracking copies it directly into billing ([line 311](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L311)). A compromised codec can return a negative duration or one above its grant. The simulation excludes this by generating only durations within the grant ([line 268](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L268)).
+ **Smallest fix:** validate duration against the dispatched row’s grant before accepting success, with overflow-safe arithmetic. Add hostile-result witnesses. This preserves the approved duration-based charging policy.
+
+7. **P1 — Plan 2, Task 2: the prescribed transaction guards do not implement the lifecycle.**
+ **Invariant:** transitions preserve settlement and retirement obligations.
+ [Line 307](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L307) requires `settled = 0` on every transition. Cleanup must update settled rows, and retirement must also affect completed rows ([lines 313–315](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L313)). Those updates would match nothing. Conversely, success settlement lacks a transactional `retired_at = 0` condition: retirement during result/HEAD reads can still be followed by `done`.
+ **Smallest fix:** specify predicates per transition, including retirement checks in the success transaction. Test cleanup of settled rows and retirement paused between result validation and commit.
+
+8. **P1 — Plans 2 and 3: compacting transfers invalidates SDK signatures.**
+ **Invariant:** reconstruct exactly the request that was signed.
+ Plan 2 removes the URL query and reconstructs only seven `X-Amz-*` parameters ([lines 125–143](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L125)); plan 3 applies that encoding to SDK presigned URLs ([line 199](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L199)). The pinned S3 SDK also signs `x-id=PutObject`/`GetObject`; its own [presign test](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2/service/s3@v1.105.0/internal/customizations/presign_test.go:35) explicitly expects that query parameter. Dropping it changes the signature.
+ **Smallest fix:** preserve all remaining signed query parameters, or remove them before signing. Test SDK URL → compact payload → reconstructed request against MinIO.
+
+9. **P1 — Plan 3, Tasks 2, 8, 11 and 13: scratch storage is not usable as specified.**
+ **Invariant:** each execution has a writable, isolated scratch directory.
+ The image creates `/scratch` as `0755`, runs as UID 65534, and mounts an unconfigured scratch volume ([line 178](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L178), [line 235](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L235)). ECS bind mounts default to root ownership and `0755`, so the codec cannot create its directories. Separately, the local runner sets only `TMPDIR` ([line 271](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L271)), while the codec uses `/scratch` ([line 66](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L66)).
+ **Smallest fix:** define and verify writable volume ownership for UID 65534; pass the local runner’s scratch path explicitly through the handler and argument builders. See [https://docs.aws.amazon.com/AmazonECS/latest/developerguide/bind-mounts.html](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/bind-mounts.html).
+
+10. **P1 — Plan 3, Task 4: the muxer arguments and MP4 parser disagree.**
+ **Invariant:** both presets produce playable four-second fragments accepted by the parser.
+ [Line 100](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L100) accepts only `ftyp`, `moov`, then `moof`/`mdat` pairs. The prescribed muxer flags do not suppress the fragmented-file trailer. Audio also reuses `frag_keyframe` plus `min_frag_duration`, which supplies no audio fragmentation trigger ([lines 101–103](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L101)).
+ **Smallest fix:** support the emitted trailer or request `skip_trailer`; explicitly set audio fragment duration. Verify actual Debian-generated fixtures. FFmpeg documents these distinctions at [https://ffmpeg.org/ffmpeg-formats.html](https://ffmpeg.org/ffmpeg-formats.html).
+
+11. **P1 — Plan 3, Tasks 4 and 5: required test answers contradict the formulas.**
+ **Invariant:** tests enforce the specified geometry and peak ceiling.
+ `TestGainTable` expects **+12.5 dB** for I = −30, TP = −3 ([line 121](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L121)); the specified formula gives **+1 dB**. Following the expected answer violates the peak ceiling. Likewise, `targetSize` produces `1278×720` for `1281×721`, and `426×1280` for `1000×3000`, contrary to [line 105](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L105).
+ **Smallest fix:** correct those three expected values. The prescribed formulas and tests cannot both pass.
+
+12. **P2 — Plan 2, Task 5: host-claim exclusion is an additional product restriction.**
+ **Invariant:** honour the approved eligibility scope.
+ [Line 25](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L25) excludes host-claim consoles. Neither G1 nor decision 10 includes that exception; they promise conversion to every eligible app with a store and Service credential.
+ **Smallest fix:** plan claim-compatible table, route and worker gates rather than treating blanket refusal as an already-approved interpretation.
+
+13. **P2 — Plans 1 and 3: “no `AWS_*` variable” rejects ordinary Fargate metadata.**
+ **Invariant:** detect credentials, not harmless execution metadata.
+ [Plan 1, Task 4:65](./docs/superpowers/plans/2026-11-16-media-conversion-plan-1-spike.md#L65) and [plan 3, Task 7:160](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L160) require no `AWS_*` variables. ECS supplies `AWS_EXECUTION_ENV` and region variables.
+ **Smallest fix:** test credential-bearing variables and endpoints explicitly. See [https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-environment-variables.html](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-environment-variables.html).
+
+14. **P2 — Plan 3, Tasks 9 and 11: missing-source classification cannot work with the stated permissions.**
+ **Invariant:** distinguish absent sources from unreadable sources.
+ `Head` maps 404 to `ErrNotFound`, but its session and conversion role have only `GetObject`, without `ListBucket` ([line 199](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L199), [line 235](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L235)). S3 returns 403 for absent objects in that case.
+ **Smallest fix:** specify an existence check using the console’s existing bucket-list authority while preserving the conversion-role read denial. Test against AWS semantics, not only a stubbed 404. See [https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html).
+
+15. **P2 — Plan 2, Task 2: oversized results are retried as transient failures.**
+ **Invariant:** malformed results settle without retaining capacity indefinitely.
+ [Line 311](./docs/superpowers/plans/2026-11-16-media-conversion-plan-2-console.md#L311) retries every result-read error except `ErrNotFound`, including the explicitly declared `ErrResultTooLarge`. A permanently oversized result keeps a stopped execution reserved until ECS retention expires, then changes its charge to the unknown-task bound.
+ **Smallest fix:** treat `ErrResultTooLarge` as terminal invalid output, settle using the available ECS runtime, and clean up. Add a tracking test.
+
+16. **P2 — Plan 3, Tasks 3 and 13: termination work lacks its required task review.**
+ **Invariant:** review sizing follows stopping rule 3.
+ Task 3 implements descendant killing ([line 83](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L83)); Task 13 implements independent deadline termination ([line 271](./docs/superpowers/plans/2026-11-16-media-conversion-plan-3-engine.md#L271)). Neither is marked for its own review.
+ **Smallest fix:** mark both termination implementations for the required review, within the existing round budget.
+
+The other reported interpretations match the approved spec: successful jobs charge result-reported duration, subject to finding 6; unrecoverable dispatch-before-launch crashes charge the full bound; capacity classes span both presets; and the door checks settled charges while dispatch accounts for reservations.
+
+**Plan 1: revise.**
+**Plan 2: revise.**
+**Plan 3: revise.**
\ No newline at end of file