Repository navigation
feat(lessons): make intro subtitles from the recording, per language - #1104
Conversation
…es them Localize `lessons.introAudio` and `lessons.introSubtitles` so each of the 19 languages carries its own recording and its own cues, and add the manager-only `POST /api/files/:id/subtitles` that turns an attached MP3 into cues. The Lemonfox HTTP client moves to `src/lib/lemonfox/` now that it has a second consumer — `tests/unit/lib-boundary.spec.ts` refused it there with one — and gains an opt-in `timestamp_granularities[]` so the meditation job's request body stays byte-identical. `words.ts` reads the vendor's word timings out of either `verbose_json` layout; `groupWordsIntoCues` turns them into cues of at most 30 characters, the length the 1,102 stored cues already measure. The migration and the field component follow in the next commits. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYzmBS4By2hWUNpeVy
…e migration The field component sits above the subtitles editor and fills it from the recording in the language being edited. Three things the prototype did not need and a real endpoint does: one request in flight at a time, an `AbortController`, and a latch on (file id, locale) so a resolve the field has moved on from is discarded rather than written into another language. `intro-subtitles-set` joins the Path Lessons readiness section, testing the array's length because an empty array is truthy. Both it and `intro-audio-set` answer per locale now that the fields do, with no change to `prepare`. The migration is hand-augmented, and is wrong without it: the generated delta adds the two `lessons_locales` columns and drops the base ones without reading them. Measured on a scratch Postgres seeded with 28 recordings and 28 cue sets: the generated DDL keeps 0 of each, this one keeps 28 of each, and an up/down round trip restores every lesson's own file id and cue text. The backfill upserts rather than updates, so a step whose only locale row is Czech gains an English one instead of losing its recording. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYzmBS4By2hWUNpeVy
…grouper The grouper, the word reader and the two admin URL builders get unit specs; the endpoint and the two newly localized fields get `tests/int/intro-subtitles`, which drives the real REST pipeline so the per-locale 403 is visible at all. Every assertion was watched failing first. Two of them caught real defects rather than fixture mistakes: the 415 message said "Attach one and try again" where the ticket asks for no offer to retry, and `normalizeLemonfoxWords` reached `assignWordsToSegments` with an empty segment list by a coincidence of two conditions rather than by a guard. The word reader now shares `normalize.ts` rather than taking a module of its own: with one consumer, `tests/unit/lib-boundary.spec.ts` refuses it in `src/lib`, and `KNOWN_SINGLE_CONSUMER` is closed to anything written after that spec. Both readers share one raw schema and one seconds-to-milliseconds conversion, which were about to be duplicated. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYzmBS4By2hWUNpeVy
A jsdom spec for the field component, because the latch lives between renders and no pure spec can state it: a resolve whose file id or starting locale is no longer the field's is discarded, and the cues reach form state and never the server. Each run's cues are traceable to the file that produced them, so "nothing was written" cannot pass for the wrong reason when swapping the recording legitimately starts a second run. `wemeditateAppStatus` gains `intro-subtitles-set` beside `intro-audio-set`, in English and in French, which is the whole of what "they answer per locale now" means. Its partial-lesson fixture carries an empty cue array rather than none, since an empty array is truthy and nothing else would catch a check reading truthiness. `tests/PERF.md` and its three consumers record 255 / 3473, the counts the tree now has. Timings are untouched — they belong to the sessions their rows name. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYzmBS4By2hWUNpeVy
`transcripts.source` is `unique`, so two admins pressing at once race on the insert and the loser's create is refused. It now re-reads and answers from the winner's row: those cues are for the same recording, which is what the caller asked for, and an unhandled refusal there answers 500 for a request that succeeded in every way the caller can see. Re-reading rather than matching the constraint's own error. That match is a Postgres `detail` string for a polymorphic relationship — the meditation endpoint carries why — and a row that now exists is the same answer whatever refused the insert. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYzmBS4By2hWUNpeVy
Four surfaces. `seeds/storyblok` named only two localized lesson fields and now names four, and says why the file-attach write agrees with the lesson upsert despite naming no locale. `.env.example` says what an empty `LEMONFOX_API_KEY` now costs — the Transcript tab and a 503 from the new endpoint, not just the tab. `docs/rules/access.md` gains the counter-example its own rule needs: "any future endpoint that gates then overrides owes `isOutsideWritableLocale`" is true only of a collection carrying a top-level `locale` column, and none of the three this endpoint touches does. Calling it there compares against `undefined` and narrows nothing, which reads as a guard and is not one. `docs/architecture.md` was already wrong before this branch: it said nothing re-requests a transcript, which #984's endpoint and the Transcript tab's button have done since. It now names both doors and what separates them — one queues a job, the other answers an admin synchronously under Cloudflare's 100 s limit. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYzmBS4By2hWUNpeVy
…unlocked **The cues the admin sees are now the cues the row holds.** `applyGlossaryToSegments` is a `beforeChange` hook on `transcripts`, so it rewrites the vendor's spellings to ours on the way in (#1084) — answering with what was sent handed the admin uncorrected words on the first press and the corrected ones on the second, for one recording. **A recording with no host is refused rather than sent.** `files.url` falls back to the relative `/api/files/file/<name>` with no delivery URL configured, which a non-empty test passes and the vendor cannot resolve. The integration lane was quietly exercising that path; it now mocks the R2 base, so every case sends the shape production sends. **The control no longer transcribes on a language switch.** The auto-start read "the locale held still since the last render" as a proxy for "a person attached this file". Payload moves `useLocale()` first and replaces form state in a later commit, so the new locale's own recording arrives as an audio change with the locale already settled — and a step with audio and no cues, normal in 18 locales, bought a vendor run on every switch. It now reads `audioChanged`, which is the question that was meant. **And a cue row no longer makes its recording immortal.** `transcripts.source` reads like a reference to `files`, so the orphan sweep counted it in use — measured, with no lesson referencing it in any locale. A cascade child's pointer is deleted with its parent, so it can never be why the parent is in use; `deleteChildren` now publishes its rules and the walk skips exactly those fields. The file-sourced row this endpoint writes is what made that reachable, which is why it lands here. Also from the review: the shared `errorResponse` and `refusalMessage` in place of three hand-rolled copies, `relationId` in place of a fourth id normaliser, a bounded `select` on the stored-cues read, and the filename read off the form value rather than a round trip for one bolded word. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYzmBS4By2hWUNpeVy
|
🚅 Deployed to the SahajCloud-pr-1104 environment in sahajcloud
1 service not affected by this PR
|
…o-subtitles # Conflicts: # src/migrations/index.ts
…counts `main`'s own `20261110_185320_merge_main_snapshot_6` snapshot was generated there, so it still has `intro_audio_id` and `intro_subtitles` on `lessons`. Being the newest by filename it is what `migrate:create` diffs against, and the run re-emitted all eight statements this branch's own migration already ships — replaying one aborts the boot migration. So `20261110_201010_merge_main_snapshot_7` keeps only its `.json`, generated on the merged tree, with empty bodies and no copy of the backfill. A probe run after it writes no files, which is the proof the chain healed. `tests/PERF.md` and its three consumers record 3492, the count the merged tree has. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYzmBS4By2hWUNpeVy
sydevs-bot
left a comment
There was a problem hiding this comment.
1 question for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
This matches #1016 part for part, and nothing in it looks bigger than the problem. The only unticketed work is the cascade-child fix and the refusalMessage export, both joined. The migration is the real risk and it is handled: up adds the locale FK before the backfill, down adds the base FK after it, and ON CONFLICT covers a step whose only locale row is not en. Every finding below is about where a piece lives, not whether it should exist.
Findings
should-fix—deleteChildren's doc block, example and all, now hangs on the newCascadeHooktype (cascadeDeletion/index.ts:68).consider—introSubtitlesUrlis the sixth hand-rolled?locale=admin URL builder (introSubtitlesModel.ts:15).consider— the cascade reader and its structural guard sit in the consumer, not incascadeDeletion(schemaUtils.ts:351).consider— the endpoint's comments argue with designs that are not there (Files/endpoints/subtitles.ts:32).consider— a segment withwords: []drops its bucketed top-level words (normalize.ts:115).
What was checked
Read whole on the branch: the endpoint, IntroSubtitles.tsx, subtitles.ts, normalize.ts, cascadeDeletion/index.ts, schemaUtils.ts, Lessons.ts, the migration, and requireManagerPermission.ts for the locale scope. Ladder: relationId, originOf, refusalMessage, Payload's filterOptions save-time validator and the @payloadcms/ui banner and modal are reused; groupWordsIntoCues, normalizeLemonfoxWords and CascadeHook are the net-new pieces, and the grouper counts length right. payload-types.ts moves by one description string, and a grep of the three sibling repos finds both field names only inside generated copies. All three preview links answer 200, and this repo seeds none, so the empty list reads as the body says.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`segment.words ?? buckets[index]!` fell back only when `words` was absent, so a segment carrying `words: []` kept the empty list and the top-level words bucketed into it were dropped. A segment with a present-but-empty list carries no words, which is the case the fallback is for. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXaoFFWnbcCmcFMF36
The new `CascadeHook` type landed between the function and its own doc block, so hover on the type showed the function's `## Example` and `deleteChildren` was undocumented. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXaoFFWnbcCmcFMF36
The structural test for `cascadeRules` sat in `CleanupOrphanedMedia`, reading a property `src/lib/cascadeDeletion/` publishes from the consumer's side. `cascadeChildPairs` puts the guard beside the type it describes, so the job holds no knowledge of how a cascade is spelled and a second consumer gets the same answer. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXaoFFWnbcCmcFMF36
Three blocks argued against designs that are not here: a `collection` query parameter nobody wrote, matching the unique constraint's `detail` string rather than re-reading, and `requireActiveClient`, which docs/rules/endpoints.md wants one line for. Every ⚠ naming a real constraint stays — the 100 s bound, the absolute URL, the glossary read, the race. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXaoFFWnbcCmcFMF36
|
Addressed the adversarial review — 4 adopted, 1 rebutted. Pushed Adopted
Rebutted
Lean gate green: 3493 tests. The security sweep re-ran for The cue-gap question thread stays open. It waits on you. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
A file's language lived on its transcript row, so it could only be changed through a custom control posting `?language=` to the transcribe endpoint, and a meditation's transcript carried a copy of the meditation's own `locale`. - `files.spokenLanguage` is a stored select. An uploader states it, or the first run detects it and writes it back, flagged so the save hook does not read it as a correction. Editors hold `files: create` alone, so after upload only an admin changes it. - `transcripts.language` is gone. The run and the glossary pass read the language off the recording: a meditation's `locale`, a file's `spokenLanguage`. - `syncTranscriptOnSave` transcribes again when the recording's file or its language changes, for both collections. A change supersedes a run in flight, as a replaced recording always has; only the one-click endpoint bounds runs by cost. A video re-runs for a language change once its run has started. - `replaceTranscript` is the one delete-and-create, shared by the save hook, the Stream trigger, the endpoint and the file-transcripts seed. - `SpokenLanguageField` and the endpoint's `?language=` are deleted. The mismatch warning reads the file's language off the transcript poll, which now populates it, and tells an editor what they can do about it. - Migration 20261112_213652 adds the column, copies each file's language off its transcript, and drops the old one; down restores it from the file or the meditation. Up, down and up again verified on a scratch database. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…seRetryTranscript - `RecordingTranscript/` is `TranscriptPanel/`, matching the `transcriptPanel` field both collections declare; bare `Transcript` would collide with the generated row type the same files import. `useRecordingTranscript` is `useTranscript`. - `useTranscript` only reads: the row, the phase, a `reread`, and where a retry posts. The POST, its toasts and which refusals re-read the row move into `useRetryTranscript`, its one caller now the Spoken language control is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#1136 cut change amplification out of the unit lane: it took the file and test counts out of every doc and spec that quoted them, leaving `tests/PERF.md` as their one home. This branch had bumped those same counts. Every doc hunk takes main's side — AGENTS.md, testing-reqs.md, tests/AGENTS.md, and PERF.md's second-session metric row, which is a measurement and not this branch's to replace. `admin-locale-urls.spec.ts` is the same conflict in a docblock: main stopped counting the call sites, this branch had counted a fifth. Main's wording stays correct as sites are added, so it wins. `meditation-transcript-tab.spec.ts` keeps both intents. Main deleted the standalone stall case as redundant and moved its no-duration assertion into the fake-timers case it kept; this branch's copy change — these notices are titles, so no full stop — stays on every assertion. One semantic consequence, fixed rather than merged: #1136's new `openapi-endpoint-coverage.spec.ts` requires every client-callable collection endpoint to be in the OpenAPI document, and this branch adds `POST /api/files/:id/transcribe`. That endpoint gates on `requireManagerPermission` and takes no client key, exactly like the meditations twin already exempted there, so it joins `MANAGER_ONLY` with its reason. main added no migration since the merge base, so no snapshot repair. Lean gate green on the merge: lint, format:check, typecheck, typecheck:tests, test:unit (272 files, 3712 tests, 52.28 s). Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX2b1oZam54PpdTewz
|
Merged
One consequence the merge could not resolve by itself. #1136 added main added no migration since the merge base, so no snapshot repair this time. Lean gate green on the merge: 272 files, 3712 tests, 52.28 s. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…edia - A save on the recording's own page re-reads its transcript. A save that changes the language or replaces the recording replaces the row, and nothing polls a finished one, so the panel kept the old cues until a reload and the save looked like it did nothing. Keyed on Payload's `lastUpdateTime`, so it skips the page load and a Path Step's own save. Meditations' tab gets it too. - Spoken Language shows only for an audio or video file, the one chosen on the create form included. A thin wrapper over Payload's `SelectField` decides, since `admin.condition` runs on the server and an upload's type is stored only once it is saved; the browser knows the chosen `File`'s type. - The description says a change applies on save. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Moved below the transcript, and hidden on the create form, where it was an empty box. Its `hideUntilCreated` condition makes Payload generate `File.createdAt` as optional and nullable, so the orphan sweep's structural types, which only log the value, accept that. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the type list Main's #1136 keeps a matrix in one home. The mounted field needs only to show it reads the stored type and the chosen file's, so the video rows go. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@sydevs-bot review |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Fifth look, asked for. Everything pushed since the fourth is the reviewer's own, so I read it for defects, not for scope. The design it lands is smaller than the one it replaces: transcripts.language is gone, a file states its own spokenLanguage, and the glossary pass reads that recording instead of a copy of it.
What is wrong is the body, again, on new facts. Three of its sections describe db5488c, and the branch is seven commits past it — one of them a second migration.
Findings
should-fix—## Migrationsays one migration. The branch carries two, and the second dropstranscripts.languageand its enum outright (20261112_213652_files_spoken_language.ts:19).should-fix—## Change outlinewiresRecordingTranscript#…, a directory not on this branch, and still callstranscripts.languageoptional (Files/Files.ts:96).consider— a video with no transcript row ignores a stated language, which the field's own description promises will re-run it (lib/transcripts/sync.ts:112).
What was checked
Read whole on the branch: both migrations, lib/transcripts/{sync,request,read}.ts, Files.ts, applyGlossaryToSegments.ts, glossary.ts, TranscriptPanel/{SpokenLanguageField,useTranscript}. Checked, not read off the body: migration 1's down deletes language IS NULL rows before it restores NOT NULL, so migration 2's COALESCE(spoken_language, locale) returning NULL cannot break the chain down; migration 2's up backfills through a unique transcripts_rels.files_id, so it cannot fan out. git grep RecordingTranscript finds nothing here. Ladder: hideUntilCreated, SelectField, useFormFields, extractID and baseLanguage are reused; files.spokenLanguage and recordingLanguage are net-new. No ## Preview section, so nothing was opened in a browser.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
A video's first run belongs to Stream's `ready` webhook, so a saved `spokenLanguage` starts nothing for a video with no transcript row — every video uploaded before #1016, and a video between its upload and Stream's answer. The field's description promised a re-run anyway. It is not the hook that was wrong. Queueing a run there while Stream is still preparing the MP4 burns the 100 s wait and then leaves the webhook a row naming the filename, which `transcribeStreamVideo` skips — so the automatic first run would be lost to save a click. The panel directly below the select already offers Transcribe for a recording with no row, in the language just saved, gated on the `files: create` every uploading role holds. So the description says that, the hook's docblock says why the arms differ, and the panel spec pins the offer the answer rests on. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZ2vQkf9Z16HE2c1uL
|
Fifth round: three threads, one commit, a body rewrite. Adopted
Also found while rewriting: a saved language supersedes a run in flight, not refused. Rebutted: the squash, and that thread's other half. A regenerated migration crash-loops a preview that ran the old one ( Green on 5c556cb: 3721 unit tests in 272 files, 160 integration cases in 7 specs. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#1127 made the mailing-list API key write-only and dropped `clients.mailing_list_enabled`. Two files conflicted, and both took both sides. `src/migrations/index.ts`: main's `20261112_211802_drop_mailing_list_enabled` registers between this branch's two migrations, in timestamp order. `tests/PERF.md`: the session table is append-only, so the two sides numbered the same rows differently. Both sets of rows are kept, each side's relative order preserved, and the ordinals renumbered from the fiftieth. `20261112_234150_merge_main_snapshot_9` carries the snapshot the merged tree needs and no DDL. This branch's `20261112_213652_files_spoken_language` snapshot is the newest by timestamp and still holds `clients.mailing_list_enabled`, so `migrate:create` re-emitted the drop that main's migration already ships. A probe run afterwards writes nothing. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZZbcvj2E56uPJHKA1
|
Merged
A third migration is new, where the body's Migration section lists two: Lean gate green on the merge: 273 files, 3733 tests, 63 s. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Ardnived
left a comment
There was a problem hiding this comment.
Additionally, can we streamline any of the new folders or files?
A transcript's recording states its language in a column whose name depends on the collection, and three readers spelled the pair separately: the glossary hook branched on `relationTo` and ran its own read per arm, while `syncTranscriptOnSave` took the column name as an argument. `RECORDING_LANGUAGE_FIELD` in `src/lib/transcripts/read.ts` is now that pair, beside `recordingLanguage`, which is one read for either kind — `draft: true` is a no-op on a collection with no drafts, so the meditation arm needs no branch. The save hook reads the table instead of taking the name, so its two call sites cannot pass a column the glossary pass does not read. In `read.ts` rather than `language.ts` because `language.ts` is imported by a `'use client'` component, and a database read there would reach the browser bundle. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVL5Ajna7LdYyeJPpz
`SpokenLanguageField` existed on the belief that `admin.condition` cannot see the file an editor has just chosen, because an upload's `mimeType` is stored only on save. It can: the browser writes the chosen `File` to form state's `file` path, the edit view sends that whole state to the `form-state` server action, and `buildFormState` reads `formState.file` off it before evaluating every condition. So the field is Payload's own select with a condition, one fewer registered component, and `formIsRecording` is the predicate — the staged file's type, or the stored one on a saved file. The panel spec keeps the same five cases against that function rather than a mount. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVL5Ajna7LdYyeJPpz
|
Two commits, both generalisations you asked for. Adopted
Open for you, each with A/B in its thread: renaming
Lean gate and all 7 integration specs green on adc0d6f. The body gains the third migration it never named, and loses three stale sections. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
`usePlaybackTime`, `useSeekToTime` and the `playbackTimeStore` behind them sat in `FrameEditor/`, which the transcript panel reached through that folder's barrel for a module the frame editor does not own. Two component families share them, which is what `docs/rules/admin-ui.md` keeps `admin/helpers/` for. `FrameEditor/hooks.ts` keeps `useAvailableFrames` — frames by narrator is its own — and the barrel stops exporting the two hooks. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjY7UiiKcYb6s492hq6
|
Both your answers built, in one commit. Adopted
Nothing is open for you now: Lean gate green on 0c46c05: 273 files, 3733 tests, 126 s. The commit moves two admin hooks and changes no behaviour, so the integration specs stand as measured on adc0d6f. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Two conflicts, both in docs that every PR appends to. `tests/COVERAGE.md` — `main` renamed `reviewMove` to `SUBMISSION_MACHINE`, and this branch had added the `POST /api/files/:id/transcribe` row beside the Proposal review lifecycle row that names it. Both rows are kept, the lifecycle row in `main`'s wording, which is the symbol the merged tree exports. `tests/PERF.md` — both sides appended measurement rows and so renumbered the ordinals from the fiftieth on. The union is kept in each side's own order, `main`'s four #1121 rows last, and every ordinal is re-derived from the merged position. No row is dropped or rewritten. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWCzJrp6J4TFdSuBqv
274 files / 3784 tests in 56.90 s, on the usual 4-core routine container. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWCzJrp6J4TFdSuBqv
|
Merged
Lean gate green on the merged tree: 274 files, 3784 tests, 56.9 s. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
files.spokenLanguageis a stored column — stated on upload, or filled in by the first run — andtranscripts.languageis gone, because a meditation's was always a copy of its ownlocaleand a copy can disagree. The run and the glossary pass read the recording, through one table naming the column each kind of recording states it in (29e8bec).POST /api/files/:id/subtitlesendpoint, its 90 s bound, and the IntroSubtitles control (modal, Undo, "already made" message) that this PR first shipped.src/components/admin/TranscriptPanel/holds the body every surface renders, two field components and the language warning;useTranscriptis the one read anduseRetryTranscriptthe one retry, for a meditation and a file alike. Spoken language needs no component of its own (adc0d6f).usePlaybackTime,useSeekToTimeand the store behind them move fromFrameEditor/tosrc/components/admin/helpers/, because the transcript panel reads the same clock and was reaching through the frame editor's barrel for it.InfoBanner'sactiontook any ReactNode, so five banners drew theirs three ways. It is now{ label, href }or{ label, onClick, disabled? }, always a small secondary Button after the text, andJobStageView's Check again moves inside its banner. Joined here because this PR's Transcribe-again is one of the five, anduseRetryTranscriptreplaces the RetryTranscript component on the way.lessons.introSubtitlesstays as a read-only computed copy for app releases that still read it, and refactor(lessons): drop the computed introSubtitles copy #1133 removes it after that release is out.panels[].subtitlesis dropped now, because production holds no data in it.Closes #1016
What an editor sees
Path Step, Meditation tab: Intro Audio (MP3 only). Below it, a read-only Intro Subtitles preview of the file's transcript, with one of these states:
It warns when the recording states a different language than the one being edited. Panels show the same preview under a video.
File, edit view: a Spoken language select — shown for an audio or video file only — and below it a Transcript panel (the meditation one, generalised). Saving a change to the language transcribes the recording again, for every page using the file, superseding a run in flight as a replaced recording always has: its cues would be in a language the recording no longer claims. The cost bounds feat(meditations): give an editor a way to ask for a transcript again #984 Decision 2 asks for sit on the Transcribe button instead — the control one click reaches — which refuses a run in flight, a finished transcript, and a second request inside the cooldown.
A recording with no transcript yet is transcribed from that button, in the language just saved: a video's first run belongs to Stream's
readywebhook, so a save cannot start one. The recording plays beside the transcript once a run has settled, a failed one included. Uploaded At sits last, and only on a saved file.Who may change it: every editor role holds
files: createand noupdate, so an editor states the language on upload and an admin corrects it after.Launch Readiness:
intro-subtitles-setmeans the locale's intro file has a finished transcript and states that locale's language. A recording in another language is the mismatch the editor is warned about, so it does not read green here.Change outline
Migration
Three migrations ship, in this order.
20261112_184359_file_transcripts_replace_intro_subtitles— the Path Step rework. It moveslessons.intro_audio_idintolessons_locales, dropslessons.intro_subtitlesandlessons_panels.subtitles, rebuilds the provider enum to addimported, backfills the 28 hand-made English cue sets as their files' transcripts, and dropsNOT NULLfromtranscripts.language. Three hand edits, all approved: theenlocale copy (INSERT … ON CONFLICT DO UPDATE, because a step created under another admin locale has noenrow to update), the cue backfill (one transcript per file, from the lowest-numbered step using it, and a file that already has one keeps it), and the enum rebuild instead ofADD VALUE, so the same transaction can useimported. 8535a41 squashed this PR's six into it — two carried schema, four were snapshot-only repairs aftermainmerges.20261112_213652_files_spoken_language— the language moving onto the recording. It addsfiles.spoken_languageand its enum, copies each file's language off its transcript, then dropstranscripts.languageandenum_transcripts_language. Two hand edits, one each way:upreads the transcript's language before the column goes, which the generated delta does not;downrestores it from the file, or from a meditation's ownlocale, so migration 1'sdownfinds a language on every row it keeps.20261112_234150_merge_main_snapshot_9— snapshot only, no DDL. The ninthmainmerge brought20261112_211802_drop_mailing_list_enabled, whose snapshot was generated onmainand knows nothing of this branch, while this branch's own newer snapshot still carriedclients.mailing_list_enabled— somigrate:createre-emitted a dropmainalready ships. The file keeps only its.json, generated on the merged tree, which heals the chain (src/migrations/AGENTS.md, "The out-of-order snapshot trap"). A probemigrate:createafterwards writes nothing.Why 1 and 2 are stacked and not squashed.
src/migrations/AGENTS.mdrefuses a regenerated migration once its branch has deployed — the preview keeps the old columns with nopayload_migrationsrow naming the new file, and crash-loops on its firstADD COLUMN. The chain between them is also load-bearing: migration 1's backfill writeslanguage = 'en'on the imported rows, and migration 2 reads exactly that intofiles.spoken_language, so one file would have to re-derive both halves. What the stack costs is oneDROP NOT NULLon a column the next migration removes.Verified on a scratch database migrated to
main, seeded with shared, already-transcribed, non-English-only and subtitle-only steps:up,downandupagain, each with the expected rows.⚠ The PR preview ran the six pre-squash migrations, so its Railway environment needs resetting — its boot otherwise replays DDL it already carries (
src/migrations/AGENTS.md). Production has run none of them and is unaffected.After deploy:
pnpm seed file-transcriptsqueues a transcript for the roughly 49 audio and video files uploaded before this. It costs one paid Lemonfox run per file and needs a production sign-in link (seeds/AGENTS.md). It has not been run.Test results
Lean gate re-measured on 0c46c05, this branch's head: ✓ lint, format:check, typecheck, typecheck:tests, test:unit (273 files, 3733 tests), 126 s. Everything below is adc0d6f, which 0c46c05 moves two admin hooks out of
FrameEditor/and changes no behaviour in.file-transcripts(23),meditation-transcription(40),meditation-transcripts-seed(11), andmeditation-transcripts,wemeditateAppStatus,cleanup-orphaned-media,lessons(86 together).cloudflare-stream-webhookis a unit spec, and ran in the lane above.file-transcriptsreads a page of three transcribed files and counts thetranscriptsqueries: 1 withreadFileSubtitles's batch, 3 with it removed.SpokenLanguageField's spec held, watched failing with the staged-file read removed.subtitlesfield orreadFileSubtitles. The app's own Path Step query returnsintroAudio.subtitlesandpanels[].media.subtitleson the populated files, and the oldpanels][subtitlesselect key is ignored rather than refused.Filethat theform-stateserver action carries, whichbuildFormStatewas read to confirm but no browser has exercised. A create form that hid the select would hide it from the only role that states a language on upload.Notes for reviewer
introSubtitles,POST /api/files/:id/subtitles, and the IntroSubtitles control. The ticket was never revised after the rework, so its checklist cannot gate this PR; refactor(lessons): drop the computed introSubtitles copy #1133 ratifies the new shape. Read this body as the spec, or say the word and feat(lessons): make intro subtitles from the recording, per language #1016 gets revised to match.src/lib/transcripts/cues.tssays so beside the bound.spokenLanguagekeeps its name (thread), so no third migration ships. The live-preview playhead moved toadmin/helpers/(thread).🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjVL5Ajna7LdYyeJPpz