Annotatable: newly created empty block in a Content Library V2 fails to render (XMLSyntaxError: Document is empty)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
Hướng nghiên cứu
Start with AnnotatableBlock.definition_from_xml and get_html() in xblock_annotatable/block.py, then inspect _render_content() and the existing tests around empty block data. Reproduce the preview failure with an empty Annotatable and check the related OLX serialization path. Done when empty blocks render without the XMLSyntaxError and regression tests cover rendering and serialization.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A newly created Annotatable component in a Content Library V2 can't be previewed: the preview returns HTTP 500 until content is saved into it.
Found while smoke-testing openedx/openedx-platform#38746 (removal of the built-in Annotatable block) on a local Tutor nightly (platform master + xblocks-core 2.0.0).
Steps to reproduce
- In a V2 library, create a new Annotatable component through the REST API (
POST /api/libraries/v2/<lib>/blocks/with{"block_type": "annotatable", ...}). Its OLX is<annotatable />. - Open its preview (
GET /api/xblock/v2/xblocks/<usage_key>/view/student_view/).
Actual
xblock_annotatable/block.py:183 get_html
-> etree.fromstring(self.data)
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1
Correction (2026-11-11): an earlier version of this issue said the authoring MFE's "New → Advanced → Annotation" menu creates such a block. That's wrong:
annotatableisn't in the library's allowed block types (GET /api/libraries/v2/<lib>/block_types/), so the library UI doesn't offer it. The empty block is reachable through the REST API (above) and, verified, through course OLX import: a course whoseannotatable/<url_name>.xmlis a bare<annotatable></annotatable>imports fine but then returns HTTP 500 in the LMS.
Cause
AnnotatableBlock.definition_from_xml maps a bare <annotatable/> to data="" (the empty-data branch added with pointer-tag support in #118). get_html() and _render_content() then call etree.fromstring("").
The built-in block (_BuiltInAnnotatableBlock on platform master) uses RawMixin.definition_from_xml, which always serializes the node, so it stored "<annotatable/>" and rendered an empty annotatable. Platform master already defaults to the extracted block, so the built-in toggle is currently the only working fallback, and #38746 removes it.
Related, not yet verified
With empty data, definition_to_xml returns None ("Could not serialize ..."). An empty Annotatable may therefore be dropped on OLX export, where the built-in exported <annotatable/>.
Fix
Draft PR to follow: parse data through a helper that treats empty data as an empty <annotatable/> element, plus regression tests.
| Generated using Claude Code
- Ngôn ngữ chính
- JavaScript
- Star
- 0
- Fork
- 19
- Merge trung bình
- 8 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openedx/xblocks-core
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
openedx/xblocks-core#305 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 43/100
openedx/xblocks-core#332 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 75/100
openedx/xblocks-core#326 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ChoiceTextResponse: a submission that omits a required numtolerance_input key is graded correctĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
openedx/xblocks-core#306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
WCAG - Question Content Not Programmatically Associated With Answer ChoicesCó thể làm lại được @jesusbalderramawgu đã nhận 66 ngày trước và không có pull request nào đang mở. Đang mở
openedx/xblocks-core#300 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openedx/xblocks-core
Issue tương tự
-
marketing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/Static_Chess#163 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Account menu (footer ⚙) doesn't dismiss on outside click — stays open and covers the Bot listĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Fei2411/DeepSeek-Bot#1693 ·
-
area-templates triage:bot-seen triage:needs-human
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoft/aspire#22356 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày