Repository navigation
feat(admin): a Transcript tab beside the meditation player - #985
Conversation
The query, the phase, the paragraph split and the playhead lookup, with no React and nothing that reads a file. Milliseconds on the row, seconds at the two playhead seams, converted in `seekSecond` alone. `transcriptPhase` takes `now` so the stall bound is testable without a clock stub, and derives `stalled` from `updatedAt` against the same `TRANSCRIPTION_STALL_MS` the collection passes `jobStage.staleAfterMs` — two spellings of one bound would drift. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MNp5xnsKHsZPKBdgTjKFtK
Timed paragraphs split at a three-second pause, a moment-of-silence line for a ten-second one, read-along highlighting that follows the playhead, and click or keyboard to play from any phrase. A client component reading the ordinary `meditation-transcripts` list path, not a server one reading `seeds/`: that directory is excluded from the production build trace (#471), so the proposal's screen would read "no transcript yet" on every preview and in production while the data sat in the database. It reads the collection rather than the `meditations.transcript` join, which carries the same row but resolves once at page load, so a run finishing could never arrive. Each phrase is a span with `role="button"`: a button is atomic inline-level in Firefox and Safari whatever its `display`, so a long phrase would be pushed whole onto the next line instead of fragmenting like the running text it is. Focus is an outline and the playing phrase a background tint, so a keyboard user can see which plays while another has focus. No retry control ships. There is no write path for one on `main` — both endpoints are gone and `meditations-editor` holds no write on the collection — and #984 carries that decision. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MNp5xnsKHsZPKBdgTjKFtK
Mounted in jsdom against stand-ins for `@payloadcms/ui` and `swr` alone, so both playhead seams stay real: the playhead arrives as a `PLAYBACK_TIME_UPDATE` message through `playbackTimeStore`, and a seek is read off the live-preview iframe's own `postMessage`. Each case was watched failing with its defect reintroduced — the key handler dropped, the phrase made a `<button>`, `aria-current` moved onto the paragraph wrapper, the `refreshInterval` arrow inlined, the paragraphs gated on `status`, and the locale guard removed. The poll case asserts the function's identity across re-renders rather than its answer: a new arrow each render is what re-arms SWR's timer from zero, and no assertion about the returned number can see that. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MNp5xnsKHsZPKBdgTjKFtK
Reuse and altitude fixes from the branch review: `transcriptUrl` builds its query with `qs-esm`, the idiom `relationshipDocLoader` already uses for this shape, instead of hand-escaping a `where` clause. `TRANSCRIPTION_STALL_MS` moves to its own zod-free module, re-exported from `lib/meditations/transcript`. The tab is a client component, so reaching the bound through that module shipped zod and both cue schemas to the browser to describe a shape only the server validates — the reason `framesBeyondDuration` sits apart from `./frames`. `useFollowPlayhead` takes `enabled`. It is called above the component's early returns, as the hook rules require, so every meditation with no transcript was installing three window listeners with nothing to follow. Its spec is new: the listeners, their removal, the stand-down and the in-view guard are the one behaviour here that lives only between mounts, and nothing covered them. `transcriptUrl`'s cases move to `admin-locale-urls.spec.ts`, which says it is the one home for the #701 URL strings and whose count had gone stale. The `refreshInterval` case keeps the wiring and drops the phase table the model spec owns. The two `useMemo`s stay. Collapsing them reads better and fails `react-hooks/preserve-manual-memoization`, which refuses a dependency it cannot prove stable. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MNp5xnsKHsZPKBdgTjKFtK
`architecture.md` still listed `GET`/`POST /api/meditations/:id/transcript`, and `COVERAGE.md` still claimed a 403 matrix, a `status: 'none'` and an `outdated` transcript for them. None of the three exists: #968 removed both endpoints with `requireTranscriptAccess` and `toTranscriptView`. The Transcript tab reads the collection, which is what made the staleness visible. `admin-ui.md` names the Transcript tab beside the frame tabs as a `previewTargetField` declaration, and `COVERAGE.md` gains the tab's own row. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MNp5xnsKHsZPKBdgTjKFtK
|
The three findings this PR's review dismissed as out of scope are filed as #986: the job-stage stall rule re-derived instead of read off the collection's declaration, a Payload REST list fetcher that exists three times, and two hand-written import-map specs standing in for one general rule. None is a defect today. Each is a rule with a second implementation beside it. 🤖 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
The diff is the ticket and no larger: five new modules, each on §0's file list, and src/payload-types.ts is byte-identical, so no contract moves. The three abstractions it declines — a shared admin list fetcher, a runtime runningStages lookup, a retry path — are filed as #986, #983 and #984 rather than half-built. I do not reopen them.
Two things I would ask about: a notice naming a tab that does not exist and an action an editor may not take, and a phase change that looks unable to reach the screen.
Findings
- should-fix — the "no transcript yet" copy sends the editor to an "Audio tab". There is none, and
restrictUploadToAdminrefuses the upload to an editor anyway.MeditationTranscript.tsx:109. - should-fix —
pending→stalledturns on the clock with no render to carry it, so the in-progress spinner looks permanent.MeditationTranscript.tsx:101. - consider — the pending notice rebuilds what
JobStageView.tsx:75already makes fromBanner+Spinner, and the four notices land as three shapes.MeditationTranscript.tsx:113.
What was checked
- #955 §0–§8 against the diff, criterion by criterion.
- Read whole: the four new modules,
Meditations.ts(tab labels,upload,AudioUploadat :184),MeditationTranscripts.ts,status.ts,FrameEditor/hooks.ts,playbackTimeStore.ts.deriveTranscriptStatusanswerscompletedfrom the cues alone, so the cue gate cannot disagree with it. meditation-transcriptssits in bothmeditationsprojects (config/projects.ts:34,62), so the read needs no new grant, andtranscriptUrlnames the locale and refuses without it (#701).- No generated type, endpoint, migration or role grant here, so nothing re-syncs downstream.
- Preview:
/admin/loginand the meditations list both 200. Not signed in, so the manual steps are unchecked.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`meditations` is an upload collection, so the recording is Payload's own Upload control above the tabs — there is no Audio tab, and the tabs are Mobile, Details, Publishing and Video. `restrictUploadToAdmin` also refuses replacing that file to a `meditations-editor`, so the old copy sent an editor to a control that does not exist and that they could not use either. The notice now states what happens and asks for nothing. The spec refuses any mention of a tab, rather than pinning the sentence. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014A72qJ2wSs3QK3gRshWQtX
The `stalled` notice was unreachable in the case it exists for. SWR compares what it fetched, so a run nothing will finish answers every poll with the same row and renders nothing; the playhead ticks only on a preview message, and nothing plays while a transcription is in flight. The in-progress notice and its 3 s poll therefore stayed up indefinitely. `useStallDeadline` schedules one timer at `updatedAt + TRANSCRIPTION_STALL_MS` and re-renders there. Nothing else changes: the phase derivation and the bound are the ones already shared with the row's own Edit view. The spec advances fake timers over a row that never changes, which is the state the defect needed, and goes red with the hook call removed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014A72qJ2wSs3QK3gRshWQtX
Two of them were hand-rolled: `none` a bare paragraph, `pending` a flex row built from a Spinner and two muted blocks, so the four phases read as three kinds of thing. `JobStageView` already renders this exact notice from Payload's own parts, and the admin-UI rule is to prefer a built-in over styling our own. `Banner`'s `icon` slot takes the Spinner, which leaves the component with no notice styles at all: `.progress` and `.muted` are gone, and `.status` keeps only the rule that hides it when no phase renders. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014A72qJ2wSs3QK3gRshWQtX
|
All three review findings adopted, pushed at c1a4e70. The branch was already level with
Nothing rebutted, nothing asked. Lean gate green, 2623 cases. Each new assertion was watched failing. The body's outline, file list and counts are refreshed. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
🚅 Deployed to the SahajCloud-pr-985 environment in sahajcloud
1 service not affected by this PR
|
Reduce the Transcript tab, as review asked, without moving its parts somewhere a reader has to go looking for them. The four phases with nothing to read were four inline branches that had already drifted into three shapes once. They are one table of `Banner` descriptions now, rendered in one place, so the next notice cannot land as a fourth shape. `useStallDeadline` becomes `useTranscriptPhase`: the derivation and the timer that makes `stalled` observable were two calls the caller had to make together, and a caller taking the phase without the timer is the defect the review round already caught once. One hook cannot be held half-way, and the component stops restating `status === 'processing'` beside a function that already decides it. No copy, markup or behaviour changes: the same 40 cases across the tab, model and wiring specs pass untouched. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019odYn18JMKpGZKmyodspSS
|
One of three threads adopted, pushed at 0ed0580.
Lean gate green: 2633 unit cases. The body's outline and file list are refreshed. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Merging `main` brought #985's four specs in, so the recorded 198 files and 2575 tests described the branch before the merge. The new spec is a fifth. 203 / 2643 now, and the figure pinned in all four consumer docs follows. Re-measuring on the current base also turned up something about the figures themselves. Three runs give a 77.9 s median against the first session's 59.2 s, on the same container spec, the same day, for 2.5% more files — and the three runs fell monotonically from 82 s to 73 s as caches warmed. So a single container's reading is reproducible to about ±30% and no better. Both samples are recorded rather than one replacing the other, the slower median is what the consumers quote, and the file says not to read a 20% move as a regression. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014mDVAnCGQKXxtEwbwXQ7Zq
main gained #978 (translating a Path Step no longer overwrites its English text) and #985 (the admin Transcript tab). Three files conflicted. Each was touched on this branch only by 3b05cad, the pure `prettier --write` commit, so each took main's content and was re-formatted rather than merged hunk by hunk — there was no hand-written side to weigh: - docs/architecture.md — main drops the `meditationTranscript` endpoint row - src/jobs/CleanupOrphanedMedia/schemaUtils.ts — main's `localizedAt` tracking - tests/COVERAGE.md — main's new rows `prettier --write .` then ran over the whole merge result. That is part of the resolution, not a separate change: four of main's files auto-merged unformatted (CleanupOrphanedMedia.ts and three unit specs), and the `format:check` step this branch adds would have failed on main's own files. For all 36 files main changed, the merged content is byte-for-byte `prettier(main's version)`: 29 formatted files reproduced exactly, 6 prettier-ignored files identical to main, and src/payload-types.ts — the one hybrid of two generator renderings — reproduced exactly by `pnpm generate:types`, twice in a row. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RwENrwzLpaNpXvFXVnvGFR
Summary
architecture.mdandCOVERAGE.mdstill documented the two transcript endpoints feat(meditations): transcribe a recording when it is added #968 deleted. Dropped.Change outline
Components — the tab, and where it mounts
The tab is the first of the Video tab's nested tabs, so the panel it reads beside is already the right page.
A client component, with both playhead seams already shared by the frame editor.
Behaviour — which notice, and when it polls
⚠ A poll is not a render. SWR compares what it fetched, so a stuck run answers every poll with the same row and renders nothing — the bound above would pass unobserved and
pendingwould stay up for good.useTranscriptPhasecarries the one timer that makesstalledreachable, and it is what stops the poll as well. The phase and that timer are one hook because a caller holding either alone is that defect.A replaced recording has no state of its own: #968 deletes the row and queues a fresh run, so it reads
none, thenpending. That is why the Decision's "plain notices when the recording has changed" renders nothing, and why success line 9 no longer describes the system —## Noteson the ticket owns that.Files — what each module owns
Contract — nothing a consumer observes
A
uifield adds no column, no generated type and no API surface.src/payload-types.tsis byte-identical, there is no migration, and no contract re-syncs to WeMeditateWeb or SahajAtlasWeb.Preview
Sign in by asking for a link as
PREVIEW_ADMIN_EMAIL.Data: not seeded.
previewUrl.seedis unset for this repo and a PR preview boots with only its admin manager, so both links land on an empty collection until the reviewer creates a meditation. Uploading a short recording to it is what starts a transcription — the preview inherits the live Lemonfox key, which no local run has. The ticket's verification checklist walks the four notices and the keyboard route in order.Phases
Test results
pnpm lint,pnpm typecheck,pnpm typecheck:tests,pnpm test:unit(202 files, 2633 cases) — re-run on the current head, withmainmerged intests/int/meditations.int.spec.ts24 passed — the regression check for a collection that gained a tabEvery new assertion was watched failing with its defect reintroduced — 22 of them, listed in the detail below.
Manual verification
Tabthrough the phrases, confirm a visible focus ring on each, pressEnteron one andSpaceon another, and confirm the playing phrase stays visibly marked while focus sits on a different one.jobinpayload-jobserrored, reopen, confirm the run's own message shows.Steps 2 and 5 are the two this PR cannot prove locally: a real transcription needs the preview's Lemonfox key.
Notes for reviewer
main— both endpoints are gone andmeditations-editorholds no write onmeditation-transcripts— so feat(meditations): give an editor a way to ask for a transcript again #984 carries that decision. Every other notice is here.<span role="button">, not a<button>. A button is atomic inline-level in Firefox and Safari whatever itsdisplay, so a long phrase would be pushed whole onto the next line instead of fragmenting like the running text it is. The 881 branch'sdisplay: inlinebutton does not fix that.roleplustabIndexplus a key handler is the patternReadinessGroupalready uses here.JobStageViewdeliberately does not. That view serves a row's own Edit page, opened once; this one sits beside a player someone is listening to while a run finishes. Both go stale on the sameTRANSCRIPTION_STALL_MS, so neither spins forever — the tab becauseuseTranscriptPhaserenders there.Detail
The adversarial round. All three of its findings were adopted: the "no transcript yet" copy named an Audio tab that does not exist and an upload
restrictUploadToAdminrefuses to an editor (bb4b595);stalledwas unreachable because nothing re-rendered at the bound (96e98d8); andnoneandpendingwere hand-rolled whereJobStageViewalready builds this notice fromBannerplusSpinner(630c8b0). The third left the component with no notice styles at all.The review round (2026-10-20).
mainmerged in clean (a311149). One finding adopted in 0ed0580: the four notices became one declarative table ofBanners, anduseStallDeadlinebecameuseTranscriptPhase, so the phase and the timer that makesstalledobservable cannot be held apart. Two questions answered with evidence rather than code — whytranscriptStall.tsis its own module and why the job cannot mark itself stalled, and that clicking a phrase already seeks to it.The review pass.
/code-reviewis not available to a routine, so this ran/simplify's four angles (reuse, simplification, efficiency, altitude) over the full branch diff, pluscomment-lint.mjs(clean, 11 files). The security review was skipped: no changed path matchessecurityReview.triggerPattern.Applied: the
qs-esmquery builder; the zod-free stall module;enabledonuseFollowPlayheadplus the spec it had none of;transcriptUrl's cases moved toadmin-locale-urls.spec.ts(whose own "two of the three" count had gone stale); therefreshIntervalcase trimmed to the wiring;transcript_panel→transcriptPanel, matching its siblingframeInserter;0.8125rem→calc(var(--base-body-size) * 1px), the same size as a token; four unreachable or duplicated assertions dropped; roughly 40 lines of comment cut, including every pointer at a success-line number or a ticket section, which get renumbered.Dismissed:
jobStageWaitinstead of comparingupdatedAtyourself. The bound is already the shared constant,isStaleis not exported, andjobStageWaitwould require restatingrunningStages: ['processing']in the tab — moving the duplication to the half that can actually drift. The reported divergence does not exist either:NaN > nis false, so both read an unparseableupdatedAtas pending.runningStagesoff the collection'sadmin.customthroughuseConfig(). The deeper fix, and genuinely better — it needsstages.tsto export its predicate and the tab to take a runtime lookup. Out of this PR's scope; filed rather than half-built.useMemos. Tried, and it failsreact-hooks/preserve-manual-memoization, which refuses a dependency it cannot prove stable. A module-level empty array does not satisfy it either. The comment now says so, since the simpler form reads better and does not compile.groupTranscriptcarry the cues rather than their indexes. Would drop thesegmentsprop and three indirections per phrase. The prop's identity is stable, so the memo holds and the measured cost is tens of microseconds per second; the index-keyed shape is the one the ticket lifts, with a spec.payloadListFetcher. Right, and it rewiresFrameEditor's own hook — a reviewer judging a UI tab would then also be judging that. Filed.upload-notice-coverage.spec.tstoo. Filed.activeSegmentIndex; delegate the per-phrase listeners. Measured at a few microseconds per second for the library's longest transcript (104 phrases, 46 paragraphs). Not built.Measured, not assumed. The library's longest committed transcript is 104 phrases in 46 paragraphs, median 45 — one screenful of DOM, so no virtualised list. A playhead tick re-renders the parent and 1–2 paragraphs, because every
Paragraphprop traces to a stable identity (onSeekisuseSeekToTime'suseCallbackover auseRef).Fixture pre-mortem. The jsdom spec's
row()assumesstatusanderrorare virtual,segmentsis nullable, and a cue is{ content, startTimeMs, endTimeMs }in milliseconds. Checked againstsrc/collections/MeditationTranscripts/MeditationTranscripts.tsandsrc/lib/utilities/subtitles.ts, and typed asMeditationTranscriptfrom@/payload-types, sopnpm typecheck:testscatches drift rather than a runtime failure. It mocks@payloadcms/uiandswronly — the playhead arrives as a realPLAYBACK_TIME_UPDATEmessage throughplaybackTimeStore, and a seek is read off the iframe's ownpostMessage.The 22 defects each new assertion was watched failing on: the locale dropped from the URL;
startTimeMsread as seconds; the stall derivation removed; the paragraph gap and the silence gap left in seconds; the key handler dropped; the phrase made a<button>;aria-currentmoved onto the non-focusable paragraph wrapper; therefreshIntervalarrow inlined; the paragraphs gated onstatus === 'completed'; the locale guard removed; the hook'senabledgate removed; Space treated as a scroll key; the in-view guard removed; the listener cleanup removed; the manual-scroll pause removed; theuifield renamed to shadow thetranscriptjoin;autoOpendropped; the tab moved out of first place; the component path pointed one level deeper; the notice naming a tab; the stall-deadline render removed; the pending notice hand-rolled instead of aBanner.Not shipped, by the ticket's own instruction:
alignWords,activeWordIndex,useSmoothPlaybackTime,SpokenPhrase,TranscriptViewand thesampleprovider.git grepfinds none of them undersrc/.Closes #955
🤖 Generated with Claude Code
https://claude.ai/code/session_01MNp5xnsKHsZPKBdgTjKFtK