- Fix bug where we were overwriting `remote_emsg` with None, and add test
that would have caught it.
- Suppress differences due solely to the codejail sandbox directory name
differing (in stack traces), and add test for this. Configurable because
we'll need to add an additional search/replace pair for the sandbox venv
paths.
- Add a variety of custom attributes, replacing existing ones. The attrs
now have a prefixed naming scheme to simplify searching.
- Add slug to log output so we can more readily correlate traces and logs,
as well as logs across services.
- Fix typo in error message.
- Fix existing import sort order lint.
- Separate test for misconfiguration
- Add helper method for generic dark launch testing
- Test two darklaunch scenarios: Globals interference, and error that would
previously have caused the remote side not to run
- Rename mocks to have our usual `mock_` prefix
- Catch all exceptions, not just Exception, to better prevent errors from
interfering with mainline responses.
- Introduce a separate try block around the monitoring code so that bugs
there don't cause issues.
- Print exception information as well for both sides (but only if not a
SafeExecException, which is redundant with emsg).
Some formatting changes to log messages as well.
Example outputs:
For `1/0`:
```
2025-04-14 17:26:34,239 INFO 10232 [xmodule.capa.safe_exec.safe_exec] [user 3] [ip 172.18.0.1] safe_exec.py:240 - Remote execution in darklaunch mode produces globals={'expect': None, 'ans': '1/0'}, emsg=None, exception=None
2025-04-14 17:26:34,239 INFO 10232 [xmodule.capa.safe_exec.safe_exec] [user 3] [ip 172.18.0.1] safe_exec.py:245 - Local execution in darklaunch mode produces globals={'expect': None, 'ans': '1/0'}, emsg='ZeroDivisionError: division by zero', exception=None
```
For `raise BaseException("hi")`:
```
2025-04-14 17:26:13,359 INFO 10232 [xmodule.capa.safe_exec.safe_exec] [user 3] [ip 172.18.0.1] safe_exec.py:240 - Remote execution in darklaunch mode produces globals={'expect': None, 'ans': 'raise BaseException("hi")'}, emsg=None, exception=None
2025-04-14 17:26:13,359 INFO 10232 [xmodule.capa.safe_exec.safe_exec] [user 3] [ip 172.18.0.1] safe_exec.py:245 - Local execution in darklaunch mode produces globals={'expect': None, 'ans': 'raise BaseException("hi")'}, emsg='hi', exception=BaseException('hi')
```
With codejail-service down, and `out = 1 + 2`:
```
2025-04-14 17:30:28,597 INFO 12484 [xmodule.capa.safe_exec.safe_exec] [user 3] [ip 172.18.0.1] safe_exec.py:241 - Remote execution in darklaunch mode produces globals={'expect': None, 'ans': 'out = 1 + 2', 'out': 3, 'cfn_return': {'input_list': [{'ok': True, 'msg': 'Output:\n3', 'grade_decimal': 1}]}}, emsg=None, exception=CodejailServiceUnavailable('Codejail API Service is unavailable. Please try again in a few minutes.')
2025-04-14 17:30:28,597 INFO 12484 [xmodule.capa.safe_exec.safe_exec] [user 3] [ip 172.18.0.1] safe_exec.py:246 - Local execution in darklaunch mode produces globals={'expect': None, 'ans': 'out = 1 + 2', 'out': 3, 'cfn_return': {'input_list': [{'ok': True, 'msg': 'Output:\n3', 'grade_decimal': 1}]}}, emsg=None, exception=None
```
During dark launch of remote codejail, we want to ensure we always run both
local and remote execution -- otherwise we're missing data for the remote
side in an important situation.
This will help answer the question of whether the unexpected exception
happens on both sides, even though it may not look exactly the same due to
differences in how unexpected errors are handled.
An example input that provokes this in unsafe execution mode is
`raise BaseException("hi")`; in safe execution mode, printing to
`sys.__stdout__` should also produce an appropriate error.
fix: Restructuring to send course_id and score to edx submission
fix: Refactoring of sending information to sent_to_submission
fix: Elimination of unnecessary functions
fix: Added usage comment to ProblemBlock in XqueueInterface constructor
fix: update doc ADR
fix: setting for Quality Others test (ubuntu-24.04, 3.11, 20)
fix: Deprecation for django-trans-escape-filter-parse-error
test: Add @pytest.mark.django_db decorator to test functions
test: Fix for pylint being disabled
fix: updated changes for pylint disable
fix: update error from docs ADR-0005
update: xmodule/docs/decisions/0005-send-data-to-edx-submission.rst
Co-authored-by: Sarina Canelake <sarina@axim.org>
update: xmodule/docs/decisions/0005-send-data-to-edx-submission.rst
Co-authored-by: Sarina Canelake <sarina@axim.org>
fix: Adjusted correction
fix: update date for docs ADR
Revert "fix: update date for docs ADR"
This reverts commit 0b4229c51c4937f95cb407872645dd448df45418.
fix: replace call created_submission to create_external_grader_detail
fix: update test xqueue_submission
fix: add docstring in test_xqueue_submission
fix: update date doc ADR
fix: update version edx-submission 3.8.6
fix: add @pytest.mark.xfail
fix: add 20 chances in test_capa_block:
fix: increase retry attempts for seed generation in ProblemBlockTest
fix: change version to edx-submission lib
fix: new version edx-submission in testings
fix: replace parameter file to files
fix: update variable grader_file_name and points_possible
fix: Adjustment in the is_flag_active function to always take the last record edited in the waffle
fix: wrap large line of code
fix: update function is_flag_active
fix: code style adjustment
fix: changes for 60 retry
feat: use CourseWaffleFlag to determine xqueue callback path
fix: Code style adjustment
fix: remove deprecated xqueue callback route and simplify callback type logic
fix: Deleting a comment in the ADR document
fix: add log in self.block is None
fix: Code style adjustment in log
This PR adds contentstore.use_react_markdown_editor course waffle flag in cms.
This flag helps in enabling the markdown editor in the authoring mfe.
This PR also adds the markdown_edited field in the Problem Xblock to persist the
user's choice of switching to the markdown editor on the authoring MFE.
More details in the authoring MFE PR: openedx/frontend-app-authoring#1805
In the Annotatable XBlock, the <instructions> element was appearing
twice in the student view:
* Once in "annotatable-instructions" (where it should be).
* Again in "annotatable-content" (where annotations and other content are rendered).
The _render_content method processed and rendered the entire XML
data, including <instructions>, without removing it. The
_extract_instructions method, which is responsible for removing
<instructions>, was not called in _render_content, leading to
duplication.
This fix will:
* Prevents duplicate instructions in the student view.
* Maintains the expected behavior of showing instructions only in
"annotatable-instructions".
* No impact on existing annotation functionality.
Example output from running `import matplotlib; 1/0`, before and after the change:
```diff
--- tmp/before 2025-03-28 03:34:06.633689552 +0000
+++ tmp/after 2025-03-28 03:34:37.268688891 +0000
@@ -1,6 +1,5 @@
-Matplotlib created a temporary cache directory at /tmp/codejail-hveq16ah/tmp/matplotlib-tv0c_vzt because the default path (/home/sandbox/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Traceback (most recent call last):
File "jailed_code", line 19, in <module>
exec(code, g_dict)
File "<string>", line 1, in <module>
ZeroDivisionError: division by zero
```
* feat: allow transcripts to work with more than two-letter language codes
* style: quality
* fixup! Merge branch 'master' into jkantor/video-transcript-codes
* fix: s/LANGUAGES_DICT/LANGUAGE_DICT/
This makes it easier to run matplotlib in codejail, and should prevent a
number of other issues in the future with other packages that need to
create tempfiles.
No change is required for existing codejail installations, but after this
change operators may be able to tighten their apparmor configuration to
prevent write access to global temp or cache dirs.
Manual testing instructions: Create a codejail problem that runs
`import matplotlib` and confirm that it runs without error. (Unit tests
aren't feasible here because this requires a fully configured codejail in
order for the tmp subdirectory to exist.)
Also: Add comment for `OPENBLAS_NUM_THREADS` and numpy support.
Fixes errors thrown when previewing/editing (built-in) LTI blocks in a Libraries v2 context.
These fixes allow Library Authors to store LTI blocks in their content libraries.
* Add error handler on save video to avoid creating sjson
* Support transcripts without edx_video_id in definition_to_xml
* When copying a video from a library to a course: Create a new edx_video_id
* Save transcripts as static assets in a video in a library when adding a new transcript.
* Delete transcripts as static assets in a video in a library when deleting transcripts.
* Support download transcript in a video in a library.
* Support replace transcript in a video in a library.
* Support updating transcripts in video in a library.
* Refactor the code of downloading YouTube transcripts to enable this feature in libraries.
* Support copy from a library to a course and a course to a library.
* fix: Render Word cloud and conditional block editor
- The xmodule-type to render is MetadataOnlyEditingDescriptor
- The xmodule type `MetadataOnlyEditingDescriptor` renders a `<div>` with the block metadata in the `data-metadata` attribute. But is necessary to call `XBlockEditorView.xblockReady()` to run the scripts to build the editor using the metadata.
- To call XBlockEditorView.xblockReady() we need a specific require.config
* fix: Adding save and cancel button
* fix: save with studio_submit of conditional_block and word_cloud_block
* test: Tests for studio_submit of conditional and word cloud
* revert: Delete studio_submit of conditional block. It is not supported
* style: Fix lint
---------
Co-authored-by: Navin Karkera <navin@opencraft.com>
This should improve performance for courseware operations when there is
content that doesn't map to any existing XBlocks in the system. This
usually happens to old courses when custom XBlock types are deprecated
and removed, or when a course is imported from another instance with a
different set of installed XBlocks.
* fix: log correct time and duration for video subsections
If a subsection of a video is added to a course using advanced settings, show and log correct start and end times to the users.
* test: add unit tests
This recreates the Zooming Image Tool template for the HTML block. It
does it in such a way that doesn't depend on any external resources:
both the loupe code and sample image are inlined.
Some benefits to this version are:
* We can now maintain the loupe javascript code properly
* Because the javascript is included in the contents of the block
itself, the course author can customize it as needed
* As opposed to the previous iteration, the magnified image URL is now
optional: if it's not present, the regular image will be used for
magnification
* There can now be two or more instances of the tool in the same unit.
This also removes some CSS left over from the previous iteration.
The Zooming Image Tool does not load properly, currently, and even if it
did, relying on an external Javascript to function across releases is
not something we can support. Thus, we remove it from the list of HTML
block templates until such time as a more robust solution is found.
Fixed an issue where changing the transcript language code would
cause both the old and new transcript to be displayed.
But in this case, you won’t be able to download the transcript
from the old code, since the link is invalid.
Since all built-in block Sass is gone, we remove two final pieces of code:
* the steps in `npm run compile-sass` which compiled `xmodule/assets`, and
* the now-unused `add_sass_to_fragment` function.
This should speed up the edx-platform assets build a little bit.
This commit also includes some minor dev doc updates.
Part of: https://github.com/openedx/edx-platform/issues/35300