Repository navigation
Keep caption files uploaded before 2.8.0 - #2351
Conversation
2.8.0 marks a caption file uploaded in WordPress with rtgodam_transcript_source = upload, but uploads from earlier versions have no mark. They were treated as a cached copy of GoDAM Central's caption: opening the Transcription tab or the background refresh overwrote or removed them, and the player played Central's tracks instead. An unmarked transcript whose address is not on Central's CDN now counts as an upload. Generate marks the source as central, so a new transcript still replaces an old upload.
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Video Hosting for LMS & Online Courses" is different from the name declared in plugin header "GoDAM". |
📁 assets/build/pages/video-editor.min.js (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
2 |
react_removed_api | This file calls "ReactDOM.findDOMNode", which was removed in React 19 and stops working once WordPress upgrades React. Use a ref on the element instead. |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/11/10/demo-post-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-page-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/11/10/demo-post-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-page-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
Code reviewVerdict: the fix is right. One small thing is needed before merge (the stale POT, which is why the check is red), and there's one data-loss path worth deciding on. Since 2.7.0 stored only a URL for an upload, with no other marker, the URL host is the only signal available, and routing every read through What I ran
Needed before merge: regenerate
|
| Central's default row | After refresh_cached_default() |
|---|---|
Pending (Generate still running, editor reopened) |
upload path deleted |
Failed (Generate failed) |
upload path deleted, and stays gone |
So during the transcription the video plays no captions, and if Generate fails the user's file is no longer used (it's still in the Media Library). To be fair, main already does this for uploads marked upload, because Generate clears the mark there, so this isn't a regression. But this PR now applies it to every pre-2.8 upload too, and QA step 5 ("when it finishes, the generated transcript replaces the upload") only describes the happy path. Some options:
- In the in-progress branch, set something like
central-pendingthatis_wordpress_upload()still treats as an upload for keeping it, and let the sync replace it only once Central reports a ready default. Then switch it tocentralin the! empty( $path )branch. - Or, in
sync_cached_transcript(), keep an unlisted cached path while the status is in flight, and onFailed.
Nits (non-blocking)
- The
httpsrequirement:rtgodam_is_transcoder_file_url()requireshttpsbecause Download transcoded files only from GoDAM CDN hosts, and read the callback API key from the body #2248 uses it for downloads (SSRF). Here it only classifies, so a Central file stored ashttp://*.gdcdn.us/...would count as an upload. Comparing the host alone (using the same host list) would be a safer test for "is this Central's file". - The underlying assumption: the heuristic relies on every account's
cdn_zone_urlbeing undergdcdn.us. That isn't hardcoded in godam-core; it comes from provisioning. It's the same assumption Download transcoded files only from GoDAM CDN hosts, and read the callback API key from the body #2248's allowlist rests on, which has already shipped, so I'm fine with it. Worth one line in the release notes, though: a site on a Central whose CDN isn't inrtgodam_transcoder_file_hostswould have its old generated transcripts treated as uploads, and adding the host fixes it. - Skipping the one-time backfill makes sense. The read-time check also covers sites that update without visiting wp-admin.
Review drafted with Claude.
|
Thanks for the review, Rudrakshi. POT: regenerated and pushed in 1682c73. It was built with Node 22.14.0 from Generate dropping the upload: fixed after all in 60eaf02, with your Nits:
|
elifvish
left a comment
There was a problem hiding this comment.
Thanks for this. Reading the mark at read time is the right call: it needs no upgrade routine and it covers sites that update without opening wp-admin. I reviewed it on 1682c73 (the POT-only commit on top of 2ed733d). Nothing here blocks the merge, but there is one Generate behaviour worth deciding on first.
Security
No issues found. There is no new input, route or permission change, and is_wordpress_upload() only reads two metas and fails safe. Look-alike hosts (evilgdcdn.us) and userinfo tricks (x.gdcdn.us@evil.example) count as "not Central", so the file is kept rather than overwritten. The transcription callback's API-key check is unchanged.
Correctness
- Generate drops the old file before the new transcript exists (inline on
class-transcription.php:589). After Generate is accepted, the sync treats the old upload as Central's cache. If Central has no ready default file at that point (row still pending, or the job failed), the sync deletesrtgodam_transcript_path. I reproduced it with a stubbed Central answer; I did not confirm against a live Central that it lists a pending default row while the job runs. It is not new for uploads markedupload, but this PR now applies it to every pre-2.8.0 upload, and QA step 5 only covers the happy path. Rudrakshi raised the same thing earlier; I got to it independently. - The Generate half of the fix has no test (inline on
TranscriptionCaptionSyncTest.php). With Generate's twoSOURCE_CENTRALwrites put back todelete_post_meta(), all 30 caption tests still pass, but a script that callsgenerate_transcription()fails.
Other
3. The host check will keep deciding for every Central copy from now on, because the sync writes Central's path without a mark. It also requires https, which only makes sense for the download guard (inline on class-transcription.php:854). The filter docblock in custom-functions.php (line 3558) should say it now also decides upload vs Central copy.
Consumer impact
- The player (
transcriptManager.js) needs no change, because the template now suppliesuploadfor unmarked uploads. The transcript panel and the audio block read the path only, so they are unaffected. - The editor Transcription tab keeps the same response shape. The SEO queue now skips unmarked uploads (intended). The older-Central callback branch has the same semantics with the new classifier.
- godam-core, godam-upload, godam-transcoder and godam-analytics don't read these metas. I did not check godam-for-woo, godam-ai, the desktop app or the iOS apps.
Verification
- Environment: PHP 8.2.35 container with PHPUnit 9.6.33 (CI uses 8.4). Commit
2ed733d, then re-run on1682c73after the head moved. That commit changed onlylanguages/godam.pot. - PHPUnit: the Transcription tests pass 30/30. The full suite minus
SiteOriginTestran 1300 tests with 3929 assertions, 0 failures and 2 skipped.SiteOriginTestis excluded because the container has noext-intl; this PR doesn't touch it. - Your claim holds: with the old
'upload' === $sourcerule restored, 4 new tests fail (sync, refresh and 2 dataset rows). All 30 pass with the fix. - A probe script I wrote, not part of the PR, calls
generate_transcription()with stubbed Central answers and then runs the sync. All 6 Generate/sync checks and 14 classification checks pass at head. - PHPCS is clean on the 6 changed PHP files, and
php -lis clean on PHP 8.2. I had no 7.4 binary and read the code for 7.x-incompatible syntax. CI on1682c73is green, including the POT and Plugin Check jobs. - I read godam-core. Caption URLs come from the account's
cdn_zone_urland signing keeps the host.get_public_transcription_pathreturnscaption_tracksin both branches. - Not covered: no browser or live-WordPress run (no WordPress site or UI login on the review host), so I haven't seen the player or Transcription tab on a page and QA steps 1 to 6 were not walked. No live Central. No PHP 7.4 or 8.4 run. Production
cdn_domainvalues were not checked.
Generate marked the transcript as Central's as soon as a job started, so while the job ran, or after it failed, the caption sync saw an unlisted Central copy and removed the uploaded file the video used. Generate now marks a running job central-pending: the stored file is kept and played as an upload until Central reports a ready default, which then replaces it and marks it central. Every write of Central's transcript (sync, callback, godam_get_transcript_path) now marks it central too, so the address check only decides for transcripts stored before 2.8.0. The rtgodam_transcoder_file_hosts docblock says so. Regenerate godam.pot for the shifted line references.
Re-reviewVerdict: LGTM. Both items from my review are resolved, and nothing blocks the merge. I checked head Resolved
Extra cases I tried (throwaway tests, deleted afterwards)
Runs
I also like that One optional follow-up (not for this PR)If Generate fails on a video whose stored file was already one of Central's copies, and Central makes the failed AI row the default, the mark stays Review drafted with Claude. |
|
Thanks for the re-review and the extra cases. On the optional follow-up: agreed it's real, and I'm leaving it out. It needs Generate while one of Central's copies is already stored, and the editor only shows Generate when nothing is stored, so it takes a direct API call. Even then the video plays Central's own older file rather than losing captions. If it's ever needed, the smallest fix is in |
* 2.8.0: Nov 10 date, transcription fixes, caption test ids, JSX runtime build (#2347) * Move the 2.8.0 date to November 10, 2026 * Transcription: say it usually takes a few minutes, not 10-15 The message shown while an AI transcription runs said it usually takes 10-15 minutes. It usually finishes in a few minutes, so say that, and that long videos take longer. * Update the POT for the transcription time message * Transcription: say it usually takes a few seconds A preprod test on 9 Nov transcribed 140 seconds of audio in about 3 seconds, so 'a few minutes' was still too long. * Caption manager: add test ids to the file inputs, row actions and add form The add and replace file inputs had no id, name or test id, so E2E tests could only reach them by position. Row actions were only reachable through a row test id keyed by the caption's id, which a test cannot know ahead. Rows also carry data-caption-language and data-caption-label, so a test can find the row for a language or label. * Regenerate the POT after the caption manager test ids * Build: resolve react/jsx-runtime to WordPress's React in the admin pages Packages bundled from node_modules (such as @wordpress/dataviews) import react/jsx-runtime. The pages build bundled that package, inlining React 18's element factory into 11 bundles. Elements were then created by a different copy of React from the one rendering them, and Plugin Check 2.2.0 fails the build (inlined_react_jsx_runtime), which blocks merges to main. Resolve the import to pages/jsx-runtime.js, which creates elements with createElement from the externalized React global. WordPress registers a shared react-jsx-runtime script only from 6.6, and GoDAM supports 6.5. * Transcription: keep the cached transcript while the default has no file Opening the Transcription tab asks Central for the caption list. When the default caption had no file yet (an AI transcript still pending, or one that failed), WordPress deleted its cached transcript, so the tab went empty and the player lost it. Now the cached transcript stays while Central still lists it; one Central no longer has is still cleared. * Regenerate the POT after resolving react/jsx-runtime * Regenerate the POT for the shifted transcription REST lines * Transcription: say it usually takes a few minutes "A few seconds" rested on one preprod run, and the panel polls every 8 seconds, so the note stays up longer than the job anyway. Addresses review: #2347 (comment) * Caption manager: one helper for a caption's display label The label-or-language-name fallback was written in five places. It now lives in captionDisplayLabel(), so data-caption-label and the visible text can't drift apart. No behaviour change. Addresses review: #2347 (comment) * Regenerate the POT for the new transcription message * Transcription: stop waiting and say why when GoDAM refuses to start When Central refused a transcription, for example "Transcription limit exceeded" on an account with no quota left, it gave the reason in message and left error empty. The editor only read error, so it showed nothing and kept the spinner running, polling every 8 seconds with no end. getGenerateRefusal() now treats any success: false answer with no job running as final and returns error or message. The editor stops waiting and shows it, or a generic message when Central gave none. * Regenerate the POT for the transcription refusal fix * POT: restore the plugin slug in the bug-report header The last two POT regenerations ran from worktree folders whose names became the slug in Report-Msgid-Bugs-To. Regenerated with --slug=godam. * Transcription: compare caption files, not signed URLs; keep an in-flight status Central signs caption URLs with a fresh token on every request, so the cached URL never equalled the listed one and the cache was still deleted on accounts with signed delivery. Compare the file part, before the query string. Also keep an in-flight status such as Transcribing when nothing is cached, so the tab opens on the progress state. Addresses review: #2347 (comment) Addresses review: #2347 (comment) * Regenerate the POT for the shifted transcription REST lines * Keep caption files uploaded before 2.8.0 (#2351) * Keep caption files uploaded before 2.8.0 2.8.0 marks a caption file uploaded in WordPress with rtgodam_transcript_source = upload, but uploads from earlier versions have no mark. They were treated as a cached copy of GoDAM Central's caption: opening the Transcription tab or the background refresh overwrote or removed them, and the player played Central's tracks instead. An unmarked transcript whose address is not on Central's CDN now counts as an upload. Generate marks the source as central, so a new transcript still replaces an old upload. * Regenerate godam.pot for the shifted transcription line numbers * Keep the stored caption file until Generate finishes Generate marked the transcript as Central's as soon as a job started, so while the job ran, or after it failed, the caption sync saw an unlisted Central copy and removed the uploaded file the video used. Generate now marks a running job central-pending: the stored file is kept and played as an upload until Central reports a ready default, which then replaces it and marks it central. Every write of Central's transcript (sync, callback, godam_get_transcript_path) now marks it central too, so the address check only decides for transcripts stored before 2.8.0. The rtgodam_transcoder_file_hosts docblock says so. Regenerate godam.pot for the shifted line references. * fix: move Node.js to a release patched for CVE-2026-111497 --------- Co-authored-by: Rudrakshi Gupta <109859631+rudrakshi-gupta@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Kuldip Chaudhary <64731232+KMchaudhary@users.noreply.github.com> Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> Co-authored-by: rtBot <43742164+rtBot@users.noreply.github.com> Co-authored-by: Immanuel Raj <iamimmanuelraj@gmail.com>
Part of the 2.8.0 release: https://github.com/rtCamp/godam-plugin-wp/issues/92
Problem
2.8.0 marks a caption file uploaded in WordPress with the
rtgodam_transcript_sourcemeta set toupload, so GoDAM Central's caption changes never replace it. Uploads made on 2.7.0 or earlier have no such mark. After the update they were treated as a cached copy of Central's caption:The file itself stayed in the Media Library, but the video no longer used it.
Fix
A transcript with no source mark counts as an upload when its address is not on Central's CDN. Central serves caption files only from
gdcdn.us, so any other address is a file the site holds itself. The check reusesrtgodam_is_transcoder_file_url(), so thertgodam_transcoder_file_hostsfilter still covers a staging Central.Transcription::is_wordpress_upload( $path, $source ), used by the caption sync, the refresh, the video SEO queue, the transcription callback and the player template.central-pending. The stored file (often an upload) is kept and played until Central reports a ready default caption, which then replaces it and is markedcentral. If the job fails, the upload stays. Before this, Generate cleared the mark, so a sync during the job, or after a failed one, removed the upload (found by Rudrakshi and Vishal in review).godam_get_transcript_path()) now marks itcentral. So the address check only decides for transcripts stored before 2.8.0, as Vishal suggested. Thertgodam_transcoder_file_hostsdocblock says the hosts now also do this.Not done: a one-time backfill on upgrade. It would be the same size of change, but it is an upgrade routine that runs per site on multisite. The check when the meta is read needs neither.
Tests
is_wordpress_upload()cases (site file, S3 file, Central copy, generated).gdcdn.usaddress for Central's files, as Central does.TranscriptionGenerateSourceTestcallsgenerate_transcription()with stubbed Central answers. It covers: a running job keeps the upload, an immediate transcript replaces it, a Pending or Failed default keeps it, a ready default replaces it, and the sync marks Central's copies.setAccessibledeprecation (CI uses 8.4). PHPCS is clean, and the changed files pass a PHP 7.4 syntax check.QA steps
.vttin the Transcription tab of a video GoDAM has transcoded. Check it plays on a page.fetch( godamRestRoute.url + 'godam/v1/transcription/generate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-WP-Nonce': godamRestRoute.nonce }, body: JSON.stringify( { attachment_id: <ID> } ) } ).then( ( r ) => r.json() ).then( console.log ). While the job runs, the page still plays the uploaded captions. When it finishes, opening the Transcription tab shows the generated transcript in place of the upload.Risk: high. This decides whether stored transcript data is kept or replaced.