Repository navigation
refactor: slash-and-burn Problem block built-in implementation (slash-n-burn #37819) - #38751
irfanuddinahmad wants to merge 9 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]>
67f3d09 to
dd17204
Compare
| @@ -1,20 +0,0 @@ | |||
| """ | |||
There was a problem hiding this comment.
I don't think we ever communicated a DEPR for the old import CODE_JAIL_REST_SERVICE_REMOTE_EXEC value, so operators may have never updated it to the new path. Let's leave this shim in for now, and we can DEPR it later.
The PR looks great to me otherwise, so once you add that shim back in, 🚀🚀🚀
There was a problem hiding this comment.
Restored in f290955: xmodule/capa/safe_exec/__init__.py and remote_exec.py, unchanged from master. I checked on a local Tutor stack that import_string("xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0") still resolves to xblock_problem, with the DeprecationWarning. The description now lists the file under Kept.
Heads-up: feanil's follow-up issue #39427 (after #39382) plans to remove this same shim. So you and @feanil may want to agree on whether that waits for a DEPR.
Generated using Claude Code.
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]>
Same nits as reviewed on #38745: - Drop the extra blank line left in openedx/envs/common.py after the toggle removal. - Collapse the toggle-era base class + __test__ subclass back into the original test class name(s). The plugin cache reset was only needed for the removed importlib.reload. Test bodies are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_EXEC No DEPR was announced for the old xmodule.capa.safe_exec.remote_exec path, so operators may still have CODE_JAIL_REST_SERVICE_REMOTE_EXEC set to it. Keep the deprecation shim, which re-exports from xblock_problem, until it goes through DEPR. Co-Authored-By: Claude Opus 5.5 <[email protected]>
f290955 to
31a3cd3
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/js/src/capa/(display.js,imageinput.js,schematic.js),ProblemBlockDisplay.css, theProblemBlockDisplaywebpack entry, and theUSE_EXTRACTED_PROBLEM_BLOCKtoggle.Kept:
xmodule/capa/safe_exec/remote_exec.py, the deprecated shim that re-exports fromxblock_problem. No DEPR was announced for the oldCODE_JAIL_REST_SERVICE_REMOTE_EXECpath, so operators may still use it (per review). Its removal is tracked in #39427.Changed: the
problementrypoint inpyproject.tomlis re-pointed fromxmodule.capa_block:ProblemBlocktoxblock_problem:ProblemBlock. It isn't removed, because xblocks-core only registers_problem_extracted(for testing), so existingproblemcontent needs this name.Release notes: one Willow dev/op entry covers all 8 blocks, on the Willow - Operator Dev Notes wiki page. The docs maintainers move those notes to docs.openedx.org after the release is cut (moved there from openedx/docs.openedx.org#1554 at their request).
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).lms/djangoapps/grades/tests/integration/test_problems.py, the toggle-era base class +__test__ = Truesubclass is collapsed back intoTestMultipleProblemTypesSubsectionScores,TestVariedMetadataandTestWeightedProblems, the class name(s) used before the toggle. Test bodies are unchanged.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). Later commits to the deleted files, all already matched in xblocks-core 4.0.0:f8d6364fb4(#39405, removesmatlab_api_keyand theungraded_responsehandler from the built-in block; xblocks-corea30b509removes the same, and neither name remains inxblock_problem),ebe22ffce5(#39405, rewrites the XQueue tests intest_capa_block.py; the xblocks-core 4.0.0 copies have identical bodies, from3a99862) and3ae28f70ba(#39382, drops@UseUnsafeCodejailfrom one test; the xblocks-core copy never used it). All 140 tests in master'stest_capa_block.pyexist in xblocks-core 4.0.0: 116 with identical bodies, 24 differing only in patch targets,location→usage_key,noqacomments or line wrapping. One other 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
Re-tested 2026-11-25 after the rebase onto master
7e3ace351c(xblocks-core 4.0.0), on a local Tutor nightly with all 8 slash-n-burn PRs combined: the 1085 tests in the 32 touched test files pass, and every block renders in the LMS and as a Studio preview, inline and as a pointer tag. Earlier runs: local Tutor nightly (master6f85d63c7f+ 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 buildTesting notes and edge cases (local Tutor nightly, 2026-11-12):
mjx-container).CODE_JAIL_REST_SERVICE_REMOTE_EXECresolves toxblock_problem.capa.safe_exec.remote_exec.grades/tests/integration/test_problems.py(224 tests) passes.USE_EXTRACTED_*_BLOCK = False(built-in) and on this branch; theproblemfiles and its unit are identical. Checked 2026-11-19.V2 Library checklist: 10/14 pass (R1–R4 partly verified, details inside)
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)
USE_EXTRACTED_*_BLOCK = False(built-in) and on this branch; theproblemfiles and its unit are identical.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