# Dashboard script approval → final Director render handoff

Use this for this user's AutoShorts / TrueTraceShorts Dashboard flow after the user approves a Production Queue concept with `APPROVE_PRODUCTION <queue_item_id>`.

## Correction captured

The user's concept-approval step does **not** need a provisional/placeholder video. A 3–5s workflow-preview MP4 in the creator review UI is confusing and should not be used as the normal approval artifact.

Preferred approval artifact:

- text/script package;
- hook rationale;
- storyboard / Director beats;
- visual hook plan;
- Director plan;
- YouTube/TikTok metadata.

Only after that approval should JARVIS create a **final Director-rendered review package**.

## Correct sequence

```text
Dashboard Production Queue item
→ propose script/concept package
→ user sends APPROVE_PRODUCTION <queue_item_id>
→ render final Director package
→ import package into Dashboard
→ mark queue item in_review
→ send Telegram-playable MP4 + thumbnail + hash-bound private-upload command
→ private YouTube upload only after separate APPROVED_FOR_PRIVATE_YOUTUBE_UPLOAD command
→ website companion/update only after the upload/link step is approved
```

## Dashboard import pattern for external/final renders

When a final render is produced outside the Dashboard preview generator:

1. Create a package folder under Dashboard storage:

```text
~/projects/AutoShorts_Dashboard/storage/incoming/<package_id>/
```

2. Copy the final MP4 as:

```text
video.mp4
```

3. Write `manifest.json` with at minimum:

```json
{
  "package_id": "package_<queue>_director_v1",
  "source": "prepared_package",
  "workflow_preview": false,
  "queue_item_id": "<dashboard queue item id>",
  "working_title": "...",
  "language": "en",
  "suggested_tiktok_caption": "...",
  "suggested_youtube_title": "...",
  "suggested_youtube_description": "...",
  "suggested_hashtags": ["#ScamAlert", "#OnlineSafety"],
  "youtube_tags": ["ScamAlert", "OnlineSafety"],
  "script": "...",
  "hook": "...",
  "source_metadata": {
    "workflow_preview": false,
    "director_render": true,
    "renderer": "<script name>",
    "candidate_id": "...",
    "version": "...",
    "video_sha256": "...",
    "media_cache_mp4": "...",
    "contact_sheet": "...",
    "frame_sheet": "..."
  },
  "disclosure": {"synthetic_media": true, "commercial_content": false},
  "quality": {
    "visual_gate": "passed",
    "voice_gate": "passed",
    "hook_gate": "passed",
    "metadata_gate": "passed",
    "safety_gate": "passed",
    "package_integrity_gate": "passed",
    "overall": "passed",
    "checks": {
      "premium_ai_styleframes_used": true,
      "styleframes_text_free": true,
      "no_large_top_title": true,
      "no_unnecessary_lower_third_dim": true,
      "no_powerpoint_layout": true,
      "renderer_owned_text_listed": true
    }
  },
  "quality_report": {
    "overall": "passed",
    "mode": "director_render",
    "block_public_posting_until_final_director_render": false
  },
  "visual_qa": {
    "powerpoint_layout_detected": false,
    "large_top_title_detected": false,
    "unnecessary_lower_third_dim_detected": false,
    "renderer_owned_text": true,
    "first_frame_silent_recognition": "passed",
    "subtitles_phone_safe": "passed"
  },
  "voice_qa": {"gate": "passed"},
  "status": "ready_for_review"
}
```

4. Call Dashboard import scan:

```bash
curl -X POST http://127.0.0.1:<backend-port>/api/imports/scan
```

5. Mark the Production Queue item ready/in review with the imported `video_asset_id`:

```bash
curl -X POST http://127.0.0.1:<backend-port>/api/agent/production/<queue_item_id>/mark-ready-for-review \
  -H 'Content-Type: application/json' \
  -d '{"video_asset_id":"<video_asset_id>"}'
```

6. Verify Dashboard state:

- `VideoAsset.status == ready_for_review`;
- `ProductionQueueItem.status == in_review`;
- `quality_report.overall == passed`;
- review/mobile-review routes load for the imported video.

## Subtitle correction pattern

If a forced-alignment render shows long caption chunks crossing sentence boundaries (e.g. the hook phrase plus the next sentence), do not accept it. Patch the renderer's segment builder to use source-script phrase chunks and rerender before issuing hashes/approval commands.

Example for this style:

```python
sizes = [4,5,4,6,4,5,5,4,3,5,4,1,3,4,3,5,2,3,4]
```

Then re-extract QA frames and inspect at least an early frame and a late frame for phone-safe subtitles.

## Final review delivery requirements

Every final render delivery should include:

- Telegram-playable MP4 from `~/.hermes/media_cache/autoshorts/`;
- thumbnail/cover image attachment;
- Dashboard review/mobile-review links;
- title, description, TikTok caption;
- video SHA256 and package/posting hash where applicable;
- exact `APPROVED_FOR_PRIVATE_YOUTUBE_UPLOAD ...` command;
- duration immediately after the command.

Do not reuse an old approval command after any re-render or metadata/package change.

## Pitfalls

- Do not let a workflow-preview package remain active in Dashboard review after the user rejects placeholder videos. Archive/remove it from the queue and attach only the final Director package.
- Do not use the Dashboard preview bridge as proof that the final renderer is done.
- Do not generate a provisional MP4 just to let the user approve a concept. Script/concept approval is enough.
- Do not issue the YouTube private-upload command until the final MP4/package hashes are computed after the last render/metadata change.
- If the import scan re-imports old folders too, match the new package folder exactly and use that `video_asset_id`, not the first/last arbitrary result.
