Repository navigation
refactor: slash-and-burn Problem block built-in implementation (slash-n-burn #37819) - #38751
irfanuddinahmad wants to merge 7 commits into
Conversation
|
Thanks for the pull request, @irfanuddinahmad! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
fcc939b to
356dc98
Compare
46e90c6 to
bebc423
Compare
bebc423 to
544f32e
Compare
5d222d0 to
c0260d6
Compare
…pecs openedx/openedx-platform#33555 added six specs for the built-in block's client-side refreshMath formula-equation preview, which openedx/openedx-platform#38751 removes. The extracted block renders these previews only via the server (preview_formcalc, 989ae32), so add tests asserting that path's behavior for the same inputs: - calculator syntax R_1*R_2/R_3 renders as LaTeX - \(..\), \[..\], $$..$$ and $..$ inputs are rejected with a parse error The binding spec maps to existing coverage (formula_equation_preview_spec 'makes a request on user input' and display_spec 'does not bind refreshMath to formula equation inputs'). Co-Authored-By: Claude Opus 5.5 <[email protected]>
c0260d6 to
67f3d09
Compare
Ports three tests that openedx/openedx-platform#33555 (MathJax v4 upgrade) added to xmodule/js/spec/capa/display_spec.js, which openedx/openedx-platform#38751 removes along with the built-in Problem block: - should clear and typeset the math element - wraps calculator input in backticks for input.math - clears preview and skips typesetPromise on empty input Names, bodies and assertions are unchanged except for the extracted block's Problem(runtime, element) constructor. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pecs openedx/openedx-platform#33555 added six specs for the built-in block's client-side refreshMath formula-equation preview, which openedx/openedx-platform#38751 removes. The extracted block renders these previews only via the server (preview_formcalc, 989ae32), so add tests asserting that path's behavior for the same inputs: - calculator syntax R_1*R_2/R_3 renders as LaTeX - \(..\), \[..\], $$..$$ and $..$ inputs are rejected with a parse error The binding spec maps to existing coverage (formula_equation_preview_spec 'makes a request on user input' and display_spec 'does not bind refreshMath to formula equation inputs'). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Removes the built-in ProblemBlock shim and all associated assets now that the extracted xblocks_contrib.problem.ProblemBlock is the production implementation. - Delete xmodule/capa_block.py (_BuiltInProblemBlock + shim) - Delete xmodule/capa/ (deprecated safe_exec shim pointing to xblocks_contrib) - Delete xmodule/js/src/capa/ JS files (display, imageinput, schematic) - Delete xmodule/static/css-builtin-blocks/ProblemBlockDisplay.css - Delete xmodule/tests/test_capa_block.py (tested _BuiltInProblemBlock directly) - Delete lms/djangoapps/grades/tests/integration/test_problems.py (used reset_class shim) - Remove USE_EXTRACTED_PROBLEM_BLOCK toggle from openedx/envs/common.py - Update CODE_JAIL_REST_SERVICE_REMOTE_EXEC to xblocks_contrib path - Remove problem entrypoint from pyproject.toml - Remove ProblemBlockDisplay webpack entry - Update all ProblemBlock/SHOWANSWER imports to xblocks_contrib.problem Part of epic #37819 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…nfig.js ProblemBlockDisplay (the only webpack entry including capa/display.js, capa/imageinput.js, and capa/schematic.js) and those JS files are deleted in this PR. Remove the now-dead imports-loader rules for consistency with how Poll, WordCloud, and LTI PRs handle their own cleanup. Also removes the stale capa/display.js example from the comment above the imports-loader block since that example is no longer in the codebase. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…blemBlock These grades-pipeline integration tests already ran against the extracted ProblemBlock (USE_EXTRACTED_PROBLEM_BLOCK=True). The grades pipeline lives in openedx-platform, so the coverage belongs here rather than in xblocks-core (supersedes the port tracked in openedx/xblocks-core#266). Only the reset_class() calls, toggle overrides and BuiltIn variants are removed; test names and logic are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
xblocks-core 2.0.0 (#38473) removed the xblocks_contrib package. Point the platform entrypoint, imports and mock.patch targets at the new per-block packages (e.g. xblocks_contrib.video.video -> xblock_video.block). Co-Authored-By: Claude Opus 5.5 <[email protected]>
67f3d09 to
dd17204
Compare
Summary
Removes the built-in Problem (capa) XBlock.
xblock_problem.ProblemBlockhas been the default sinceUSE_EXTRACTED_PROBLEM_BLOCK = True, so the built-in code no longer runs.Part of the Slash-n-Burn Built-In XBlocks epic. Closes openedx/public-engineering#540
Changes
Deleted:
xmodule/capa_block.py(2481 LOC:_BuiltInProblemBlock+ shim),xmodule/capa/(deprecatedsafe_execshim),xmodule/js/src/capa/(display.js,imageinput.js,schematic.js),ProblemBlockDisplay.css, theProblemBlockDisplaywebpack entry, the built-inproblementrypoint, and theUSE_EXTRACTED_PROBLEM_BLOCKtoggle.Modified:
CODE_JAIL_REST_SERVICE_REMOTE_EXECpoints directly toxblock_problem.capa.safe_exec.remote_exec.ProblemBlock,SHOWANSWERandgenerate_report_dataimport and patch target now usesxblock_problem.Tests:
xmodule/tests/test_capa_block.py(141 tests, imported_BuiltInProblemBlock)src/xblock_problem/tests/test_capa_block.py: same names, near-identical bodies (compared one by one)xmodule/js/spec/capa/display_spec.js,imageinput_spec.js+ fixtures, pre-MathJax-v4 specssrc/xblock_problem/assets/spec/: same names, except 2 renamed by xblocks-core's own MathJax v4 port (c5fb2e4) because the v2 API they tested is goneKept in the platform:
lms/djangoapps/grades/tests/integration/test_problems.pyruns againstxblock_problem.ProblemBlock; onlyreset_class(), the toggle overrides and BuiltIn twins were dropped. It tests the platform's grades pipeline, so it stays here (supersedes openedx/xblocks-core#266).MathJax v4 spec mapping (#33555 → xblocks-core#320)
should clear and typeset the math elementdisplay_spec.js)wraps calculator input in backticks for input.mathclears preview and skips typesetPromise on empty inputbind the formulaequationinputmakes a request on user input(formula_equation_preview_spec.js) anddoes not bind refreshMath to formula equation inputswraps calculator syntax in backticks for formulaequationinputFormulaEquationTest.test_formcalc_ajax_calculator_syntax_renders_as_latexpreserves explicit TeX delimiters \(...\)test_formcalc_ajax_inline_tex_delimiters_rejectedpreserves display math TeX delimiters \[\]test_formcalc_ajax_display_tex_delimiters_rejectedpreserves double-dollar delimiterstest_formcalc_ajax_double_dollar_delimiters_rejectedpreserves single-dollar delimiterstest_formcalc_ajax_single_dollar_delimiters_rejectedThe last 6 platform tests covered the built-in block's client-side
refreshMathrendering of formula-equation previews. That path doesn't run on master (toggleTrue) and is removed here. The extracted block deliberately renders these previews only on the server, throughpreview_formcalcandformula_equation_preview.js(xblocks-core989ae32), so their counterparts assert what that path does for the same inputs.Epic Step 1: Post-extraction commit review
Toggle flipped 2026-04-24 (
53d3d5dbdf). No later commits tocapa_block.py. One later functional change, #33555 (MathJax v4) toxmodule/js/src/capa/display.js, is already in xblocks-core via openedx/xblocks-core#270 by the same author (sameisMathJaxTypesetReady/isMathJaxRefreshReady/isMathJaxMathMLReadylogic). The one difference is intentional:989ae32stopped bindingrefreshMathto formula-equation inputs. Nothing to port.Test plan
Tested on a local Tutor nightly (master
6f85d63c7f+ xblocks-core 2.0.0) through the REST APIs and a headless browser, because PR sandboxes aren't deploying (open-craft/pr-sandbox-automation#28). A box is ticked only if that flow actually ran.xblock_problem.capa.safe_exec.remote_exec.send_safe_exec_request_v0. With local unsandboxed execution (test courses only), scripted and randomized problems grade correctly, on the course block and on the library-reused copygrades/tests/integration/test_problems.py,test_tasks_helper.py,test_contentstore.py,test_block_render.py,test_library_content.py,test_item_bank.py,test_delay_between_attempts.py,show_answer/tests/,test_crud.py(all passed locally),npm run buildV2 Library checklist: 9/14 pass (R1–R4 partly verified, details inside; L10 export diff not done)
Content Libraries V2: smoke tests (historically the most fragile area for extracted blocks: openedx/xblocks-core#123, openedx/xblocks-core#132, openedx/xblocks-core#243, openedx/xblocks-core#274)
Problem-specific (from the Problem testing notes on #38152):
mjx-container); the library preview wasn't checked in a browserLibrary checklist compiled from the Aximprovements manual test doc (Extracted Block Tests tab) and the Ulmo test sheet's library cases. Generated using Claude Code.
Screenshots
6 screenshots (LMS, Studio unit, V2 Library)
Local Tutor nightly, 2026-11-12
Captured automatically during the local smoke tests (the sandbox isn't reachable yet, see open-craft/pr-sandbox-automation#28). All images: irfanuddinahmad/edx-platform@snb-smoke-screenshots/38751.
🤖 Generated with Claude Code
Settings