Skip to content

feat(transcripts): read transcripts via the EnrichmentObject list API and add a Transcripts workspace filter - #505

Merged
pallakartheekreddy merged 15 commits into
v1.1.2from
feat/transcript-v2
Nov 10, 2026
Merged

pallakartheekreddy merged 15 commits into
v1.1.2from
feat/transcript-v2

Conversation

@chethann007

@chethann007 chethann007 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Moves the portal's transcript support from the old content/v4/read?enrich=all flow to the generic EnrichmentObject model, and adds a "Transcripts" filter with closed-caption badges to the workspace.

Related PRs (the same feature across the stack):

What changed

Removed

  • enrich=all on content reads and the exists: ['enrichment'] search filter, which the backend no longer supports.

Reading transcripts

  • New EnrichmentObjectService calls POST /object/enrichment/v4/list with {request:{enrichmentObject:{parentId, enrichmentObjectType?}}}, one call per type.
  • New useContentWithEnrichments hook reads the content, lists its enrichment objects, and merges the Live ones into the content the player receives. It stays loading until both settle, so the player is not rebuilt mid-playback. A failing list returns the plain content and never an error page. Used by the content player, collection detail and content view (edit mode) pages.
  • An enrichment registry (services/enrichment/) holds one entry per enrichmentObjectType (type, mime types, badge icon, label key, how its objects apply to the content). Adding a type such as Summary is one registry entry. Transcript is the first.

Workspace

  • A "Transcripts" filter button, one per registered type, filters on Content.enrichmentTypes (what the creator requested). The state lives in the ?enrichment= URL param and applies to both the content list and the tab counts.
  • With the filter on, a closed-caption badge shows on cards and list rows only when the content has a Live transcript. A single batched EnrichmentObject search covers the ids on screen (useEnrichmentAvailability), not one call per card. If that search fails, cards just show no badge.
  • Fix: workspace cards are keyed by id and status. A Live content and its editing copy share one identifier in search results, so keying on id alone left stale cards in the DOM when the filter was toggled. A re-render test covers it.

Strings

  • workspace.enrichmentFilters-style labels are now workspace.enrichmentLabels.Transcript ("Transcripts") in en, fr, pt and ar.

Merged v1.1.2 (Dynamic Assess); the conflicts in ContentService, ContentViewPage.test and the player tests are resolved.

Meaning to keep straight

  • The filter means "requested" (Content.enrichmentTypes).
  • The badge means "available" (a Live object exists).

Test plan

  • tsc clean, lint 0 errors.
  • Full suite passes: 315 files, 3838 tests.
  • Open a published video with transcripts: captions load in the player and the language menu lists every Live language.
  • Workspace: turn the Transcripts filter on and off a few times. The list shrinks and grows without stale cards, and the CC badge shows only on contents with a Live transcript.
  • Force the list or search call to fail: the player still plays, the workspace still loads, and there are no badges.
  • Check the ?enrichment=Transcript URL param survives a reload and back/forward.

Notes

  • Needs the knowledge-platform EnrichmentObject APIs (#1329) deployed, and POST /object/enrichment/v4/list exposed through Kong. The badge lookup also needs EnrichmentObjects to be searchable through /composite/v1/search.
  • Anonymous access to the list and search routes has not been verified.
  • The editor dependency stays at ^2.0.7. Bump it once an editor build containing generic-editor-v2#9 is published.
  • fr, pt and ar strings need a native review.

…filter

Transcripts move to the generic EnrichmentObject list API and the
workspace filter moves to the Content.enrichmentTypes search field, so
remove the old read path and filter ahead of the new implementation.

- ContentService: drop mapRawTranscripts, the enrichTranscripts
  parameter and enrich=all from contentRead, and the exists forwarding
  from contentSearch
- useContentRead: drop the enrichTranscripts option and its query key
  entry
- ContentPlayerPage, CollectionDetailPage, ContentViewPage: stop
  requesting enriched reads
- types: drop RawTranscript, ContentEnrichment and ContentData.enrichment;
  drop exists from ContentSearchRequest
- useWorkspace: drop both exists: ['enrichment'] spreads; the
  transcriptFilter toggle is inert until the enrichmentTypes filter lands
- tests: remove suites and assertions for the removed behaviour
… and filter by enrichmentTypes

Transcripts now come from the generic EnrichmentObject model instead of
the removed enrich=all read, and the workspace filter uses the
Content.enrichmentTypes search field instead of the removed exists filter.

- Registry (services/enrichment) holds one entry per enrichmentObjectType:
  applicable mimeTypes, workspace filter label, and the player mapping.
  Transcript is the first entry; only Live objects with a captionsUrl map
  to player transcripts.
- EnrichmentObjectService calls POST /object/enrichment/v4/list
  (request.enrichmentObject.{parentId, enrichmentObjectType}).
- useContentWithEnrichments reads the content, lists its enrichment
  objects for video mimeTypes, and returns one memoized object so the
  player is not rebuilt; a failing list call yields plain content. Used
  by ContentPlayerPage, CollectionDetailPage and ContentViewPage.
- Workspace filter is generic: one toggle per registry entry, state
  enrichmentFilter, URL param ?enrichment=, and filters.enrichmentTypes
  in both the counts and content queries. The old ?transcripts=1 URL is
  no longer honored.
- Locales: workspace.hasTranscripts replaced by
  workspace.enrichmentFilters.Transcript ("Transcript requested").
- ContentData.enrichmentTypes added; enrichmentTypes added to the default
  content read fields.
…ve stale cards

A Live content and its editing copy (Processing/Review) come back from search
under the same identifier. Keyed by id alone, React could not tell the two
apart: toggling a filter off and on updated the grid in place and left cards
from the previous list in the DOM while the item count was correct.

Key the grid card and the list row by `id-status` so each gets its own
identity, and cover it with a rerender test.
…on cards

Replace the per-type "Transcript requested" text filter with one icon-only
sparkle toggle that selects every registered enrichment type (ENRICHMENT_TYPES)
through `enrichmentTypes` in the search filters, keeping the ?enrichment= URL
param. Adding another enrichment type later needs only a registry entry.

With the toggle on, show a badge per enrichment type on each card and list row
when the content actually has Live objects of that type. Availability comes from
one EnrichmentObject search for the ids on screen (useEnrichmentAvailability),
not one call per card; a failed search just leaves the cards without badges.
The registry entry now carries the badge icon and tooltip key, and the mapper
keeps the requested `enrichmentTypes` so only those contents are looked up.

The fr, pt and ar strings (tooltips) need a native review.
…ts filter

Restore the per-type enrichment filter button in the workspace and drop the
sparkle toggle, the enrichment badges on cards and list rows, and the
availability lookup behind them (useEnrichmentAvailability, availability.ts,
EnrichmentIcons, the mapper and type additions that only served the badges).

The filter button label is now "Transcripts" (was "Transcript requested").
The fr, pt and ar strings need a native review.
…s filter is on

Bring back the closed-caption badge on workspace cards and list rows, on top
of the per-type "Transcripts" filter button (the sparkle toggle stays removed).

With the filter on, a badge per enrichment type appears only when the content
has a Live object of that type. Availability comes from one EnrichmentObject
search for the ids on screen (useEnrichmentAvailability), not one call per
card; a failed search just leaves the cards without badges. The registry entry
carries the badge icon and label key, and the filter button now reads the same
label key, so the unused workspace.enrichmentFilters strings are dropped.

The fr, pt and ar strings need a native review.

@pallakartheekreddy pallakartheekreddy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static read of the whole diff (didn't build or run anything).

The hard parts hold up: the removal is clean with no dangling references, the merge preserves all of v1.1.2 (and doesn't touch dynamicAssessSubset.ts), the loading gate genuinely gates — I traced react-query's observer behaviour and there's no render window where the player sees unmerged content — and the tests assert real behaviour, including the request bodies.

But the unknown you flagged turns out to be the bad case. A logged-out learner opening any MP4 gets force-logged-out. One line fixes it. Details inline.

One note that isn't on a changed line: ContentService.ts:6 still asks the read for 'transcripts', but nothing maps it anymore — so a legacy raw transcripts array would reach the player in the un-normalised shape mapRawTranscripts used to fix. Either drop the field or strip it in applyToContent.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

Claude Code Review is paused for this repository because its GitHub organization is not linked to your Claude organization.

To turn it back on, one person needs both roles: owner of the GitHub organization (or the account owner, for a personal repository) and admin or owner of your Claude organization. If that is not you, pass this on to someone who is.

Open Organization settings, Git providers and click Link next to the GitHub organization's name. If it is not listed, click Enable GitHub integration or Connect your GitHub first, whichever the page shows.

New pull requests are then reviewed as before. To get a review on one that is already open, someone with write access can comment @claude review.

Tip: disable this comment in your organization's Code Review settings.

Logged-out learners open the public video player, which lists a content's
enrichment objects for captions. The route was not in the anonymous proxy
allowlist, so it hit the authenticated catch-all and returned 401.

Only list is exposed; create, approve and reject stay behind login.
The player waits for the list before mounting, so a call that never
answered kept the page on the loader. list() now rejects after 5s and
the player renders without captions.
A refetch that finds a newly Live transcript changes the merged content
and rebuilds the player mid-playback.
The badge search covered every id loaded so far, so each infinite-scroll
page re-searched all earlier ids and kept every result set cached. Ids are
now searched in chunks of 20 with stable query keys, so a new page only
searches the new ids.
Captions now come from Live EnrichmentObjects. Requesting the free-form
transcripts field on Content could hand the player an unconverted legacy
value when no Live object exists.
…toggle

Reword the badge and registry comments to match what they describe, and
replace a nested ternary in the filter handler with plain statements.
The lockfile written by npm 11 dropped the optional @emnapi/core and
@emnapi/runtime entries and added peer annotations. npm ci in the Docker
build rejects that file as out of sync. Restore the previous lockfile and
apply only the generic-editor-v2 2.0.8 change.
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@pallakartheekreddy
pallakartheekreddy merged commit 95c7638 into v1.1.2 Nov 10, 2026
7 of 8 checks passed
@pallakartheekreddy
pallakartheekreddy deleted the feat/transcript-v2 branch November 10, 2026 07:46
@Deeksha1502 Deeksha1502 mentioned this pull request Nov 11, 2026
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.

2 participants