Commit Graph

199 Commits

Author SHA1 Message Date
Sebastian Serth
264927e3c4 Fix unnecessary testrun for each successful test / score action.
This commit resolves a regression introduced by commit 9c3ec3c7.

We still might want to remove this false data from our database, which is still pending.
2023-07-15 19:00:26 +02:00
Sebastian Serth
e8a21ea319 Further optimize extracting errors
The previous solution worked, but always queried all ErrorTemplateAttributes, even if there was no match of the ErrorTemplate. This solution resolves this issue and still benefits from less SQL queries.
2023-03-21 07:34:31 +01:00
Sebastian Serth
09809cc12e Preload error template attributes in SubmissionsController
The join operation is okay, since a similar one is otherwise performed automatically by Rails
2023-03-20 23:52:34 +01:00
Sebastian Serth
9c3ec3c7ff Refactor submission scoring and testing
* Properly cancel code execution if running is prohibited
* Correctly monitor duration with Sentry
* Align methods with running submissions
2023-02-17 18:13:48 +01:00
Sebastian Serth
a1ec4579fe Properly cancel code execution if running is prohibited 2023-02-17 18:13:48 +01:00
Sebastian Serth
e9cf79085a Refactor listing files to be independent of exiting runners
Previously, we were always fetching files, even if not required (e.g., for score runs). Now, we reduce the number of file listings and use a dedicated callback.
2023-02-16 10:50:01 +01:00
Sebastian Serth
91c2e14fe8 Fix error handling during Runner::Connection close
Closes CODEOCEAN-HQ
2023-02-16 10:47:28 +01:00
Sebastian Serth
6a942ccf50 Capture exception for Scoring
Previously, an exception was caused by the tubesock gem but not sent to Sentry. This caused errors not to bubble up correctly but rather kill the current thread, leaving the user with a generic "WebSocket connection not established" message.

Probably, this should be removed when updating the WebSocket implementation.
2022-12-23 13:04:34 +01:00
Sebastian Serth
574e99eddd Fix rubocop offenses - Requires Ruby 3.1+ 2022-11-25 11:10:06 +01:00
Sebastian Serth
b2af4e0663 Check submission and exercise files when filtering downloads 2022-11-17 20:47:33 +01:00
Sebastian Serth
591f776f69 Close WebSocket connection normally
With Tubesock, we need to send a close frame ourselves. Otherwise, some browsers might display a warning.
2022-11-16 23:16:49 +01:00
Sebastian Serth
0950e626ba Convert message data to string before slicing
Fixes CODEOCEAN-F1
2022-11-16 19:53:19 +01:00
Sebastian Serth
60078701f5 Editor: Allow file retrieval after code run 2022-10-29 18:49:18 +02:00
Sebastian Serth
c75f52f2c8 Fix Rubocop offenses 2022-10-24 12:28:50 +02:00
Sebastian Serth
f7515362a1 Set Content-Type to fixed value for all download actions 2022-10-05 21:46:17 +02:00
Sebastian Serth
2d95a737f6 Assume failed code execution if no status was received 2022-10-04 16:08:10 +02:00
Sebastian Serth
b8b7cd99bd SubmissionsController: Allow JS to be "rendered"
We skip verifying the authenticity token for the action, to prevent raising a `ActionController::InvalidCrossOriginRequest` exception.
2022-10-04 16:06:59 +02:00
Sebastian Serth
ca13ea03c8 SubmissionsController: Send Content-Length if possible 2022-10-04 16:06:59 +02:00
Sebastian Serth
c3daa51c8c SubmissionsController: Remove outdated ActionController::Live mixin
The mixin was previously used for Server-Sent-Events, which were removed from CodeOcean a long time ago.
After the mixin is removed, we can also fix the cookie send mechanism (this was erroneous with the mixin).
2022-10-04 16:06:58 +02:00
Sebastian Serth
3263d4f838 Respect subpath for (render_)protected_upload_path 2022-09-28 11:06:15 +02:00
Sebastian Serth
16c00ec136 Add support for signed URLs used by the render_file function 2022-09-23 21:35:22 +02:00
Sebastian Serth
5b73f4df6f Refactor render_file method
* We simplify the send_data call,
* ensure to set the correct header, and
* prevent our custom MIME type detection
2022-09-06 11:21:33 +02:00
Sebastian Serth
b6d8c7175b Disallow any external resources for :render_file 2022-09-06 11:20:57 +02:00
Sebastian Serth
0a16f589e9 Use X-Sendfile to transmit native files and handle file uploads 2022-09-06 01:21:40 +02:00
Sebastian Serth
60dc8c3b7e Apply line-based coloring for output 2022-09-02 16:56:18 +02:00
Janis4411
e0c2c7b806 Hide score button if exercise has no tests
We check for all teacher-defined assessments (linter and unit tests) to determine whether scoring should be possible
2022-08-22 17:51:57 +02:00
Sebastian Serth
c228850ae8 Update find method 2022-08-20 00:37:48 +02:00
Sebastian Serth
d762f976a8 Add new CodeOcean::File#read method
* With a new method, we can simplify our code to handle differences between file.content and file.native_file.read
2022-08-19 22:42:55 +02:00
Sebastian Serth
acc07ffa5d Disallow leading / in zip archives 2022-08-18 16:45:15 +02:00
Sebastian Serth
145c4aa8d5 Refactor various ruby files
* Insights based on brakeman report
2022-08-18 15:25:04 +02:00
Sebastian Serth
01f6b0d16e Reduce skip_before_action usage 2022-08-17 00:54:20 +02:00
Sebastian Serth
9587ecb2b1 Resolve bug where duration of not-started runner cannot be calculated 2022-07-15 00:49:16 +02:00
Sebastian Serth
1183f5cdcd Ensure that the testrun[:status] is available in more cases 2022-07-15 00:49:15 +02:00
Sebastian Serth
0ab3d0bdc1 Fix Rubocop offenses 2022-06-30 14:02:53 +02:00
Sebastian Serth
ea728f54ec Fix remote evaluations URL when using subdirectory for CO 2022-05-14 19:01:54 -04:00
Sebastian Serth
ea02dff0e5 Extend storage of Testrun Messages and truncate long output 2022-04-29 22:44:34 +02:00
Sebastian Serth
5ecba6ef70 Persist TestrunMessages and store timestamp
So far, the Testrun messages are in addition to the Tesstrun.output column
2022-04-29 01:00:51 +02:00
Sebastian Serth
e9efb5bc2b Add exit_code and status to Testruns, create model for TestrunMessages
* This is the first step to migrate the `output` column from Testruns to a dedicated table TestrunMessages
2022-04-28 15:18:51 +02:00
Sebastian Serth
83e09f33ec Merge pull request #1237 from openHPI/aws_experiment
Prepare AWS Experiment
2022-04-18 21:18:29 +02:00
Sebastian Serth
19bd742bc9 Show a localized message if the program was killed.
* This will most likely happen by the OOM killer, thus we inform the user about the memory restriction.
2022-04-15 21:29:55 +02:00
Sebastian Serth
d10735d0a8 Persist Execution Environment when running code 2022-04-15 15:22:19 +02:00
Sebastian Serth
0583076c2b Fix Thread leakage when scoring or testing submissions
It is discouraged to do anything directly within the
Tubesock hijack block. We might only use the callbacks
(onopen, onmessage, onclose, onerror). Otherwise,
Tubesock might not close all Threads correctly and
will keep them awake every five seconds.
2022-04-07 19:57:31 +02:00
Sebastian Serth
0a6ae91db8 Introduce per_page parameter for custom page size 2022-01-12 20:46:54 +01:00
Sebastian Serth
ea85519163 Update bundle (with newest rubocop version) and fix offenses 2022-01-04 09:42:37 +01:00
Sebastian Serth
0c1a10959c Use file name with file path as identifier 2021-12-15 00:52:31 +01:00
Sebastian Serth
695c3de40e Ensure users are signed in before creating a submission 2021-11-14 23:07:44 +01:00
Sebastian Serth
c3642b5d0c Add an empty line before printing exit message
* The empty line is only added if the output is not empty
2021-11-01 17:52:44 +01:00
Sebastian Serth
de83843496 Combine no_output and exit_status messages 2021-11-01 17:13:13 +01:00
Sebastian Serth
7285978ea3 Re-add test method for SubmissionsController 2021-11-01 17:13:01 +01:00
Sebastian Serth
56a1d78793 Use correct embed_option to disable_score 2021-11-01 17:13:01 +01:00