carlos / platform Public

spec: video conversion A8, cleanup is final

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 064bd1989514677b59b03e1098c56bbeda05cff8 parent 522612c
1 file changed, +43 −0
  • docs/superpowers/specs/2026-11-16-video-conversion-design.md +43 −0
diff --git a/docs/superpowers/specs/2026-11-16-video-conversion-design.md b/docs/superpowers/specs/2026-11-16-video-conversion-design.md
index 6e8ffdbff..c9fc7c14f 100644
--- a/docs/superpowers/specs/2026-11-16-video-conversion-design.md
+++ b/docs/superpowers/specs/2026-11-16-video-conversion-design.md
@@ -1077,6 +1077,49 @@ the outputs. Store destroy gains the refusal of §5.3.
35 s after its last container dies, so a charge read from `stoppedAt`
can pass a row's full bound by that much; that is plan 2's to settle,
not this amendment's.
+- **A8, cleanup is final** (dev drills R4, findings F1 and F2:
+ `docs/superpowers/reviews/2026-11-16-media-conversion-dev-drills.md` on
+ branch `media-conversion-dev-drills`). The deployment bucket is
+ versioned. A plain delete of `media-results/<execution>.json` only puts
+ a delete marker on top, so every result lived on as a noncurrent version
+ (F2). A create-only PUT succeeds over a delete marker, so a result
+ transfer read from a stopped task's overrides recreated the object after
+ cleanup, at any size, and nothing removed it (F1). §5.3's "cleanup runs
+ only after the task is confirmed stopped, so nothing is still writing"
+ overlooked the transfers, which outlive the task. Three rules override
+ §5.3 and §5.4 where they differ. The invariant they serve: once cleanup
+ has deleted a result object or an output, nothing can create it again.
+ - **Cleanup waits for the grant.** A row whose task stopped is cleaned
+ at the later of when the stop is seen and its grant bound,
+ `dispatched_at` + `GrantLifetime` + `GrantMintSlack`. Launch already
+ refuses a grant that expires after that bound, so from it every
+ transfer of the execution is refused. `engine_lost` rows already used
+ it. A result or a failed row's outputs therefore stay up to about
+ 65 minutes after the job ends. The result PUT's own expiry is not
+ shortened: all five transfers share one `X-Amz-Expires` in the
+ payload, and the codec and the `deadline` container read one expiry,
+ so a separate expiry needs a payload version. It would not close the
+ gap either: a task that ends early would still leave its transfer
+ live until that expiry.
+ - **Cleanup deletes every version.** The console lists the result key's
+ versions with the exact key as the prefix, and deletes by version id
+ every version and delete marker whose key is exactly that key. Its
+ role gains `s3:ListBucketVersions` on the deployment bucket, held to
+ `s3:prefix` `media-results/*`, and `s3:DeleteObjectVersion` on
+ `media-results/*` only (`infra/modules/media-engine`, the console's
+ customer-managed policy).
+ - **A lifecycle backstop.** The deployment bucket expires every object
+ under `media-results/` a day after it is written, each noncurrent
+ version a day after it becomes noncurrent, and expired delete markers
+ (`infra/modules/deployment-buckets`). The console reads a result only
+ while ECS still has the stopped task's record, which is well under a
+ day. The rules catch what no cleanup reaches. One such case remains: a
+ task that was created and never started is settled with no cleanup
+ (§5.3 "never started"), yet its overrides held live transfers until
+ the grant expired. A result written through one lasts until these
+ rules remove it, at most two days. An output written through one
+ stays in the tenant's bucket under that execution's prefix, where no
+ rule of ours reaches.
## 12. Decisions for Paul