Skip to content

Conversation

@farhan
Copy link
Contributor

@farhan farhan commented Sep 23, 2025

Ticket: openedx/public-engineering#430

Relevant xblocks-contrib PR

@farhan farhan force-pushed the farhan/extract-video-xblock branch from 7858c6f to 55848cb Compare September 25, 2025 12:57
@farhan farhan force-pushed the farhan/extract-video-xblock branch 2 times, most recently from db7033d to ea753b3 Compare October 4, 2025 08:12
@farhan farhan closed this Oct 4, 2025
@farhan farhan reopened this Oct 4, 2025
@farhan farhan force-pushed the farhan/extract-video-xblock branch from 726c2ad to e33585a Compare October 6, 2025 13:15
Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

here's some feedback, but directionally this looks great 👍🏻

@@ -0,0 +1,12 @@
"""
Copy link
Member

Choose a reason for hiding this comment

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

What makes this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These logs pushed me to do this change.

Logs are taken from e33585a commit test run.

Issue fixed by creating the AppConfig class for tagging app.

@@ -0,0 +1,209 @@
"""
Video Configuration Service for XBlock runtime.
Copy link
Member

Choose a reason for hiding this comment

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

Many of the other XBlock services are defined within the apps that related to them. For example, EnrollmentsService is in the enrollments app, CreditService is defined in the credit app, etc. Could you follow that pattern, and define this service within the video_configuration app? It might allow you to remove some of the method-level imports, which I assume you are using in order to get around importlinter and cyclical imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, video config service suppose to be in this app. Refactored


organization = get_course_organization(self.course_id)

from xmodule.video_block.sharing_sites import sharing_sites_info_for_video
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about moving sharing_sites into video_configuration app? I imagine the module will need to move at some point because we plan to eventually delete the built-in video_block directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a great idea.
Eventually we have to remove all built-in video block code, so moving all video related functionality to video-config app makes sense.

Let's make a list of these steps and start moving the code gradually.

Have created this sub-task story

extracted to a separate repository.
"""

def __init__(self, course_id: Optional[CourseKey] = None):
Copy link
Member

Choose a reason for hiding this comment

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

Great to see new type annotations, thank you 👍🏻 Some feedback:

  • For Optional[Foo] types, you can also annotate them using Foo | None, for example CourseKey | None. It's the same effect, but it reads a little nicer and you don't need to import Optional.
  • Please ensure that every method parameter and return in this module are annotated
  • Please add this module to files = in mypy.ini so that it actually gets checked in CI.

metadata, status_code = load_metadata_from_youtube(video_id=video_id, request=request)
return metadata, status_code

def add_library_static_asset(self, usage_key: UsageKeyV2, filename: str, content: bytes):
Copy link
Member

Choose a reason for hiding this comment

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

What's this method here for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's for VideoStudioViewHandlers._studio_transcript_upload method
code lines

log = logging.getLogger(__name__)


def get_public_video_url(video_block):
Copy link
Member

Choose a reason for hiding this comment

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

Unless I missed something, it seems like all method in this file could simply take the video's usage_key as an argument instead of the block itself. This would make the methods easier to reason about (less input data, less potential for mutation) and easier to test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, let me add todo and let's do it while testing the code, it needs to test sharing feature.

"cache": CacheService(cache),
'replace_urls': ReplaceURLService
'replace_urls': ReplaceURLService,
'video_config': VideoConfigService(course_id=course_id),
Copy link
Member

Choose a reason for hiding this comment

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

Could you also refactor the existing video block to use this new service? I think that would make the extraction itself less risky, because the built-in and extracted blocks would share the same service code.

Copy link
Contributor Author

@farhan farhan Oct 7, 2025

Choose a reason for hiding this comment

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

Yes, will do, once we finalize the service.

Added task here

for object_tag in object_tags:
assert object_tag.value in new_upstream_tags

@skip("Skipping video block test for now, needs to be fixed")
Copy link
Member

Choose a reason for hiding this comment

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

I presume you'll un-skip this before merging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@farhan farhan force-pushed the farhan/extract-video-xblock branch from 3f395c3 to fc8ea29 Compare October 9, 2025 12:47
@farhan farhan closed this Oct 9, 2025
@farhan farhan reopened this Oct 9, 2025
@farhan farhan closed this Oct 10, 2025
@farhan farhan reopened this Oct 10, 2025
@farhan farhan closed this Oct 10, 2025
@farhan farhan reopened this Oct 10, 2025
@farhan farhan force-pushed the farhan/extract-video-xblock branch from 4ae46e1 to 51d3c39 Compare November 4, 2025 11:57
@farhan farhan force-pushed the farhan/extract-video-xblock branch 2 times, most recently from b2a8394 to 6784151 Compare November 5, 2025 06:58
@farhan farhan force-pushed the farhan/extract-video-xblock branch from 015bdef to 881605d Compare December 11, 2025 12:04
@farhan farhan force-pushed the farhan/extract-video-xblock branch from 2f0155d to cba4384 Compare December 12, 2025 07:59
@farhan
Copy link
Contributor Author

farhan commented Dec 29, 2025

Closing as it has been implemented multiple small PR's

@farhan farhan closed this Dec 29, 2025
@farhan farhan deleted the farhan/extract-video-xblock branch January 6, 2026 14:12
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.

3 participants