Skip to content

feat(midcuts): v2 narration front-door — persona presets, per-clip labels, UX fixes - #72

Merged
macayaven merged 23 commits into
mainfrom
feat/midcuts-phase4-space-push
Jun 21, 2026
Merged

macayaven merged 23 commits into
mainfrom
feat/midcuts-phase4-space-push

Conversation

@macayaven

Copy link
Copy Markdown
Owner

Summary

Consolidates the Mid Cuts (Small Cuts v2) work to main: the hybrid upload front-door to /v2/narrate, curated narrator-persona presets (prose-voice), per-clip style+language labels, and a batch of viewer UX/a11y fixes. The live v1 path stays byte-identical (all new behaviour is v2-gated).

Components

Area Change
Upload front-door Hybrid relay + upload → /v2/narrate; push-not-poll webhook + relay cache-bust; language selector (en/es/fr)
Narration quality Warm-up carrier trim, text-only model titles
Persona presets Closed dropdown of curated narrator personas (replaces free-text steer); Langfuse-managed Space-side with in-code fallback; contract NarratedScene v1.3.0 (optional persona + language, cumulative version-truth)
Per-clip labels Language + narrator style shown on the player (full label) and library thumbnails (3-line caption)
UX/a11y fixes Rewind/forward direction corrected; CC toggle fixed (Gradio 6 .contain prefix); CC restyled into the control pill; aria-labels on icon buttons
Caps Upload limits relaxed 2× → 160 MB / 120 s

Usage

v2 upload modal: drop a clip → pick a Narrator persona + Voice language → Make the cut. The finished cut shows EN · <style> on the player and thumbnail.

Test coverage

469 passed, 2 skipped locally (ruff + ruff format + pytest). New suites: persona resolution/contract, render gating, captions, navigation direction, CC toggle, a11y; contract golden samples bumped to v1.3.0.

🤖 Generated with Claude Code

macayaven and others added 23 commits June 19, 2026 17:09
Phase 4 producer->Space push wiring (the one missing wire) + the cache-bust it
needs, plus fold-in #1 (contract sweep). No contract/schema change.

- narrate_v2.notify_relay_hook: best-effort one-shot POST {scene_id, seq} with
  the shared Bearer after publish; never raises (scene is already durable in the
  bucket), no-op when unconfigured. Wired into midcuts_narrate.Narrator.process.
- BucketSceneClient.invalidate_cache(): the relay-scene push path (_tick) busts
  the 5s manifest cache so a fresh cut shows immediately; demo.load initial paint
  keeps the cache (_paint) so concurrent page loads stay cheap.
- test_narrate_v2: production-shaped scene validates + no nested pollution.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…age selector

Env-gated v2 upload path so the live small-cuts Space's v1 /v1/cuts upload is
untouched (SMALL_CUTS_MODAL_API_VERSION=v2 opts in).

- modal_upload.ModalUploadClient.submit_video_v2: POST /v2/narrate (video +
  style_key + language), poll /v2/narrate/{job_id}; shared _poll_status extracted
  from the v1 _poll (v1 behavior preserved).
- viewer: _modal_api_is_v2() gate; _submit_modal_upload routes v1/v2 and gains a
  keyword-only language="English"; _go_modal_upload_ui + go.click thread language;
  a Voice-language dropdown (English/Spanish/Catalan/French) visible only in v2.
- tests: v2 client request-shape + v2 routing-with-language guard; v1 tests
  unchanged (keyword-only default) except the two direct _go_modal_upload_ui
  callers gain the positional language arg.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…discovered

Live verify caught it: a freshly published uploads/<id>/scene.json never appeared
on the v2 (manifest-less) Space until a restart. HfFileSystem (fsspec) caches
directory listings for the life of the fs object, so the relay's
glob("uploads/*/scene.json") kept returning the stale listing. Invalidate the fs
listing cache before each glob. The manifest (cat) path is untouched, so the live
small-cuts Space's manifest-based relay is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…i speech-output language

Omni's Talker speaks only en/zh/fr/de/ru/it/es/pt/ja/ko; Catalan voice is structurally
degraded. Carlos's call: keep en/es/fr (validatable by ear). Text-level Catalan unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Defeat the Talker's cold-start accent ramp and replace truncated-narration
titles, per the ratified narration-quality plan (forward-only, contract-neutral).

narrate_v2 (importable, unit-tested):
- native en/es/fr narration prompts + ~7-8s warm-up carriers + per-language prime
  instructions; build_narration_prompts / build_title_prompts / has_carrier
- clean_model_title (model-title parser; "Untitled" terminal default) and
  has_speech_content (rejects a punctuation-only carrier-cut tail)

midcuts_narrate (thin Modal wrapper):
- shared _omni_generate -> carrier-primed _narrate + text-only _title (the spoken
  pass can't emit JSON); _derive_title is now fallback only
- new L4 Aligner class in a separate qwen-asr image; cut_carrier trims the carrier
  via narrate_v2.carrier_cut_index; process() chains Omni(H200)->Aligner(L4) and
  computes duration from the trimmed wav
- smoke_aligner CPU pre-GPU gate

Adversarial review (5 dimensions, 7 confirmed) fixed before deploy: a blocker
(aligner image missing pillow-heif -> small_cuts import crash on L4), the
punctuation-only cut guard, the empty-title default, and degenerate-cut tests.

Gate green: ruff + format + 398 pass / 2 skip. Deployed and e2e-proven on GPU in
en/es/fr; voice ratified by ear.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…regression

Steps 1-3 of Mid Cuts v2 Phase 5 (autonomous; step 4 cutover stays gated).

- Step 1 (context steer): thread the upload "context" field end-to-end into
  /v2/narrate as a manner-of-delivery steer (HOW the moment is told, not its
  facts). Injected into the Omni system prompt BEFORE the carrier block so the
  warm-up trim is unaffected; empty context is a byte-identical no-op so the
  ear-ratified deadpan default is untouched. Narration only (not the title).
  New: narrate_v2.clean_context + per-language CONTEXT_INSTRUCTION; e2e gained
  --context for by-ear judging.

- Step 2 (anti-abuse): verify the v2 upload path already inherits the shared
  DailyProcessingBudget (reservation in the preflight, upstream of the v1/v2
  split) plus the v2 Modal endpoint's stricter Bearer/size/duration caps. Add
  two regression tests locking the invariant. No per-IP limiter (by design).

- Step 3 (CC captions): build timed_captions from the in-pipeline aligner via a
  new pure plan_carrier_cut, publish on the scene (contract v1.2.0, no bump),
  and add a soft CC toggle (OFF by default, persisted). Convert object cues
  {t_start,t_end,text} to the player's tuple shape server-side.

Gate: ruff + ruff-format + 421 pass / 2 skip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…Space-side)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e default

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ove language

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… player label shows

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ncated) + CC matches pill aesthetic

Gallery .caption-label was single-line nowrap+ellipsis, clipping the appended
"· LANG · Style". Allow 2-line wrap so the label stays visible. CC button was
dark-text-on-cream-box; restyle to gold-on-transparent (gold fill when on) to
match the other control-pill glyphs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…gle, a11y; relax upload caps

- Captions: _shelf_caption always emits 3 structured lines (title / language /
  style) via real newlines + white-space:pre-line + 3-line clamp; seed scenes
  annotated language="English". Consistent across seed and v2 cuts.
- Navigation: swap rewind/forward deltas (engine + local). In the newest-first
  rail (ascending scenes array), << = +1 = visually-left = newer; >> = -1 = older.
- CC toggle: move the gate class from <body> to .sc-theater. Gradio 6 prefixes
  every rule with ".contain", so a body-rooted selector never matches (<body> is
  an ancestor of .contain). Fixes both the caption gate and the active-state fill.
- a11y: stamp aria-labels on the 5 icon-only control buttons via the existing
  delegated-observer JS pattern (play/pause label is dynamic).
- Upload caps relaxed 2×: 80MB→160MB, 60s→120s.

Tests: +20 (captions/navigation/cc_toggle/a11y) + updated caption/cap assertions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… guidelines

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@macayaven
macayaven merged commit 30b7279 into main Jun 21, 2026
2 checks passed
@macayaven
macayaven deleted the feat/midcuts-phase4-space-push branch June 21, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant