{
 "use_case": "consented-dubbing",
 "title": "Consented dubbing: a creator's how-to video dubbed into Spanish in her consented voice",
 "about": "A 57-second fictional how-to video (sharpening on a whetstone) by the fictional creator Mara Quill, dubbed into Spanish in her own consented voice with a glossary. The job must stop at human review with a track of exactly the video's length and every glossary term right; a request in a voice whose consent was revoked must be refused before anything is rendered; and the subtitle QA must find the planted errors in a hand-made SDH file and nothing in the clean one. It does not approve or publish: that is the person's step. One dub takes about a minute on a free GPU; when the voice model falls back to CPU (it needs 8 GB of free GPU memory) it takes about 8 to 10 minutes, and the rehearsal waits up to 20.",
 "licence": "Fictional creators and scripts, title-card videos made with ffmpeg and a hand-written Spanish SDH file, all written for Decosa; the demo voices are synthetic stock voices (Kokoro-82M, Apache-2.0; Chatterbox, MIT). No real person's voice or likeness. Part of decosa-api, AGPL-3.0-or-later.",
 "inputs": [
  {
   "file": "inputs/quill-workshop-whetstone.mp4",
   "what": "The video to dub (up to 3 minutes and 60 MB, sent as the raw request body). Your own video goes here."
  },
  {
   "file": "inputs/quill-workshop-whetstone-script.txt",
   "what": "The narration script, to compare the transcript and translation against by eye."
  },
  {
   "file": "inputs/dub-request.json",
   "what": "Whose voice, which project, purpose, territory and target language. The voice must have a consent entry covering exactly this use."
  },
  {
   "file": "inputs/glossary.json",
   "what": "Terms that must be translated one way (or kept as they are)."
  },
  {
   "file": "inputs/planted-es.srt",
   "what": "A hand-made Spanish SDH file with 15 planted errors, for the subtitle QA."
  },
  {
   "file": "inputs/clean-es.srt",
   "what": "The same file without the errors: the QA must find nothing."
  },
  {
   "file": "inputs/source-en.srt",
   "what": "The English source subtitles the QA compares against."
  },
  {
   "file": "inputs/qa-glossary.json",
   "what": "The glossary the subtitle QA checks the SDH file against."
  }
 ],
 "steps": [
  {
   "id": "gate",
   "method": "POST",
   "path": "/dubbing/gate",
   "body": {
    "voice": "id_mara-quill-demo",
    "project": "quill-workshop",
    "purpose": "dubbing",
    "territory": "WW"
   }
  },
  {
   "id": "qa_planted",
   "method": "POST",
   "path": "/dubbing/qa",
   "body": {
    "subtitles": {
     "$file": "inputs/planted-es.srt"
    },
    "source_subtitles": {
     "$file": "inputs/source-en.srt"
    },
    "glossary": {
     "$file": "inputs/qa-glossary.json"
    },
    "media_seconds": 57.0
   }
  },
  {
   "id": "qa_clean",
   "method": "POST",
   "path": "/dubbing/qa",
   "body": {
    "subtitles": {
     "$file": "inputs/clean-es.srt"
    },
    "source_subtitles": {
     "$file": "inputs/source-en.srt"
    },
    "glossary": {
     "$file": "inputs/qa-glossary.json"
    },
    "media_seconds": 57.0
   }
  },
  {
   "id": "upload",
   "method": "POST",
   "path": "/dubbing/uploads",
   "raw_file": "inputs/quill-workshop-whetstone.mp4",
   "content_type": "application/octet-stream"
  },
  {
   "id": "refused",
   "method": "POST",
   "path": "/dubbing/jobs",
   "expect_status": 422,
   "body": {
    "upload_id": {
     "$ref": "upload.upload_id"
    },
    "voice": "id_theo-marsh-demo",
    "project": "sundial-notes",
    "purpose": "dubbing",
    "territory": "WW",
    "lang": "es"
   }
  },
  {
   "id": "job",
   "method": "POST",
   "path": "/dubbing/jobs",
   "body": {
    "upload_id": {
     "$ref": "upload.upload_id"
    },
    "voice": "id_mara-quill-demo",
    "project": "quill-workshop",
    "purpose": "dubbing",
    "territory": "WW",
    "lang": "es",
    "variant": "neutral",
    "glossary": {
     "$file": "inputs/glossary.json"
    }
   }
  },
  {
   "id": "review",
   "method": "GET",
   "path": "/dubbing/jobs/${job.job_id}",
   "until": {
    "path": "status",
    "in": [
     "review",
     "failed",
     "refused"
    ]
   },
   "interval": 5,
   "max_wait": 1200
  },
  {
   "id": "render_receipt",
   "method": "GET",
   "path": "/provenance/receipts/${review.track.render_receipt.id}",
   "auth": false
  }
 ],
 "checks": [
  {
   "says": "the consent gate allows Mara Quill's own voice for her channel",
   "path": "gate.consent.code",
   "equals": "allowed"
  },
  {
   "says": "a dub in Theo Marsh's voice is refused because he revoked his consent",
   "path": "refused.consent.code",
   "equals": "revoked"
  },
  {
   "says": "the refusal is a receipted consent-ledger decision and no voice was rendered",
   "path": "refused.consent.receipt_id",
   "contains": "cd_"
  },
  {
   "says": "the subtitle QA finds the planted overlap at cue 2",
   "path": "qa_planted.issues[code=overlap,cue=2]",
   "count_min": 1
  },
  {
   "says": "the subtitle QA finds three lines in cue 6",
   "path": "qa_planted.issues[code=too_many_lines,cue=6]",
   "count_min": 1
  },
  {
   "says": "the subtitle QA finds the end-before-start timing in cue 8",
   "path": "qa_planted.issues[code=bad_timing,cue=8]",
   "count_min": 1
  },
  {
   "says": "the subtitle QA finds the avoided glossary term in cue 12",
   "path": "qa_planted.issues[code=glossary_avoid,cue=12]",
   "count_min": 1
  },
  {
   "says": "the subtitle QA finds the empty cue (14), the cue past the end of the video (18) and the mixed SDH styles",
   "path": "qa_planted.issues.code",
   "contains": [
    "empty_cue",
    "past_end",
    "sdh_brackets",
    "sdh_speaker",
    "parse_error"
   ]
  },
  {
   "says": "the subtitle QA finds nothing in the clean file",
   "path": "qa_clean.issues",
   "count": 0
  },
  {
   "says": "the dub stops at human review (it is not published)",
   "path": "review.status",
   "equals": "review"
  },
  {
   "says": "the dubbed track is exactly the video's length, to the sample (57.0 s at 48 kHz)",
   "path": "review.track.exact",
   "equals": true
  },
  {
   "says": "every glossary term is translated as the glossary says (10 of 10)",
   "path": "review.translation.glossary.correct",
   "equals": 10
  },
  {
   "says": "the channel name Quill Workshop is kept unchanged in the Spanish",
   "path": "review.lines",
   "contains": "Quill Workshop"
  },
  {
   "says": "the voice render's receipt verifies against this server's key",
   "path": "render_receipt.verification.ok",
   "equals": true
  },
  {
   "says": "the render receipt points at Mara Quill's active consent entry",
   "path": "render_receipt.consent.identity_id",
   "equals": "id_mara-quill-demo"
  },
  {
   "says": "that consent entry is not revoked",
   "path": "render_receipt.consent.revoked",
   "equals": false
  },
  {
   "says": "every speech and model call has a signed receipt",
   "receipts": "signed",
   "ignore_prefix": [
    "cd_",
    "rr_"
   ],
   "min": 2
  }
 ]
}
