Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Lab: Run validation code in start mode #45500

Merged
merged 10 commits into from
Mar 30, 2022
Merged

Conversation

molly-moen
Copy link
Contributor

@molly-moen molly-moen commented Mar 25, 2022

Allow validation code that has not yet been saved to the level to be run in start mode. This PR created the route we use here. If we are in start mode and are doing a test run, we use this route, which passes whatever validation code is currently in the editor. We don't need to use this route for a regular run because validation code is ignored on a normal run.

I also did a minor refactor of our connect logic since we now have 3 different routes. Instead of passing in parameters for each potential option and doing an if/else we now have 3 separate functions.

As part of this PR I also added a comment to cdo.rb with the format for dev javabuilder routes, because I kept having to put my route there for testing.

Links

Testing story

Tested locally against deployed Javabuilder.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@molly-moen molly-moen requested a review from a team March 25, 2022 17:15
Copy link
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines 40 to 41
// Get the access token to connect to javabuilder and then open the websocket connection.
// The token prevents access to our javabuilder AWS execution environment by un-verified users.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: mind adding to this comment describing when we'd use this as opposed to the other functions? just want to make sure we document that this is meant for typical student code execution vs the other two are special cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Comment on lines 80 to 84
const ajaxPayload = {
url: '/javabuilder/access_token_with_override_validation',
type: 'get',
data: requestData
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: instead of creating the full payload each time, connectJavabuilderHelper could take in a url and requestData param? it's a small change though so I'm fine with this as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Comment on lines +141 to +142
# To use a developer instance of Javabuilder instead, replace this url with
# 'wss://<your-javabuilder-domain>.dev-code.org'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding these!

@molly-moen molly-moen merged commit 9c0f0ab into staging Mar 30, 2022
@molly-moen molly-moen deleted the validation-start-mode branch March 30, 2022 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants