spec: video conversion revision 4, one Fargate task per execution
Paul's ruling R-F supersedes R-L: each execution is its own ECS Fargate task (arm64, no task role, own small VPC with an S3 gateway endpoint, registry and logs endpoints and a DNS allow-list). Closes Astra round 3: R3-1 and R3-2 by R-F, R3-3 by counting tasks not yet confirmed stopped, R3-4 by store-incarnation keys and destroy waiting for every task to stop. One retry for a task that never started.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/2026-11-16-video-conversion-design.md+310 −292
Intent
Fargate seems fine. A, with a narrow fourth round
<task-notification> <task-id>ad8a1b25ebf69fbf7</task-id> <tool-use-id>toolu_01Gk4zfTgUAcG2WGzsv9QKpo</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/ad8a1b25ebf69fbf7.output</output-file> <status>completed</status> <summary>Agent "Fable drafts video conversion design" 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>Revision 4 is written in place and uncommitted: 716 lines, so I missed the under-698 aim. The Fargate tracking rows and two new invariants added more than the Lambda text removed, and I left the stable sections alone as you asked. ## How each round-3 finding is closed - **R3-1 (runtime-protocol takeover):** closed by R-F. A Fargate task has no runtime API and is never handed a second execution. The isolation claim cites AWS's Fargate security page and is marked to confirm in the spike. - **R3-2 (function credentials and DNS exfiltration):** closed by R-F. The task definition has no task role, so the container has no credentials. A DNS Firewall allow-list permits only the S3, registry and logs names. What a compromised codec can still leak is this job's source and its transfers, which expire. - **R3-3 (capacity released early):** the dispatch cap counts rows with a dispatched execution whose task ECS has not confirmed stopped, whatever their state. It is a `task_stopped` flag in the same row and a new invariant. - **R3-4 (store destroy):** destroy retires the store's rows under the store walk lock, calls `StopTask`, and is refused until every row's task has stopped. Jobs are keyed to a random store incarnation id recorded with the provenance, so a recreated store never inherits old rows. Admission and dispatch take the same lock, and destroy/recreate is in the simulation. I verified R3-4's citation of the store-destroy door (`appsettings.go:1629`) and the walk lock (`storelock.go:9`). None declined. ## Calls of mine you should know about - **The engine gets its own small VPC, not the console's.** This departs from R-F's wording. DNS Firewall rules apply to a whole VPC, so putting one on the console's VPC would filter the console's own lookups, and the console never connects to a task anyway. It is decision 2. - **The result comes back as an object in the deployment bucket**, at `media-results/<execution id>.json`, through a fifth presigned PUT. I chose this over the console only HEADing outputs because the console needs the source duration for the plan charge. I chose it over a file in the tenant's bucket because an app could race its own job and forge a short duration there. - **One automatic retry for a task that never started** (no capacity, failed pull) is in: it adds a counter and no obligation. A task that ran and failed is never retried. A console restart no longer loses jobs, so the old "no retry" decision is dropped. - **The S3 endpoint policy must also admit the registry's layer bucket**, or the image pull fails. - **Timings:** handler budget 10 minutes, hard deadline 15 minutes after dispatch (the console calls `StopTask`), grant 20 minutes. A task ECS no longer knows is charged the full 15 minutes. - **Fixed cost is about 24 dollars a month** with the logs endpoint, about 16 without, against your figure of about 15. I kept logs so operators can see why a task failed. ## Unverified, marked in the text for the spike - **Fargate isolation and non-reuse.** - **No credentials in the container:** nothing reachable from the credentials endpoint, the task metadata endpoint or the instance metadata address. - **`RunTask` idempotency token:** the row-to-task mapping after a crash relies on it and on `startedBy`. - **The 8,192-character override limit:** five presigned URLs with session tokens could exceed it, so the payload sends the token, bucket and prefix once. The builder must prove the longest admitted key fits. - **Stopped-task records:** that ECS keeps them for about an hour. - **Fargate prices.** ## Decisions for Paul 1. **The spike:** real clips from Paul; scoped approval for a dev ECS cluster and task definition, image repository, the engine VPC with its endpoints and DNS rule, and the conversion role; the isolation and credential checks; Safari checks on a real iPhone or the tito-studio Mac. Recommended as the first task. 2. **The engine's network (new):** a small VPC of its own with a DNS allow-list (recommended), or a private subnet of the console's VPC with no DNS rule. 3. **No wait for stage 1** (moves ruling 11, narrows ruling 6): ship on the app's own bucket and serving (recommended), or wait for `kind:media`. 4. **Authority:** a conversion role assumed per execution that always refuses infected sources, even with enforcement off (recommended), or the console's own role presigning. 5. **Admission caps:** 180 s, 512 MiB, 4K, 60 fps (recommended, if the spike shows it fits the budget); or 300 s and 1 GiB; or 60 s and 200 MB. 6. **Plan values:** `media_minutes_month` at Free 30, Personal 600, Community 1,200, Business 12,000, refused at twice the limit, no media pack (recommended); or no cap until usage is measured. 7. **Browser uploads in scope** as `carlos store uploads`, a member verb (recommended), or native clients only for now. 8. **Always re-encode, HDR tone-mapped, one JPEG poster** (recommended), or add the roadmap's remux path. 9. **On for every app** with a store and a Service credential (recommended), or a per-app switch. 10. **Codec licences:** accept encoding H.264 and AAC with Debian's ffmpeg, or have it checked before flagship. A question, no recommendation.</result> <usage><subagent_tokens>295533</subagent_tokens><tool_uses>7</tool_uses><duration_ms>336681</duration_ms></usage> </task-notification>
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 4bc73f969..a49c564d6 100644 |
| --- a/docs/superpowers/specs/2026-11-16-video-conversion-design.md |
| +++ b/docs/superpowers/specs/2026-11-16-video-conversion-design.md |
| @@ -1,17 +1,18 @@ |
| # Video conversion: a phone clip in, a playable video out |
| -**Date:** 2026-11-16, revision 3 (two rulings by Paul and Astra round 2, §13) |
| -**Status:** draft for the last review round. Not approved. |
| +**Date:** 2026-11-16, revision 4 (Paul's ruling R-F after Astra round 3, §13) |
| +**Status:** draft for a final, narrow review of the Fargate change. Not |
| +approved. |
| **Asked for by:** Paul, 2026-11-16. Rulings: amadan discussion 1120. |
| **Builds on:** the PDF service's door, credential, plan cap and fair-use |
| shape (`2026-11-02-pdf-service-design.md`). |
| **Amends:** the media roadmap (`2026-09-07-media-platform-roadmap-design.md`), |
| stage 3's first product and part of stage 5. See §11. |
| -**Review budget:** AGENTS.md "Stopping rules". Three cross-model rounds at |
| -most. Round 3 is the last. |
| +**Review budget:** AGENTS.md "Stopping rules". The three rounds are spent; |
| +round 4 covers only the Fargate change and the round-3 fixes. |
| -Marks: **(paul R-L)**, **(paul R-C)** Paul's rulings; **(astra R2-N)** a |
| -round-2 finding; **(my call)** the author's, cheap to overturn; |
| +Marks: **(paul R-F)**, **(paul R-C)** Paul's rulings; **(astra R3-N)** a |
| +round-3 finding; **(my call)** the author's, cheap to overturn; |
| **(estimate)** not measured; **(unverified)** not checked against a source |
| in this tree. |
| @@ -41,9 +42,8 @@ bucket. Nothing here is specific to it. |
| - G3. The source goes app to store directly, and browser uploads work (§5.6). |
| - G4. Bad input is refused up front with a named error: at the door when the |
| door can know, at the probe otherwise. |
| -- G5. A plan cap and fair use from the first job. |
| -- G6. Nothing runs, and nothing costs, while no clip is being converted |
| - **(paul R-L)**. |
| +- G5. A plan cap and fair use from the first job, and no engine running while |
| + no clip is being converted **(paul R-F)**. |
| **Non-goals** |
| @@ -51,18 +51,14 @@ bucket. Nothing here is specific to it. |
| users encrypt client-side convert on the device. Ciphertext fails the probe |
| as `unsupported_container`. |
| - **Cancel, delete, retry and re-encode (paul R-C).** The door is POST and |
| - GET. An app that no longer wants a result ignores it. One source, one |
| - preset, one execution, ever. |
| + GET. An app that no longer wants a result ignores it. |
| - A ladder, AV1 output, DASH, captions, DRM, live, audio-only inputs, serving |
| (the roadmap's stage 1), callbacks, environment stores, a client library, |
| and stores of unknown provenance (§5.2). |
| -**Anti-goals** |
| - |
| -- An engine with authority over tenant buckets. |
| -- Conversion of an object the scanner has tagged infected. |
| -- A free account turning the platform into an encode farm. |
| -- Job state in more than one place **(paul R-C)**. |
| +**Anti-goals:** an engine with authority over tenant buckets; conversion of an |
| +object the scanner has tagged infected; a free account turning the platform |
| +into an encode farm; job state in more than one place **(paul R-C)**. |
| ## 3. Where things stand on `main` (15b1ee6b) |
| @@ -98,15 +94,14 @@ bucket. Nothing here is specific to it. |
| Paul chose a platform engine over conversion on the device (kept for encrypted |
| media) and conversion at the edge (minutes of CPU on the box that terminates |
| -every tenant's TLS). Two rulings on 2026-11-16 shape this revision: |
| +every tenant's TLS). Two rulings of 2026-11-16 stand: |
| -- **R-L: the engine is a Lambda function, not a standing box.** Usage will be |
| - low, and a box that sleeps is what Lambda is. Revision 2's engine box, |
| - agent, slots, per-slot filesystems and helper unit are gone. |
| -- **R-C (stopping rule 2): cut and centralise the lifecycle.** Cancel, delete |
| - and requeue are cut, and the lifecycle is one row per job in the console's |
| - database. Revision 2's bucket job records, queue markers, attempts list and |
| - `result.json` are gone. |
| +- **R-F: the engine is one ECS Fargate task per execution.** It supersedes |
| + R-L (Lambda), which round 3 showed could not keep a compromised codec away |
| + from the runtime protocol and the function's credentials. A Fargate task is |
| + not reused, has no runtime API, and can run with no credentials at all. |
| +- **R-C (stopping rule 2): one place for the lifecycle.** No cancel, delete or |
| + requeue; one row per job in the console's database. |
| ## 5. The design |
| @@ -152,12 +147,12 @@ POST takes strict JSON, `{"key": "uploads/a1b2.mov"}`, with an optional |
| | Check | Refusal | |
| |---|---| |
| -| no engine configured (`CARLOS_MEDIA_FUNCTION`) | 503 `not_configured` | |
| +| no engine configured (`CARLOS_MEDIA_ENGINE`) | 503 `not_configured` | |
| | key empty, over 512 bytes, control characters, or under `derived/` | 400 `bad_key` | |
| | unknown preset | 400 `unknown_preset` | |
| | no provisioned default store | 409 `no_store` | |
| | store provenance not established (below) | 409 `store_unverified` | |
| -| store region is not the function's region | 409 `no_engine_in_region` | |
| +| store region is not the engine's region | 409 `no_engine_in_region` | |
| | store record has `writes_denied` | 402 `store_writes_denied` | |
| | HEAD of the key: absent | 404 `source_not_found` | |
| | HEAD of the key: denied (an infected verdict lands here, §5.4) | 409 `source_unreadable` | |
| @@ -165,81 +160,92 @@ POST takes strict JSON, `{"key": "uploads/a1b2.mov"}`, with an optional |
| | plan cap (§7.3) | 402 from `capCopy` | |
| | fair use or engine-time budget (§7.2) | 429 or 503 with `Retry-After` | |
| -A passing request inserts the job row and answers 202 with the job. |
| +A passing request inserts the job row and answers 202 with the job. The store |
| +checks and the insert run under the app's store walk lock |
| +(`internal/console/storelock.go:9`), so they cannot interleave with a store |
| +teardown **(astra R3-4)**. |
| -**The job id** is the first 32 hex characters of `sha256("v1\0" + key + "\0" + |
| -etag + "\0" + preset)`, unique within one app. A repeat POST answers 200 with |
| -the existing job, whatever its state, and starts nothing. A `failed` job stays |
| -failed; the remedy for the one failure that is not about the bytes |
| -(`engine_lost`, §5.3) is to upload again under a new key (decision 9). |
| +**The job id** is the first 32 hex characters of the SHA-256 of `"v1"`, the |
| +key, the ETag and the preset, each followed by a zero byte. A job belongs to one **store incarnation** (below), |
| +so the door looks rows up by account, app, incarnation and job id. A repeat |
| +POST answers 200 with the existing job, whatever its state, and starts |
| +nothing. A `failed` job stays failed. |
| **GET** answers the job: `id`, `state` (`queued`, `running`, `done`, |
| `failed`), `error` (`code`, `message`), and on `done` the source's duration, |
| dimensions and codecs, the ffmpeg version, and each output's key, size, ETag, |
| content type and dimensions. |
| -**Store provenance (astra R2-6).** Conversion relies on properties of the |
| +**Store provenance and incarnation.** Conversion relies on properties of the |
| bucket, so eligibility is established, never inferred from its name. |
| - A store whose bucket this deployment's walk itself created records that in |
| its store record at creation. An adopted name never does. |
| - Any other store qualifies through a one-time verification the door runs on |
| - first use and records in the store record. It checks that the bucket has the |
| - name the platform would mint, is owned by the deployment's account, is in |
| - the store region, uses SSE-S3 and not SSE-KMS, has versioning off, and has |
| - no bucket policy, lifecycle or CORS configuration the platform did not |
| - write. |
| -- A store that fails is refused with `store_unverified` and the failing check. |
| - The verification is repeated on the next submission, so fixing the bucket is |
| - enough. |
| + first use and records. It checks that the bucket has the name the platform |
| + would mint, is owned by the deployment's account, is in the store region, |
| + uses SSE-S3 and not SSE-KMS, has versioning off, and has no bucket policy, |
| + lifecycle or CORS configuration the platform did not write. |
| +- Either record carries a random **incarnation id**, minted with it. Teardown |
| + removes the store record, so a recreated store has a new one and never |
| + inherits an old store's rows **(astra R3-4)**. |
| +- A store that fails is refused `store_unverified` with the failing check, and |
| + is verified again on the next submission. |
| ### 5.3 The job row: the one place the lifecycle lives (paul R-C) |
| A console table `media_jobs`, one row per job, changed only in database |
| -transactions. It holds: account, app, job id, key, etag, bytes, preset, |
| -bucket, `state`, `execution_id`, `started_at`, `reserved_ms`, `charged_ms`, |
| -`settled`, `source_ms`, `result`, `error`, `cleanup_due`, `retired_at`. There |
| -are no bucket records and no queue markers **(closes astra R2-2)**. |
| +transactions. It holds: account, app, store incarnation, job id, key, etag, |
| +bytes, preset, bucket, `state`, `execution_id`, `task_arn`, `dispatched_at`, |
| +`task_stopped`, `start_failures`, `charged_ms`, `settled`, `source_ms`, |
| +`result`, `error`, `cleanup_due`, `retired_at`. |
| **Transitions.** Each is one transaction. |
| | Step | From | To | |
| |---|---|---| |
| | submit | no row | `queued` | |
| -| dispatch | `queued` | `running`; `execution_id` is 128 new random bits; `reserved_ms` is the function timeout | |
| -| return, success | `running`, same `execution_id` | `done`; `charged_ms` is the measured invoke time; `settled` | |
| -| return, failure | `running`, same `execution_id` | `failed`; `charged_ms` measured; `settled`; `cleanup_due = started_at + 1 h` | |
| -| lost | `running` | `failed` (`engine_lost`); `charged_ms = reserved_ms`; `settled`; `cleanup_due = started_at + 1 h` | |
| -| cleanup | `cleanup_due` reached | the execution's three keys deleted, then `cleanup_due` cleared | |
| -| retire | any, on app purge or account deletion | `retired_at` set; a `queued` row fails uncharged; a `running` row is settled as lost | |
| - |
| -- **Dispatch** is done by a console pass: the oldest `queued` row of the |
| - account served least recently, within the concurrency limits (§7.2). After |
| - the transaction it re-checks the store record, mints the grant (§5.4) and |
| - invokes the function synchronously (§5.5). The return value is the result; |
| - there is no callback and no poll of the engine. |
| -- **Return, success.** The console HEADs the three outputs against the sizes |
| - the function reported, then commits. If the row is no longer `running` with |
| - this execution id, the result is dropped. |
| -- **Lost.** An invoke that returns a transport or service error, and every row |
| - found `running` when the console starts, is lost. The console cannot know |
| - how long the function ran, so it charges the whole timeout. Lambda ends the |
| - function at that timeout, so the charge is never too small **(closes astra |
| - R2-4)**. |
| -- **Cleanup.** A failed or lost execution may have written some outputs. One |
| - hour after it started, the function is long dead and its transfers have |
| - expired, so one deletion with the console role's existing `DeleteObject` is |
| - complete. The obligation is the non-null `cleanup_due`; it stays until the |
| - deletion succeeds or the bucket is gone **(closes astra R2-5)**. |
| -- **Retire.** The console's app purge and account deletion call it in their |
| - own transaction, and the pass applies it to any open row whose app it finds |
| - gone. Retired rows are invisible to the door, so a recreated app of the same |
| - name starts clean, but they are kept until settled and cleaned **(closes |
| - astra R2-3)**. |
| -- **Pruning.** A row is deleted only when it is settled, its cleanup is done, |
| - and it is either retired or `failed`, 90 days after it ended. `done` rows of |
| - a live app are kept: they are the registry of what was converted, and a |
| - future stage-1 fence must read them. |
| +| dispatch | `queued` | `running`; a new random `execution_id`; `dispatched_at`; `task_stopped` false | |
| +| task recorded | `running` | `task_arn` set | |
| +| never started | `running`, ECS says stopped with no start time | `task_stopped`; back to `queued` uncharged, or after a second time `failed` (`engine_unavailable`), settled, uncharged | |
| +| stopped, success | `running`, exit 0, result read, outputs checked, not retired | `done`; `charged_ms` from ECS; `settled`; `task_stopped`; `cleanup_due` now | |
| +| stopped, failure | `running`, any other stop | `failed`; `charged_ms` from ECS; `settled`; `task_stopped`; `cleanup_due` now | |
| +| unknown | `running`, ECS has no such task after the hard deadline | `failed` (`engine_lost`); `charged_ms` 15 min; `settled`; `task_stopped`; `cleanup_due = dispatched_at + 1 h` | |
| +| cleanup | `cleanup_due` reached | the result object deleted, and the three outputs unless the row is `done`; `cleanup_due` cleared | |
| +| retire | any row of an app, account or store being removed | `retired_at` set; a `queued` row becomes `failed` uncharged; a `running` row's task is stopped and the row settles by the rows above | |
| + |
| +- **Dispatch** is a console pass: the oldest `queued` row of the account |
| + served least recently, within the limits of §7.2. Under the store walk lock |
| + it re-checks the store record and incarnation and commits the transition. |
| + Then it mints the grant (§5.4) and calls `RunTask` with the execution id as |
| + the idempotency token and the `startedBy` value, and records the task ARN. |
| +- **Tracking (paul R-F).** The pass reads every row with `task_stopped` false |
| + from ECS by task ARN, or by `startedBy` when a crash left no ARN. ECS is the |
| + source of the task's state and of its start and stop times. A console |
| + restart therefore loses nothing: it re-reads the same rows. |
| +- **The hard deadline** is 15 minutes after dispatch. Past it the console |
| + calls `StopTask` and keeps tracking until ECS confirms the stop. |
| +- **Charge.** ECS's stop time minus its start time. ECS keeps a stopped |
| + task's record for about an hour **(unverified)**, so "unknown" arises only |
| + when the console was down longer than that, after the hard deadline. |
| +- **Never started.** No capacity or a failed image pull: no engine time, and |
| + nothing written. One return to `queued` adds a counter and no obligation |
| + **(my call)**. A task that ran and failed is never retried. |
| +- **Commit.** For exit 0 the console reads the result object (§5.4) and HEADs |
| + the three outputs against the sizes it reports. A retired row never |
| + commits `done`. |
| +- **Cleanup** runs only after the task is confirmed stopped, so nothing is |
| + still writing and one deletion is complete. |
| +- **Retire (astra R3-4).** App purge, account deletion and **store destroy** |
| + (`internal/console/appsettings.go:1629`) each retire the affected rows. |
| + Store destroy does it under the store walk lock, calls `StopTask` for |
| + running rows, and **refuses to destroy the store until every one of its |
| + rows has `task_stopped`**: until then a task could still write. Retired rows |
| + are invisible to the door and are kept until settled and cleaned. |
| +- **Pruning.** A row is deleted only when it is settled, its task is stopped, |
| + its cleanup is done, and it is either retired or `failed`, 90 days after it |
| + ended. `done` rows of a live store are kept: they are the registry of what |
| + was converted, and a future stage-1 fence must read them. |
| **Invariants.** |
| @@ -248,95 +254,120 @@ are no bucket records and no queue markers **(closes astra R2-2)**. |
| - **I2. Charged exactly once.** `settled` goes from false to true in the |
| transaction that writes `charged_ms` and the terminal state, and nothing |
| writes `charged_ms` afterwards. |
| -- **I3. Never undercharged.** `charged_ms` is at least the engine time the |
| - execution used: the console's own measurement of a synchronous invoke it saw |
| - return, or the whole timeout otherwise. |
| -- **I4. Cleanup retained.** A row with `cleanup_due` set, or not settled, is |
| - never deleted by purge, account deletion or pruning. |
| +- **I3. Never undercharged.** `charged_ms` is at least the time ECS reports |
| + the task ran, or the full 15 minutes when ECS cannot say. |
| +- **I4. Obligations retained.** A row that is unsettled, has `cleanup_due` |
| + set, or has `task_stopped` false is never deleted. |
| - **I5. One execution.** A `done` row's outputs are the keys of its own |
| `execution_id`, and no other execution ever held a request for them. |
| +- **I6. Capacity (astra R3-3).** The number of rows with a dispatched |
| + execution and `task_stopped` false never exceeds the dispatch cap, whatever |
| + their state or retirement. |
| +- **I7. Store lifetime (astra R3-4).** No row is admitted, dispatched or |
| + committed against a store incarnation other than its own, and a store is |
| + not destroyed while one of its rows has `task_stopped` false. |
| **The simulation.** The plan's first build task is `internal/sim/mediajobs`: a |
| -randomized interleaving of submit, dispatch, invoke-return, invoke-lost, |
| -console restart, cleanup and app purge against the real transition code and a |
| -fake engine, checking I1 to I5 after every step. |
| +randomized interleaving of submit, dispatch, task start failure, task stop, |
| +task record expiry, console restart, cleanup, app purge, and store destroy and |
| +recreate, against the real transition code and a fake engine whose tasks keep |
| +running until stopped, checking I1 to I7 after every step. |
| ### 5.4 Authority |
| - The deployment has one **conversion role**, assumable only by the console's |
| - role. It allows `GetObject` under the store bucket prefix and `PutObject` |
| - under `derived/` in those buckets, and carries two unconditional Denies: |
| - reading any object tagged infected, and any PUT that sets a scan tag (the |
| - rule of `aws.go:200-226`). Infected sources are therefore refused whatever |
| - the store's `Enforce` flag says, at the door's HEAD and at the function's |
| - GET, with nothing copied from the store record to go stale. |
| -- For each execution the console assumes the role for 15 minutes with a |
| - session policy narrowing it to the one bucket, and presigns four transfers: |
| - one GET for the source with `If-Match: <etag>` signed, and three create-only |
| - PUTs with their content types signed. The credentials never leave the |
| - console. |
| + role. It allows `GetObject` under the store bucket prefix, `PutObject` under |
| + `derived/` in those buckets, and `PutObject` under `media-results/` in the |
| + deployment bucket. It carries two unconditional Denies: reading any object |
| + tagged infected, and any PUT that sets a scan tag (the rule of |
| + `aws.go:200-226`). Infected sources are therefore refused whatever the |
| + store's `Enforce` flag says, at the door's HEAD and at the task's GET. |
| +- For each execution the console assumes the role for 20 minutes with a |
| + session policy narrowing it to the one bucket and the one result key, and |
| + presigns five transfers: a GET for the source with `If-Match: <etag>` |
| + signed; three create-only PUTs for the outputs; one create-only PUT for the |
| + result object, `media-results/<execution id>.json`. The credentials never |
| + leave the console. |
| +- **The result object (paul R-F)** carries the probe facts, the output sizes |
| + and ETags, the ffmpeg version, or a named error. It lives in the deployment |
| + bucket, where no tenant can write, so an app cannot forge the duration its |
| + plan is charged for. The console reads it once with its own role, bounded |
| + to 64 KB, and deletes it in cleanup. It is a message, not state: the row is |
| + the authority. |
| - `writes_denied` is refused at the door and again at dispatch. A store that |
| becomes write-denied later lets that one execution finish. |
| -- **The function's own role has no S3 authority (paul R-L).** It works only |
| - through the four transfers. |
| - |
| -Rejected: a bucket grant to the engine; the console's own role presigning (no |
| -infected Deny); a second key on the store user (rotation uses both slots). |
| +- **The task has no role and no credentials (paul R-F).** It works only |
| + through the five transfers. |
| To prove on dev first **(unverified)**: the tag-conditioned Deny holds for a |
| GET and HEAD presigned by the assumed role, and a presigned PUT with a signed |
| `If-None-Match: *` is refused when the object exists. |
| -### 5.5 The engine: a Lambda function (paul R-L) |
| - |
| -`infra/modules/media-function` creates: |
| - |
| -- **The function**: an arm64 container image, pinned by digest, invoked once |
| - per execution. Its event carries the execution id, preset, limits and the |
| - four transfers, each as method, URL and exact signed headers. It downloads, |
| - probes, converts (§6), uploads, and returns the result or a named error. It |
| - never logs a URL or a signed header. |
| -- **Its network**: a subnet in the console's VPC whose route table has the S3 |
| - gateway endpoint and no route to the internet, with a security group that |
| - allows egress only to S3. The endpoint's policy admits only requests signed |
| - by the conversion role for buckets under the store prefix. |
| -- **Its role**: network-interface management and logs. Nothing else. |
| -- **Reserved concurrency**, the deployment-wide ceiling (§7.2). |
| -- **The conversion role** and the console's two new permissions: assume it, |
| - and invoke this function. |
| - |
| -Console variable `CARLOS_MEDIA_FUNCTION` (the function's ARN). Unset, the door |
| -answers 503. The module fails its precondition if the function's region is not |
| -the store region; the door's `no_engine_in_region` covers deployments wired by |
| -hand. On dev and flagship the console and its stores are both in `eu-west-1` |
| -**(as reported; those roots are outside this tree)**. |
| - |
| -**Isolation.** Each execution runs in a Lambda microVM with its own ephemeral |
| -`/tmp`, sized at 2 GiB: the 512 MiB source plus outputs. That bounds a job's |
| -bytes and files and replaces every shared-box mechanism of revision 2 |
| -**(closes astra R2-1: there is no agent, no slot and no helper unit to |
| -recover)**. Lambda reuses a warm environment for later invocations, so the |
| -function makes each environment single-use: |
| - |
| -- it serves one execution per process and exits after its response is |
| - delivered, so the next invocation starts a new runtime; |
| -- at start it refuses to run unless it is the only process in the environment, |
| - and it empties `/tmp` and checks it is empty before anything else. |
| - |
| -The spike must show that a second invocation never observes a process or a |
| -file from the first **(unverified)**. If it cannot, the design returns to Paul |
| -before anything is built. |
| - |
| -**Image build, release and rollback.** CI builds the image for arm64 from a |
| -Debian 13 base with Debian's ffmpeg packages and the function's pure-Go |
| -handler, on every platform release and on a weekly schedule, so security |
| -updates arrive by rebuild. Each build publishes a digest. A deployment copies |
| -the image into its own registry and pins the digest in its root. A new digest |
| -reaches a deployment only when its root is changed and applied; rollback is |
| -the previous digest. `carlos system media status` shows the configured digest, |
| -its build date and ffmpeg version, the queue, and 24 hours of conversions and |
| -refusals, and warns when the image is more than 30 days old. Whether amadan's |
| -CI can build arm64 images is for the builder to establish **(unverified)**. |
| +### 5.5 The engine: one Fargate task per execution (paul R-F) |
| + |
| +`infra/modules/media-engine` creates an ECS cluster, a task definition, an |
| +image repository, the network below, the conversion role, and the console's |
| +new permissions: assume that role; `RunTask`, `DescribeTasks`, `ListTasks` |
| +and `StopTask` on this cluster and task definition; and `iam:PassRole` for |
| +the task execution role only. Its one output is the console variable |
| +`CARLOS_MEDIA_ENGINE`. Unset, the door answers 503. The module fails its |
| +precondition if its region is not the store region; on dev and flagship both |
| +are `eu-west-1` **(as reported; those roots are outside this tree)**. |
| + |
| +**The task.** One container from the arm64 image, pinned by digest, 4 vCPUs |
| +and 8 GB, non-root, a read-only root filesystem, every capability dropped, and |
| +the task's ephemeral storage as its only writable space. That storage bounds a |
| +job's bytes and files; filling it ends that task alone. The handler downloads, |
| +probes, converts (§6), uploads, writes the result object and exits. It stops |
| +itself 10 minutes after it starts. |
| + |
| +**Isolation (closes astra R3-1).** AWS documents that each Fargate task has |
| +its own isolation boundary and does not share the underlying kernel, CPU, |
| +memory or network interface with another task |
| +(https://docs.aws.amazon.com/AmazonECS/latest/developerguide/security-fargate.html), |
| +and a task runs once and is never handed a second execution **(unverified; |
| +confirmed in the spike)**. There is no runtime API inside it to take over. |
| + |
| +**Credentials (closes astra R3-2).** The task definition has **no task role**, |
| +so the container credentials endpoint has nothing to serve. The task |
| +execution role, used to pull the image and write logs, is used by the Fargate |
| +agent and is not offered to the container. Fargate tasks cannot reach the |
| +instance metadata service. The spike proves all three from inside the |
| +container, and that the task metadata endpoint yields no credential |
| +**(unverified)**. |
| + |
| +**Inputs.** The console passes the execution id, preset, limits and the five |
| +transfers (method, URL, exact signed headers) as one container environment |
| +override. Overrides are limited to 8,192 characters **(unverified)**, so the |
| +payload sends the session token, bucket and output prefix once; the builder |
| +proves the longest admitted key fits. Overrides can be read by any principal |
| +in the account allowed to describe tasks, and appear in its audit trail. The |
| +transfers expire with the 20-minute grant, and the handler never logs them. |
| + |
| +**Network.** The module creates a small VPC of its own with no internet |
| +gateway and no NAT **(my call: R-F said the console's VPC, but the DNS rule |
| +below applies to a whole VPC, and the console never connects to a task)**. It |
| +has an S3 gateway endpoint, interface endpoints for the image registry (two) |
| +and for logs, and a security group whose only egress is S3 and those |
| +endpoints. The S3 endpoint's policy admits requests signed by the conversion |
| +role for buckets under the store prefix and for `media-results/`, and reads |
| +of the registry's layer bucket for the image pull. |
| + |
| +**DNS (astra R3-2).** A security group cannot stop queries to the VPC |
| +resolver. A Route 53 Resolver DNS Firewall rule on this VPC allows the S3, |
| +registry and logs names for the region and blocks every other name. With no |
| +credentials in the container, what a compromised codec could leak is this |
| +job's own source and its five transfers, which expire; the rule closes that |
| +too. |
| + |
| +**Image build, release and rollback.** CI builds the arm64 image from a |
| +Debian 13 base with Debian's ffmpeg and the pure-Go handler, on every release |
| +and weekly, so security updates arrive by rebuild. A deployment copies it into |
| +its repository and pins the digest in its root; rollback is the previous |
| +digest. `carlos system media status` shows the digest, its build date and |
| +ffmpeg version, the queue, running tasks and 24 hours of results, and warns |
| +when the image is over 30 days old. Whether amadan's CI can build arm64 |
| +images is for the builder to establish **(unverified)**. |
| ### 5.6 Uploads from a browser |
| @@ -395,9 +426,7 @@ The MP4 and the poster may be proxied with `Range` or redirected to a |
| presigned GET. |
| **Deleting.** When an app deletes a source it deletes `derived/<source key>/` |
| -too. Roadmap ruling 6's "removed with their source" is the app's duty in v1. |
| - |
| -Every user-facing string goes through copy review before it is written. |
| +too. Every user-facing string goes through copy review before it is written. |
| ## 6. Security: ffmpeg and hostile input |
| @@ -426,27 +455,24 @@ ignores every other stream, and checks: |
| path, never the tenant's key: `-nostdin`, `-protocol_whitelist file`, the |
| demuxer forced, a decoder allow-list matching the table, only the two chosen |
| streams mapped, `-t` at the duration cap, and a wall-time budget inside the |
| -function timeout. Over it the job fails `too_slow`. |
| +handler's 10 minutes. Over it the job fails `too_slow`. |
| **Collecting outputs.** The handler touches the output directory only after |
| the child and every descendant are dead. It opens the three expected names |
| relative to a directory descriptor it holds, refuses any symlink, any path |
| leaving the directory and anything that is not a regular file with one link, |
| checks each size against a bound, and uploads from the open descriptors. This |
| -is defence in depth: the child runs in the same microVM as the handler. |
| - |
| -**What a compromised ffmpeg can reach (paul R-L).** It shares the microVM and |
| -the user with the handler, so assume it can read the handler's memory. It then |
| -holds this execution's four transfers: one tenant's one source, and three |
| -output keys nobody else will ever use. It can reach S3 through the endpoint, |
| -where the endpoint policy admits nothing but requests signed by the conversion |
| -role. It has no credentials, no route to the internet, the console, the |
| -instance metadata service or another box, and no later execution to wait for. |
| -Its worst outcome is bad output for the one job whose input attacked it. |
| - |
| -If Lambda permits a seccomp filter on the child, the builder adds one that |
| -denies sockets and reading another process's memory **(unverified, |
| -optional)**. |
| +is defence in depth: the child shares the container with the handler. |
| + |
| +**What a compromised ffmpeg can reach (paul R-F).** Assume it can read the |
| +handler's memory. It then holds this execution's five transfers: one tenant's |
| +one source, three output keys nobody else will ever use, and this execution's |
| +result object. It can reach S3 only through the endpoint, as the conversion |
| +role's presigned requests. It has no credentials, no route or name resolution |
| +beyond the three AWS services, no console, no other box, and no later |
| +execution to wait for. Its worst outcome is bad output and a false result for |
| +the one job whose input attacked it; the engine time is still charged from |
| +ECS. |
| ## 7. Limits, metering and sizing |
| @@ -459,70 +485,67 @@ optional)**. |
| | Dimensions | 3840x2160 | What phones record | |
| | Frame rate | 60 | Slow-motion capture is out of scope | |
| -All are settings (`CARLOS_MEDIA_LIMITS`). **The function timeout is 10 minutes |
| -(my call)**, inside Lambda's 15-minute ceiling: every admitted clip must |
| -download, convert and upload within it, and the spike confirms that the |
| -slowest admitted input does. If one does not, the caps come down; the timeout |
| -does not go past the ceiling. |
| +All are settings (`CARLOS_MEDIA_LIMITS`). **The handler's budget is 10 minutes |
| +and the hard deadline 15 minutes after dispatch (my call)**: every admitted |
| +clip must download, convert and upload within the budget, and the spike |
| +confirms that the slowest admitted input does. If one does not, the caps come |
| +down. |
| ### 7.2 Fair use (every deployment) |
| **(my call on the numbers.)** |
| -- Deployment-wide: reserved concurrency 4 on the function. The pass never runs |
| - more than that at once, so an invoke is never throttled. |
| -- Per account: at most 2 running and 20 queued or running (429); 30 |
| +- **Dispatch cap (astra R3-3):** at most 4 tasks, counted as rows with a |
| + dispatched execution and `task_stopped` false. A row frees its place only |
| + when ECS confirms its task stopped, never by reaching a terminal state. |
| +- Per account: at most 2 such rows, and 20 queued or running (429); 30 |
| submissions a minute, burst 10 (429). |
| - **Engine-time budget:** 60 minutes a UTC day of `charged_ms` on executions |
| - that did not end `done`, counting a running execution at its full |
| - reservation. Over it, the door refuses with 429 `execution_budget` and the |
| - pass leaves that account's queued rows until the next UTC day. |
| + that did not end `done`, counting a running execution at 15 minutes. Over |
| + it, the door refuses with 429 `execution_budget` and the pass leaves that |
| + account's queued rows until the next UTC day. |
| - Deployment-wide, at most 200 queued: 503. |
| The console's `allowWrite` limit does not apply, as for PDF. |
| -### 7.3 Plan cap (deployments with a catalog) |
| +### 7.3 Plan cap and metering |
| A new `plans.Limits` field, `MediaMinutesMonth` (`media_minutes_month`), |
| handled exactly as `pdf_renders_month`: monthly, a warning at the limit, a 402 |
| from `capCopy` at twice the limit, ops accounts exempt, zero meaning no limit, |
| -a new `capID`. Proposed values, in the PDF row's proportions (decision 5): |
| +a new `capID`. Proposed values, in the PDF row's proportions (decision 6): |
| Free 30, Personal 600, Community 1,200, Business 12,000. No media pack in v1. |
| -What counts: `source_ms` of `done` rows in the UTC month. The check runs at |
| -submission, so an account can overshoot by its queue. |
| - |
| -### 7.4 Metering |
| - |
| Both measures are queries over `media_jobs`: the plan cap sums `source_ms` of |
| -`done` rows, and the engine-time budget sums `charged_ms` of the others. There |
| -is no second table and no event to carry between them. `carlos system media |
| -status` and the account usage page read the same rows. Outputs are ordinary |
| -objects in the tenant's bucket and count as its storage (roadmap ruling 6). |
| +`done` rows in the UTC month, and the engine-time budget sums `charged_ms` of |
| +the others. The check runs at submission, so an account can overshoot by its |
| +queue. Outputs count as the tenant's storage (roadmap ruling 6). |
| -### 7.5 Function size, cost and the spike |
| +### 7.4 Task size, cost and the spike |
| All figures here are **estimates** until the spike reports. |
| -- **Size.** Lambda gives up to 10 GB and 6 vCPUs, and vCPUs follow memory. |
| - Start at the maximum: x264 uses every core, and a shorter run costs about |
| - the same as a smaller, longer one. |
| -- **Time.** A three-minute 1080p30 phone clip to 720p with a fast x264 |
| - preset: 20 to 60 seconds. From 4K30 HEVC: 1 to 3 minutes. With HDR |
| - tone-mapping: unknown. |
| -- **Cost.** At about 0.008 US dollars per minute of a 10 GB arm64 function |
| - **(unverified)**: up to a cent for a typical clip, two to three cents for |
| - the slowest admitted one, 5 to 15 dollars for a thousand clips a month, |
| - and cents for an idle month. Reserved concurrency caps the worst case. |
| - |
| -**The spike precedes the build** (decision 1). On a dev function it shows: |
| - |
| -1. wall time and peak memory per clip at two function sizes and two or three |
| - x264 presets, against the 10-minute timeout; |
| +- **Size.** 4 arm64 vCPUs and 8 GB, with Fargate's default 20 GiB of |
| + ephemeral storage. Fargate goes to 16 vCPUs if the spike wants more. |
| +- **Time.** A task takes 30 to 60 seconds to start. A three-minute 1080p30 |
| + phone clip then converts in 30 to 90 seconds; from 4K30 HEVC, 2 to 4 |
| + minutes; with HDR tone-mapping, unknown. |
| +- **Cost.** About 0.003 US dollars a task-minute **(unverified)**: under a |
| + cent for a typical clip, about two cents for the slowest admitted one, 5 to |
| + 10 dollars for a thousand clips a month. Fixed: the three interface |
| + endpoints, about 24 dollars a month, or about 16 without logs; nothing else |
| + while idle. |
| + |
| +**The spike precedes the build** (decision 1). On a dev cluster it shows: |
| + |
| +1. start time, wall time and peak memory per clip at two task sizes and two |
| + or three x264 presets, against the 10-minute budget; |
| 2. whether tone-mapping fits; if not, HDR is refused with a named error; |
| -3. that a 10-minute synchronous invoke from the console box holds; |
| -4. the single-use environment claim of §5.5 and the two store behaviours of |
| - §5.4; |
| +3. the isolation and credential claims of §5.5: no credential from the |
| + environment, the credentials endpoint, the metadata endpoints or the |
| + instance metadata address; no name resolved and no host reached outside |
| + the allowed three; nothing shared between two tasks; |
| +4. that the override payload fits, and the two store behaviours of §5.4; |
| 5. whether the single fragmented MP4 plays and seeks progressively in Safari |
| on iOS and macOS, Chrome and Firefox, and the playlist in Safari and a |
| JavaScript HLS player. If progressive playback fails anywhere, the |
| @@ -532,32 +555,32 @@ All figures here are **estimates** until the spike reports. |
| **Core, no cloud API:** the door, the job row and its transitions, the pass, |
| limits, metering, the preset, the handler, the image, and three seams with |
| -in-memory fakes: an engine ("run this execution, return its result"), a |
| -per-execution grant ("presign for this store") and bucket upload |
| +in-memory fakes: an engine (start a task, read its state and times, stop it), |
| +a per-execution grant ("presign for this store") and bucket upload |
| configuration. |
| -**AWS adapter:** Lambda `Invoke`, STS `AssumeRole`, the `media-function` |
| -module, and the provenance, CORS and lifecycle calls with their console |
| -grants, behind a `region-host` switch (`store_conversion`, off by default |
| -like `store_scanning`). |
| +**AWS adapter:** ECS `RunTask`, `DescribeTasks` and `StopTask`; STS |
| +`AssumeRole`; the `media-engine` module; and the provenance, CORS and |
| +lifecycle calls with their console grants, behind a `region-host` switch |
| +(`store_conversion`, off by default like `store_scanning`). |
| **A deployment without AWS** has no object stores today (§3). When a |
| MinIO-compatible backend arrives, its engine runs the same image as a |
| one-shot container on a box the console can reach, with the equivalent |
| -sandbox: a fresh container per execution, size-limited scratch, memory and |
| -time limits, and a network that reaches only the store. |
| +sandbox: a fresh container per execution, no credentials, size-limited |
| +scratch, memory and time limits, and a network that reaches only the store. |
| ## 9. Rollout and acceptance gates |
| Rule 5 (no dormant feature): the code merges with the module, and the door is |
| -live wherever `CARLOS_MEDIA_FUNCTION` is set. |
| +live wherever `CARLOS_MEDIA_ENGINE` is set. |
| -0. **Spike** (§7.5), in dev, under decision 1. Its report amends this spec |
| +0. **Spike** (§7.4), in dev, under decision 1. Its report amends this spec |
| where the numbers disagree. |
| -1. **Simulation** (§5.3), then the door, pass, function, module, uploads verbs |
| +1. **Simulation** (§5.3), then the door, pass, handler, module, uploads verbs |
| and docs. Release. |
| -2. **Dev:** apply `media-function` and `store_conversion`, set |
| - `CARLOS_MEDIA_FUNCTION`, run every drill. |
| +2. **Dev:** apply `media-engine` and `store_conversion`, set |
| + `CARLOS_MEDIA_ENGINE`, run every drill. |
| 3. **Flagship:** the same, with Paul's scoped approval (AGENTS.md). |
| **Drills, attacks first:** |
| @@ -567,25 +590,28 @@ live wherever `CARLOS_MEDIA_FUNCTION` is set. |
| - A token for another app or account, and a key under `derived/`, are |
| refused. A store adopted under the minted name, one with SSE-KMS and one |
| with a foreign lifecycle rule are each refused `store_unverified`. |
| -- From inside the function: no connection to the internet, the console, the |
| - metadata service or another box; an unsigned S3 request and one signed by |
| - another principal are refused at the endpoint; the function's own role |
| - lists no bucket. |
| +- From inside a task: no credential anywhere; no name resolves but the |
| + allowed three; no connection to the internet, the console or another box; |
| + an unsigned S3 request and one signed by another principal are refused at |
| + the endpoint. |
| - A playlist-style file naming `http://169.254.169.254/` and a local path |
| makes no request and reads no file. A truncated file, a lying duration, a |
| decompression bomb and a fuzzed corpus each end in a named error. |
| -- A test child that fills `/tmp`, or writes a hundred thousand small files, |
| - fails its own job. One that leaves a file in `/tmp` and a background |
| - process is invisible to the next invocation. One that leaves a symlink, a |
| - hard link, a FIFO and an oversized file under the output names uploads |
| - nothing. |
| +- A test child that fills the task's storage, or writes a hundred thousand |
| + small files, fails its own job only. One that leaves a symlink, a hard |
| + link, a FIFO and an oversized file under the output names uploads nothing. |
| - A source rewritten between submission and dispatch ends `source_changed`. A |
| second PUT to a committed output key is refused. |
| -- The console killed mid-invoke: the job ends `engine_lost`, charged the |
| - whole timeout, and its keys are gone an hour after it started. |
| -- An app purged with one job queued and one running: both rows are retired, |
| - the running one charged and cleaned, and a new app of the same name sees |
| - neither. |
| +- The console killed while four tasks run: on restart no fifth task starts |
| + until one is confirmed stopped, and each job completes and is charged ECS's |
| + times. |
| +- A task with a bad image digest fails to start twice and the job ends |
| + `engine_unavailable`, uncharged. A task that ignores its budget is stopped |
| + at the hard deadline. |
| +- Store destroy with a task running is refused until the task has stopped; |
| + after destroy and recreate, the same key and bytes make a new job. |
| +- An app purged with one job queued and one running: both are retired, the |
| + task stopped, charged and cleaned; a new app of that name sees neither. |
| - An account whose clips all time out is refused `execution_budget` after 60 |
| minutes of them. A 600 MB file, a 4-minute clip and an account at twice |
| its plan cap are each refused. Of two accounts, one submitting 20 clips |
| @@ -595,17 +621,18 @@ live wherever `CARLOS_MEDIA_FUNCTION` is set. |
| `shop.example.com`, plays from `video.mp4` reached through a redirect to a |
| presigned GET in Safari on iOS, Chrome and Firefox, and from `video.m3u8` |
| proxied on the app's origin in Safari and a JavaScript HLS player, within a |
| -time the spike sets (expected under a minute, cold start included). |
| +time the spike sets (expected under two minutes, task start included). |
| Repeating the submission returns the same job and converts nothing. |
| ## 10. Left to the builder |
| -The table's schema; how a deployment copies the image into its registry; the |
| -ffmpeg arguments and process handling, as long as §6 and its drills hold; |
| -module variable names, following `pdf-host`. Guards that matter beyond the |
| -simulation: every §5.2 refusal happens before a row is written; the function |
| -never sees a job id, an account or an app name; a result for a row no longer |
| -`running` with that execution id is dropped. |
| +The table's schema; how a deployment copies the image into its repository; |
| +the ffmpeg arguments and process handling, as long as §6 and its drills hold; |
| +the override payload's encoding; module variable names, following `pdf-host`. |
| +Guards that matter beyond the simulation: every §5.2 refusal happens before a |
| +row is written; the task never sees a job id, an account or an app name; a |
| +result for a row that is retired or no longer `running` with that execution |
| +id is dropped. |
| ## 11. Amendments |
| @@ -615,16 +642,14 @@ never sees a job id, an account or an app name; a result for a row no longer |
| result and eligibility by region. Changed: the door's path and verb; every |
| source re-encoded to a 720p cap; one poster; no audio products; job state |
| in the console's database, not under the app's bucket prefix. |
| -- **Ruling 7 moves (paul R-L):** the worker is a Lambda function, not |
| - `carlos-media.service` on the Ireland `t4g.medium`. |
| +- **Ruling 7 moves (paul R-F):** the worker is a Fargate task per execution, |
| + not `carlos-media.service` on the Ireland `t4g.medium`. |
| - **§3's codec-helper rule** (a hardened systemd scope, no network) is met |
| - differently: the microVM is the scope and the network reaches only the |
| - store. Ruling 10 stands: ffmpeg is a separate process outside the Go tree. |
| -- **Ruling 11 moves:** the single rendition does not wait for stage 1, as |
| - image resizing did not. |
| + differently: the task is the scope and the network reaches only the store. |
| + Ruling 10 stands: ffmpeg is a separate process outside the Go tree. |
| +- **Ruling 11 moves:** the single rendition does not wait for stage 1. |
| - **Ruling 6 is kept in part:** outputs land under `derived/` in the tenant's |
| - bucket and count as its storage; "removed with their source" is the app's |
| - duty until stage 1. |
| + bucket as its storage; removing them with the source is the app's duty. |
| - **The fence:** per-execution grants and keys and a commit in the console's |
| database replace the media bucket policy and stage 1's publication fence |
| for this product. Stage 1 still owns the fence for what it serves, and |
| @@ -635,64 +660,57 @@ never sees a job id, an account or an app name; a result for a row no longer |
| **Object storage:** the console reads tenant data only for scanning |
| (`infra/modules/region-host/main.tf:847-851`). Conversion is a second, |
| switched exception through the conversion role: a HEAD of the source and of |
| -the outputs. |
| +the outputs. Store destroy gains the refusal of §5.3. |
| ## 12. Decisions for Paul |
| -Already ruled: a platform engine, Lambda (R-L), the lifecycle cut (R-C). |
| +Already ruled: a platform engine, Fargate (R-F), the lifecycle cut (R-C). |
| 1. **The spike.** It needs real clips from Paul (4K60 HDR in Dolby Vision or |
| HLG, portrait with rotation, variable frame rate, an ordinary 1080p |
| clip); his scoped approval to create in the dev account, for its |
| - duration, one Lambda function with its role and image repository, the |
| - conversion role, and a subnet with an S3 gateway endpoint; and Safari |
| - checks on a real iPhone by Paul or on the tito-studio Mac. Recommend |
| - approving it as the first task. |
| -2. **No wait for stage 1** (moves ruling 11, narrows ruling 6): ship on the |
| + duration, an ECS cluster and task definition, an image repository, the |
| + engine VPC with its endpoints and DNS rule, and the conversion role; the |
| + isolation and credential checks of §7.4; and Safari checks on a real |
| + iPhone by Paul or on the tito-studio Mac. Recommend approving it as the |
| + first task. |
| +2. **The engine's network:** a small VPC of its own, which lets a DNS |
| + allow-list apply and leaves the console's VPC untouched, or a private |
| + subnet of the console's VPC with no DNS rule. Recommend its own VPC. |
| +3. **No wait for stage 1** (moves ruling 11, narrows ruling 6): ship on the |
| app's own bucket and serving, or wait for `kind:media`. Recommend |
| shipping. |
| -3. **Authority:** a conversion role assumed per execution that always |
| +4. **Authority:** a conversion role assumed per execution that always |
| refuses infected sources, even in stores with enforcement off, or the |
| console's own role presigning. Recommend the conversion role. |
| -4. **Admission caps:** (a) 180 s, 512 MiB, 4K, 60 fps; (b) 300 s and 1 GiB; |
| +5. **Admission caps:** (a) 180 s, 512 MiB, 4K, 60 fps; (b) 300 s and 1 GiB; |
| (c) 60 s and 200 MB. Recommend (a), if the spike shows it fits the |
| - timeout. |
| -5. **Plan values:** `media_minutes_month` at Free 30, Personal 600, |
| + budget. |
| +6. **Plan values:** `media_minutes_month` at Free 30, Personal 600, |
| Community 1,200, Business 12,000, refused at twice the limit, no media |
| pack; or no cap until usage is measured. Recommend the cap. |
| -6. **Browser uploads in scope** as `carlos store uploads`, a member verb, or |
| +7. **Browser uploads in scope** as `carlos store uploads`, a member verb, or |
| native clients only for now. Recommend in scope. |
| -7. **Always re-encode, HDR tone-mapped, one JPEG poster**, or add the |
| +8. **Always re-encode, HDR tone-mapped, one JPEG poster**, or add the |
| roadmap's remux path. Recommend always re-encode. |
| -8. **On for every app** with a store and a Service credential, as PDFs are, |
| +9. **On for every app** with a store and a Service credential, as PDFs are, |
| or a per-app switch. Recommend on for every app. |
| -9. **No retry in v1.** With requeue cut, a job lost to a console restart |
| - mid-run ends `engine_lost` for good and the app must upload again under a |
| - new key. (a) accept that; (b) allow one automatic second execution, which |
| - puts a second reservation and cleanup into the row. Recommend (a), and |
| - watch how often releases hit running jobs. |
| -10. **Codec licences.** The function encodes H.264 and AAC with Debian's |
| +10. **Codec licences.** The engine encodes H.264 and AAC with Debian's |
| ffmpeg. Accept that position or have it checked before flagship. A |
| question, not a recommendation. |
| ## 13. Review log |
| -**Round 1** (`CODEX-FINDINGS-VIDEO.md`): ten findings, all accepted. **Round |
| -2** (`CODEX-FINDINGS-VIDEO-R2.md`, 1 P1, 5 P2), all accepted: |
| - |
| -- **R2-1** slot reuse after an agent restart: closed by R-L. No agent, slot or |
| - helper unit exists; the like risk, a reused Lambda environment, is handled |
| - in §5.5 and proved in the spike. |
| -- **R2-2** stranded jobs: closed by R-C. One row is the job and its place in |
| - the queue (I1). |
| -- **R2-3** deletion erasing the accounting: closed by R-C. No DELETE; purge |
| - retires rows and never removes an unsettled one (I2, I4). |
| -- **R2-4** cancel before the engine stops: closed by R-C and R-L. No cancel, |
| - and an unobserved run is charged the whole timeout (I3). |
| -- **R2-5** second cleanup lost: closed by R-C. `cleanup_due` stays in the row |
| - until the deletion succeeds (I4). |
| -- **R2-6** bucket name is not provenance: recorded at creation or established |
| - by a recorded verification, otherwise refused (§5.2). |
| +Rounds 1 and 2: sixteen findings, all accepted. **Round 3** |
| +(`CODEX-FINDINGS-VIDEO-R3.md`, 2 P1, 2 P2), all accepted: |
| -**Findings not accepted:** none. |
| +- **R3-1** runtime-protocol takeover: closed by R-F. A Fargate task has no |
| + runtime API and is not reused (§5.5). |
| +- **R3-2** function credentials and DNS exfiltration: closed by R-F. No task |
| + role, no credentials, and a DNS allow-list on the engine's VPC (§5.5). |
| +- **R3-3** capacity released early: the cap counts rows whose task ECS has |
| + not confirmed stopped (§7.2, I6). |
| +- **R3-4** store destroy: it retires the rows, stops their tasks and waits |
| + for them; jobs are keyed to a store incarnation (§5.2, §5.3, I7). |
| +**Findings not accepted:** none. |