Repository navigation
feat!: remove the legacy XQueue HTTP path and the MATLAB integration - #338
Conversation
| return default | ||
|
|
||
|
|
||
| def sanitize_html(html_code): |
There was a problem hiding this comment.
MatlabInput was the onlything using this so it and its tests can be removed.
2eb406f to
9e40e5e
Compare
ormsbee
left a comment
There was a problem hiding this comment.
Thank you for taking this on. I should have done this a while ago.
I have a few relatively small requests, and a couple of non-blocking questions that can be done as follow-ups.
@blarghmatey: Would you or someone from your team be available to help test this PR once it gets to an approved state? Would you like to review it before it merges?
Claude usage details
Claude drafted this review and ran these on 9e40e5e:
- Python suite (
pytest srcon Python 3.13, Django 5.2, SQLite): 839 passed. - Throwaway tests on a
<coderesponse>problem, with the stub service'sXQueueInterfacepointed at the real block. Not in the branch.- Nothing mocked, once with
<textbox>and once with<matlabinput>: onependingExternalGraderDetaileach, with the problem's queue name and queue key. SubmissionSerializer.savepatched to raiseDatabaseError: see the inline comment onreturn 1, str(err).- An answer one byte over 100 KB: see the same comment.
max_attempts=1withsend_to_submissionraisingSubmissionInternalError:attempts == 1and the problem is closed.max_attempts=1withsend_to_queueraisingResponseError:attempts == 0and the problem is open.
- Nothing mocked, once with
- The
max_attempts=1test onmain(4f034a4), not in any branch.use_submission_service=Trueandsend_to_submissionraising:submit_problemraises,attempts == 0.use_submission_service=Falseand_http_postreturning(1, "cannot connect to server"):attempts == 1and the problem is closed.
- Read edx-submissions 4.1.0 (the version in
uv.lock) for its exception messages, and the diff of openedx/openedx-platform#39405 for the calling side. Nothing was run against either.
Model: Claude Fable 5.2 (claude-fable-5-2)
| The header built here is an internal envelope: edx-submissions reads the | ||
| queue name and the queue key out of it and builds its own header for the | ||
| grader. The queue key format is the one the retired XQueue service used, | ||
| since the problem's correct map still stores it. |
There was a problem hiding this comment.
[Comment, no action needed]: With one backend left, the header is a dict that we serialize to JSON so that send_to_queue() and get_submission_params() can each parse it again to pull one value out. I'd like to see XQueueInterface and XQueueInterfaceSubmission collapse into one class that takes the queue name and key as plain arguments, but that should be its own PR.
9e40e5e to
1c5813e
Compare
ormsbee
left a comment
There was a problem hiding this comment.
Thank you for the quick turnaround. This takes care of everything from the last round, and I don't see anything blocking.
I have one request, which is to fix the comment in get_score() about what gets saved when the hand-off fails (inline). The other two comments are nits.
Once that's in, this is good for squashing. Please update the two commit bodies when you do, since they still describe the first version: send_to_queue() passing the exception's message along, and <matlabinput> only rendering as a code box.
Claude usage details
Claude drafted this review and ran these on 0a6e959:
- Python suite (
pytest srcon Python 3.13, Django 5.2, SQLite): 860 passed. git range-diffof the two rebased commits against the ones reviewed last time (20e505f, 9e40e5e): the second is unchanged, and the first differs only in lines that it deletes.- Throwaway tests on a
<coderesponse>problem, with the stub service'sXQueueInterfacepointed at the real block. Not in the branch.SubmissionSerializer.savepatched to raiseDatabaseError, with<img src=x onerror=alert(1)>as the answer andmax_attempts=1: the response is the fixed "the grading queue is unavailable" message,attempts == 0, the problem is open, and thelog.exceptionrecord has a traceback.- The same as a staff user: the "Staff debug info" traceback has the
ResponseErrorand nothing from theDatabaseError. - An answer one byte over 100 KB, nothing mocked: see the inline comment on "the submission was rejected".
<matlabinput>withmax_attempts=1, nothing mocked: "MATLAB problems can no longer be graded.", noSubmissionorExternalGraderDetailrows,attempts == 0, and the problem is open.- A queued submission followed by a failed one, and a problem with two
<coderesponse>s: see the inline comment inget_score().
- Read
display.jsfor how the message gets onto the page. Nothing was run in a browser.
Model: Claude Fable 5.2 (claude-fable-5-2)
| # Raising here, rather than returning an error correct map, keeps the failed | ||
| # hand-off from counting as an attempt: submit_problem catches ResponseError, | ||
| # shows the message and leaves the attempt count and the saved state alone. |
There was a problem hiding this comment.
submit_problem does save state on this path, in the except block that catches this. What it skips is counting the attempt and replacing the correct map. Claude ran two throwaway tests to see what that leaves behind:
- A first submission is queued, and then a second one fails here. The second answer is saved next to the first one's queue state, so when the first reply arrives, its result lands beside code that was never queued.
- A problem with two
<coderesponse>s, where the second answer is over the size limit. The first is leftpendingin edx-submissions, and since its queue key isn't in the correct map,update_score()won't use the reply.
I think both are fine for a failure case, and the first is what every ResponseError does already. But could you please update this comment to say what does get saved and mention those two cases, so that it's clear we accepted them on purpose?
| # The message goes in front of the learner, and codeinput.html renders it unescaped, | ||
| # so it is a fixed string: the exception text can carry the learner's own answer. | ||
| # The details go to the log. |
There was a problem hiding this comment.
Nit: Since the ResponseError change, this message doesn't get as far as codeinput.html. It goes back in the problem_check response, and gentle_alert() puts it on the page as HTML, so the reasoning still holds. The docstring on test_send_to_queue_reports_exceptions_as_errors mentions codeinput.html as well.
| # The message goes in front of the learner, and codeinput.html renders it unescaped, | |
| # so it is a fixed string: the exception text can carry the learner's own answer. | |
| # The details go to the log. | |
| # The message goes in front of the learner, and display.js shows it as HTML (see | |
| # gentle_alert()), so it is a fixed string: the exception text can carry the | |
| # learner's own answer. The details go to the log. |
| result = self.submission.send_to_submission(header, body, queue_key, files) | ||
| except SubmissionRequestError: | ||
| log.exception("Submission for %s was rejected by edx-submissions", self.block.usage_key) | ||
| return 1, "the submission was rejected" |
There was a problem hiding this comment.
Nit (optional): Claude ran an answer that's over the size limit through with nothing mocked, and the learner gets "Unable to deliver your submission to grader (Reason: the submission was rejected). Please try again later." Trying again later isn't going to help them. Neither reason is translated either, though that was also true of "cannot connect to server" on the HTTP path.
It might be simpler for get_score() to own the whole sentence for each case, but I'm fine with leaving that for the follow-up PR that collapses these classes.
There was a problem hiding this comment.
I created #345 to follow up and do the full collapse.
The MATLAB integration sent code to the MathWorks hosted service through the XQueue service and got results back on the XQueue callback URL. Neither exists any more: the service is deprecated and its repo archived (openedx/public-engineering#286), and the LMS now queues submissions in edx-submissions, which has no callback. openedx/public-engineering#192 deprecated the MATLAB handling in 2023 because the endpoint it talked to no longer worked. Remove MatlabInput, its template, fixture and CodeMirror octave mode, the sanitize_html helper only it used, the matlab_api_key field on ProblemBlock and LoncapaSystem, the API key payload in CodeResponse, and the ungraded_response handlers that carried MATLAB's plot output. <matlabinput> stays as a tag on CodeInput so existing problems still parse and learners keep their scores. It renders as a plain code box. CodeResponse refuses a new submission on it with "MATLAB problems can no longer be graded." instead of queueing it where no grader will pick it up, and the learner does not use an attempt. BREAKING CHANGE: LoncapaSystem no longer accepts matlab_api_key, and ProblemBlock no longer has that field or the ungraded_response handler. Co-Authored-By: Claude Fable 5.1 <[email protected]>
XQueueInterface could still post to the XQueue service over HTTP when the send_to_submission_course.enable flag was off for a course, with a login round trip, request timeouts and reply parsing to go with it. The XQueue service is deprecated and its repo archived (openedx/public-engineering#286), and edx-submissions is the only queue the LMS serves, so the HTTP path goes. XQueueInterface now takes the block and hands every submission to XQueueInterfaceSubmission. The header no longer carries a callback URL: scores come back through the EXTERNAL_GRADER_SCORE_SUBMITTED signal, not an HTTP callback. The header is an internal envelope now; edx-submissions reads the queue name and the queue key out of it and builds its own header for the grader. send_to_queue reports a failure inside edx-submissions as an error code and a fixed message, "the grading queue is unavailable", or "the submission was rejected" for a request edx-submissions refuses. The exception text can carry the learner's own answer and the message is shown as HTML, so the details only go to the log, with the traceback. It returns 0 on success, as the HTTP path did, where the edx-submissions path returned None. When the hand-off fails, CodeResponse.get_score raises a ResponseError instead of returning an error correct map. submit_problem shows the message and does not count the attempt, so a learner on their last attempt is not locked out by a submission that was never queued. BREAKING CHANGE: XQueueInterface(url, django_auth, requests_auth, block, use_submission_service) is now XQueueInterface(block). make_xheader no longer takes lms_callback_url. The runtime's xqueue service no longer needs construct_callback. A failed hand-off in CodeResponse now raises ResponseError rather than returning a correct map with the error message. Co-Authored-By: Claude Fable 5.1 <[email protected]>
0a6e959 to
3a99862
Compare
The MATLAB integration sent code to the MathWorks hosted service through the XQueue service and got results back on the XQueue callback URL. Neither exists any more, and xblocks-core has dropped MatlabInput and the matlab_api_key argument to LoncapaSystem (openedx/xblocks-core#338). openedx/public-engineering#192 deprecated the MATLAB handling in 2023 because the endpoint it talked to no longer worked. Remove the matlab_api_key field from ProblemBlock and from the inheritance mixin that put it on the course's Advanced Settings, the ungraded_response ajax handler that carried MATLAB's plot output, and the MATLAB wording on the Studio import and export pages. The cms tests that used matlab_api_key as a sample settings field use source_code instead. Existing <matlabinput> problems still parse: xblocks-core keeps the tag on CodeInput so learners keep their scores. BREAKING CHANGE: the "Matlab API key" advanced setting is gone from courses and problems. Course exports that carry matlab_api_key still import; the value is dropped. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The XQueue service is deprecated and its repo archived (openedx/public-engineering#286). The LMS queues external grader submissions in edx-submissions and serves the API that xqueue-watcher polls, and scores come back through the EXTERNAL_GRADER_SCORE_SUBMITTED signal. Nothing posts to the service any more: xblocks-core's XQueueInterface only hands submissions to edx-submissions (openedx/xblocks-core#338). Remove what only existed for the service: the XQUEUE_INTERFACE setting and its mock and test values, XQUEUE_PORT, the xqueue_callback view and its two URL patterns, XQueueService's HTTP setup and construct_callback, and the send_to_submission_course.enable course flag that picked between the two backends. XQUEUE_WAITTIME_BETWEEN_REQUESTS stays: it is the wait a learner has to observe between submissions to a queued problem. BREAKING CHANGE: XQUEUE_INTERFACE is no longer read. The send_to_submission_course.enable waffle flag is gone; every course's external grader submissions now go to edx-submissions. The /courses/<id>/xqueue/<user>/<block>/<dispatch> callback URL is gone. Co-Authored-By: Claude Fable 5.1 <[email protected]>
4.0.0 removes the legacy XQueue HTTP path and the MATLAB integration (openedx/xblocks-core#338), which the two commits before this one adapt the platform to. XQueueInterface now takes only the block, LoncapaSystem no longer accepts matlab_api_key, and <matlabinput> problems refuse new submissions instead of queueing them. Release notes: https://github.com/openedx/xblocks-core/releases/tag/v4.0.0 BREAKING CHANGE: MATLAB problems can no longer be submitted. They still load and keep their scores. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The MATLAB integration sent code to the MathWorks hosted service through the XQueue service and got results back on the XQueue callback URL. Neither exists any more, and xblocks-core has dropped MatlabInput and the matlab_api_key argument to LoncapaSystem (openedx/xblocks-core#338). openedx/public-engineering#192 deprecated the MATLAB handling in 2023 because the endpoint it talked to no longer worked. Remove the matlab_api_key field from ProblemBlock and from the inheritance mixin that put it on the course's Advanced Settings, the ungraded_response ajax handler that carried MATLAB's plot output, and the MATLAB wording on the Studio import and export pages. The cms tests that used matlab_api_key as a sample settings field use source_code instead. Existing <matlabinput> problems still parse: xblocks-core keeps the tag on CodeInput so learners keep their scores. BREAKING CHANGE: the "Matlab API key" advanced setting is gone from courses and problems. Course exports that carry matlab_api_key still import, and the key is kept as an unrecognized attribute and written back out on export, like any other attribute the platform does not know. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The XQueue service is deprecated and its repo archived (openedx/public-engineering#286). The LMS queues external grader submissions in edx-submissions and serves the API that xqueue-watcher polls, and scores come back through the EXTERNAL_GRADER_SCORE_SUBMITTED signal. Nothing posts to the service any more: xblocks-core's XQueueInterface only hands submissions to edx-submissions (openedx/xblocks-core#338). Remove what only existed for the service: the XQUEUE_INTERFACE setting and its mock and test values, XQUEUE_PORT, the xqueue_callback view and its two URL patterns, XQueueService's HTTP setup and construct_callback, and the send_to_submission_course.enable course flag that picked between the two backends. XQUEUE_WAITTIME_BETWEEN_REQUESTS stays: it is the wait a learner has to observe between submissions to a queued problem. BREAKING CHANGE: XQUEUE_INTERFACE is no longer read. The send_to_submission_course.enable waffle flag is gone; every course's external grader submissions now go to edx-submissions. The /courses/<id>/xqueue/<user>/<block>/<dispatch> callback URL is gone. Drain the XQueue server before upgrading: a result for a submission still queued there has no callback URL to come back to. Co-Authored-By: Claude Fable 5.1 <[email protected]>
4.0.0 removes the legacy XQueue HTTP path and the MATLAB integration (openedx/xblocks-core#338), which the two commits before this one adapt the platform to. XQueueInterface now takes only the block, LoncapaSystem no longer accepts matlab_api_key, and <matlabinput> problems refuse new submissions instead of queueing them. Release notes: https://github.com/openedx/xblocks-core/releases/tag/v4.0.0 BREAKING CHANGE: MATLAB problems can no longer be submitted. They still load and keep their scores. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The XQueue service is deprecated and its repo archived (openedx/public-engineering#286). The LMS queues external grader submissions in edx-submissions and serves the API that xqueue-watcher polls, and scores come back through the
EXTERNAL_GRADER_SCORE_SUBMITTEDsignal. This removes the code that only existed for the old service, and the MATLAB integration that only worked through it (openedx/public-engineering#192).XQueue
XQueueInterfaceno longer posts to the XQueue service over HTTP. The login round trip, the request timeouts,parse_xreplyand theuse_submission_serviceswitch are gone. It now takes the block and hands every submission toXQueueInterfaceSubmission.make_xheaderno longer takeslms_callback_url. Nothing calls back any more.xqueueservice no longer needsconstruct_callback.MATLAB
MatlabInput, its template, fixture and CodeMirror octave mode, and thesanitize_htmlhelper only it used are gone.matlab_api_keyis gone fromProblemBlockandLoncapaSystem, andCodeResponseno longer adds the API key to the grader payload.ungraded_responsehandlers that carried MATLAB's plot output are gone.<matlabinput>stays as a tag onCodeInput, so existing problems still parse and learners keep their scores. It renders as a plain code box.Both commits are
feat!, so this releases as a major version. openedx-platform needs a matching change for the newXQueueInterfacesignature and the droppedLoncapaSystemargument: openedx/openedx-platform#39405. The pin bump and that PR have to land together, since droppingmatlab_api_keyfrom the non-editable list here makes the field editable again in Studio on a platform that still has it on the inheritance mixin.The Python suite passes locally (836 tests). The JS spec that covered polling on a queued problem now uses a codeinput fixture instead of the MATLAB one.