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

Update Ruby to 3.2.2, Misc fixes #2040

Merged
merged 4 commits into from
Jan 4, 2024
Merged

Update Ruby to 3.2.2, Misc fixes #2040

merged 4 commits into from
Jan 4, 2024

Conversation

20wildmanj
Copy link
Contributor

@20wildmanj 20wildmanj commented Jan 3, 2024

Summary

Summary generated by Reviewpad on 04 Jan 24 10:51 UTC

This pull request includes the following changes:

  • The file "edit.html.erb" in the "app/views/announcements" directory has changes related to the form_for and render methods.
  • The "Annotation" model has changes in the "update_non_autograded_score" method affecting how "annotation_delta" is calculated.
  • The file "app/views/assessments/show.html.erb" has a small diff related to the render line.
  • The "nginx.conf" file shows a change in the Ruby version used for passenger.
  • The "submissions_controller_spec.rb" file has changes in the parameters passed to the "get :index" method.
  • The "metrics_controller.rb" file has changes in the "get_watchlist_instances" and "get_watchlist_configuration" methods.
  • The "courses_controller.rb" file has changes in the "add_users_from_emails" and "write_cuds" methods.
  • The "rails_helper.rb" file in the "spec" directory has changes related to setting up the Capybara driver for testing with Chrome.
  • The "courses_api_spec.rb" file has changes related to finding "course_user_data" using the "find_by" method.
  • The "course_user_datum.rb" file has changes in the "find_by" method and object initialization.
  • The "new.html.erb" file has a change in the render statement, affecting the locals hash.
  • The "oauth_device_flow_request.rb" file has a change in the create_request method.
  • The "app/views/users/edit.html.erb" file has a change in the render method, removing the f variable from the locals hash.
  • The "device_flow_requests_spec.rb" file has changes in the device_code parameter passed to the get :authorize request.
  • The "courses.rb" file has changes in the FactoryBot.create calls, missing arguments.
  • The "WatchlistInstance" model has changes related to query conditions and attribute assignments.
  • The "getjob.html.erb" file has changes in the rendered code, replacing file paths with [redacted].
  • The "tango_mock.rb" file modifies the open_result hash, removing a value and adding an extra closing bracket.
  • The "submissions_controller.rb" file has changes related to the view method, including modifications to variable assignments.
  • The "app/views/devise/registrations/edit.html.erb" file has changes in the render method and added readonly attribute.
  • The "edit.html.erb" file has a change in the render statement, affecting the path local variable.
  • The "Gemfile" shows changes in gem versions and additions/removals.
  • The "index.html.erb" file in the "app/views/doorkeeper/authorized_applications" directory has a change in the render method.
  • The "annotated_file" method, "version_over_threshold_by" method, and "group_associated_submissions" method have changes related to query conditions and variable assignments.
  • The "course_user_data_api_spec.rb" file has changes in the find_by method arguments.

Please review these changes for any unintended modifications or errors.

Description

Main change: Update Ruby version of Autolab from 2.7.7 to 3.2.2

  • update Capybara config so that it works with new ruby version and so that js can be enabled again on selenium test
    • removed webdrivers gem since we are now using selenium 4.11+ but added webrick since spec was failing without it
  • update releaseSectionGrades redirect to go to viewGradesheet for CA's section
  • add some more status text / more informative flash when instructor drops student

Course user data page for instructor viewing dropped student:
Screenshot 2024-01-04 at 12 01 27 AM

When dropping student, see flash:

Screenshot 2024-01-04 at 12 03 30 AM
  • redact tango key in getjob

Before:
Screenshot 2024-01-04 at 12 05 19 AM

After:
Screenshot 2024-01-04 at 12 04 31 AM

Motivation and Context

As part of new Autolab release, ensure that Ruby is up to date and is within security EOL.

How Has This Been Tested?

Ran

rbenv install $(cat .ruby-version)

then

bundle install

to update.

Used google spreadsheet for manual testing strategy: doc

Passes all spec tests.

Dropping student:

  • try dropping student as instructor, see that notice flash indicates you dropped student + course user datum page indicates student is dropped
  • when undropping, no flash should appear

getjob:

  • submit job to autolab, see that upon viewing job the tango key isn't exposed after courselabs in input files or job parameters

releaseSectionGrades:

  • try to release section grades for already released grades as a CA, see that you get an error flash and are redirect to the gradesheet for your section

Checklist:

  • I have run rubocop and erblint for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting

- update Capybara config so that it works with new ruby version and so that js can be enabled again on selenium test
- update releaseSectionGrades redirect to go to viewGradesheet for CA's section
- add some more status text / more informative flash when instructor drops student
- redact tango key in getjob
@reviewpad reviewpad bot added large Pull request is large waiting-for-review labels Jan 3, 2024
Copy link
Contributor

coderabbitai bot commented Jan 3, 2024

Walkthrough

Walkthrough

The project underwent a significant upgrade to Ruby 3.2.2, entailing updates to the Docker base image, Ruby version specifications in the Gemfile, and dependency versions. Codebase compatibility with the new Ruby version was ensured by modifying function calls, query structures, and handling of parameters across the controllers, models, and views. The changes also included syntax corrections and refactoring to adhere to Ruby 3.2's standards and requirements, aiming for a seamless transition without affecting the project's performance.

Changes

Files Change Summary
.ruby-version, Dockerfile, Gemfile Updated to Ruby 3.2.2, Docker base image to phusion/passenger-ruby32:2.6.1, and Gemfile dependencies.
app/controllers/..., app/models/... Modified function calls, query structures, and parameter handling for Ruby 3.2.2 compatibility.
app/views/... Removed specific local variable assignments from render calls, impacting forms and partials.
docker/nginx.conf Updated passenger_ruby directive to point to Ruby 3.2.
spec/... Adjusted test cases and configurations to align with the updated Ruby version and codebase changes.

Related issues

  • Issue autolab/Autolab#2029 by damianhxy could be linked to this PR since:
    • The PR addresses the upgrade to Ruby 3.2.2, ensuring codebase compatibility and updating gem dependencies, which aligns with the issue's objectives of upgrading Ruby and verifying test passage.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

app/views/assessments/show.html.erb Show resolved Hide resolved
app/controllers/submissions_controller.rb Show resolved Hide resolved
app/controllers/submissions_controller.rb Show resolved Hide resolved
app/models/watchlist_instance.rb Show resolved Hide resolved
app/models/watchlist_instance.rb Show resolved Hide resolved
app/views/devise/passwords/new.html.erb Show resolved Hide resolved
app/views/course_user_data/edit.html.erb Show resolved Hide resolved
app/views/devise/passwords/edit.html.erb Show resolved Hide resolved
app/views/groups/new.html.erb Show resolved Hide resolved
app/views/devise/registrations/edit.html.erb Show resolved Hide resolved
Gemfile.lock Outdated Show resolved Hide resolved
@damianhxy
Copy link
Member

Screenshot 2024-01-04 at 15 24 39

Would be good to fix this deprecation warning

@20wildmanj
Copy link
Contributor Author

@cg2v for this PR, I tested the dynamic form issue with assessments, and did not get a ruby/exception:NoMethodError so it may be fixed now.

Gemfile.lock Show resolved Hide resolved
@damianhxy
Copy link
Member

Nit unrelated to this PR (introduced by #1649):

Inside _usersTable.html.erb, the count-title code should look like
<h4 class="count-title">Found <span id="results-count"><%= @cuds.count %></span> users</h4>

i.e. only the count is inside results-count. Otherwise course_users.js doesn't set the count correctly

Screenshot 2024-01-04 at 18 46 09

Copy link
Member

@damianhxy damianhxy left a comment

Choose a reason for hiding this comment

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

Followed testing plan, LGTM other than the nit noted

@20wildmanj 20wildmanj added this pull request to the merge queue Jan 4, 2024
Merged via the queue into master with commit e460512 Jan 4, 2024
6 checks passed
@20wildmanj 20wildmanj deleted the joeywildman-ruby-3.2.2 branch January 4, 2024 12:37
@damianhxy damianhxy linked an issue Jan 4, 2024 that may be closed by this pull request
@damianhxy damianhxy mentioned this pull request Jan 4, 2024
NicholasMy pushed a commit to UB-CSE-IT/Autolab that referenced this pull request Jan 8, 2024
* Update Ruby to 3.2.2
- update Capybara config so that it works with new ruby version and so that js can be enabled again on selenium test
- update releaseSectionGrades redirect to go to viewGradesheet for CA's section
- add some more status text / more informative flash when instructor drops student
- redact tango key in getjob

* Address nits, update bundler / github integration

* add arm64-darwin-23 to platforms

* fix users nit

(cherry picked from commit e460512)
michellexliu added a commit that referenced this pull request Feb 4, 2024
* Lint views/submissions (#1969)

* Begin linting views/submissions

* finish linting views/submissions

* address issues in code_viewer

* Prevent spoofing the author of an annotation (#1985)

* Prevent spoofing the author of an annotation

(cherry picked from commit d2ab510)

* Remove submitted_by from createAnnotation

* Update link to docs in PR template (#1991)

Fix link to docs

* Hide irrelevant cud fields for students (#1988)

* Show edit CUD button for students

* Hide irrelevant CUD fields from students

* Lint views/autograders, fix help-block gap from input (#1963)

* lint views/autograders, fix help block gap from input

* update form path

* Lint views/announcements and Touch-up UI (#1957)

* lint views/announcements and touch-up UI

* address nits

* Add erblint to overcommit and github actions (#1994)

* update erb-lint config, overcommit config to enable erb-lint as a pre-commit hook, run erblint --lint-all

* update github actions to run erb-lint during linting phase

* update pull request template to include erblint check

* Display Grace Day usage on submission history table, improve management of assessment penalty settings (#1990)

* Display of grace days used

* Fix calculation of effective_late_penalty and effective_version_penalty

* Show course default values when applicable

* Show warning messages when late submissions allowed but config does not make sense

* Fix tests

* Update wording

* Improve formatting

* Revert changes to effective penalties

* Simplify check

* Add toggles

* Update wording on courseFields

* Fix version threshold logic

* Correctly set version threshold to blank when using course default

* Clear / default values when checkbox clicked

* Remove bottom padding

* Improve UI when checkboxes selected

* Address AI nits

* Handle malformed scoreboard results from autograder, fix error handling for scoreboards (#1982)

* begin fixing broken redirects

* add code to check that entries are arrays, return flash error if not valid entry

* fix spacing

* address nit

* Add logging

* Click into submissions from gradebook score (#1998)

* Clickable gradebook scores

* Only scores have links

---------

Co-authored-by: kestertan <[email protected]>

* Switch mossnet clean to use rails root instead of tilde expansion (#1997)

use Rails root join function instead of ~/ to make sure moss clean script works across systems

* Merge pull request from GHSA-h8wq-ghfq-5hfx

* fixes

* Add validation for handout, writeup, and handin_directory

* Avoid use of and

* Check that handout/writeup exists before checking path (#2001)

Move present? check to front

* Adds warning when assessment.rb file upload isn't a .rb file (#1999)

* preliminary working version

* only validates .rb files

---------

Co-authored-by: Damian Ho <[email protected]>

* Refactor Assessment name rules, remove config file requirement (#1987)

* begin refactoring naming rules for assessments

* continue working on file acceptance

* add testing

* fix autograde

* work on backwards compatibility / revertibility

* keep working on implementing revertability

* Fix some code creating assessmentConfigFile before assessment id created

* Add documentation to naming rules

* add line about assessment name uniqueness

* update error messages

* fix tests

* add error handling code to redirect user in case assessment config file can't be loaded, run robocop

* address AI code review

* remove redundant flash

* Fix text

* Fix reload assessment config button text

* Add more error handling, revamp regex string to better reflect valid ruby module names, add better sanitization for display name -> name conversion, fix docs to reflect actually valid assessment names.

* fix test

* Address nits

* Fix issue where assessment could affect another assessment's config file if they both had names that mapped to pre-PR config file name

* Delete config/oauth_config.yml

* Delete diff.patch

* Delete assessment.patch

* remove unnecessary files

* more removals

* Suppress confirmation dialog on edit assessment page when no changes made (#2004)

* Extract logic, call functions directly

* Remove extraneous space

* Remove another extraneous space

* Display submission version in gradebook (#2005)

* First Commit: version info is on gradebook as new columns

* Second commit: only add a ver column after each assignment

* Delete database.docker.yml

* Delete schema.rb

* Deleted debug code

* change gitignore to original version

* Address nits

* Fix tooltips

* Simplify version logic

* Stop overwriting headerCssClass

* Fix tooltip for not_yet_submitted

* Handle nil aud

* Add version to gradebook CSV export

* Render tooltips onMouseEnter too

* Simplify version header

* Simplify logic

* Increase gradebook width

---------

Co-authored-by: SimonMen65 <[email protected]>
Co-authored-by: Simon Men <[email protected]>

* Don't clear assessment penalty fields on initial load (#2006)

* Don't clear on initial load

* Remove extraneous spaces

* No line breaks when generating base64 strings (#2008)

* fix bug for long strings

* Update base64.js using new TextEncoder

* Show all courses for MOSS (#2015)

* Show all courses, restore filter

* Address AI nits

* Fix use of autocomplete attribute

* Add newline

* Simplify toggleOptions implementation

* Fix style of isArchive checkboxes

* Correct use of javascript_include_tag

* Fix failing test

* Update styling of warning

* Extract dropdown logic, use OR for filtering

* Add newline

* Add spacing between dropdowns

* Use find instead of children, check for selector existence

* Removed name from assessment yml (#1993)

* Removed name from assessment yml

* Modified test after removing name from assessment yml

* Removed unnecessary test for wrong assessment name

* Removed yml name check in assessments_controller

---------

Co-authored-by: Nicholas Clark <[email protected]>

* Account for hooks in viewFeedback instead of feedback output (#2003)

* preliminary working version

* resolve merge conflicts

* use submission.scores instead of feedback array

* don't show non autograded scores in autograded scores tab

* rabbit ai suggestions

* more rabbit.ai nits

* make finishedAutograding not an instance variable

* Remove element overlapping scrollbar hitbox (#2009)

* Remove element overlapping scrollbar hitbox

* Move style to annotation.scss

---------

Co-authored-by: Damian Ho <[email protected]>

* Attachment categories (#1983)

* Add category_name field and update course attachment UI

* Improve styling of list items

* Remove anchor link for unreleased badge, simplify delete button logic

* Hide assessment attachments from course landing page

* Add release_at field, remove released field

* Fix tests

* Add fixtures

* Simplify variable names

* Remove bullet points

* Group buttons together

* Make font-family consistent

* Hide category for assessment attachments

* Add cancel button, remove delete button, improve styling

* Improve migration to be backwards compatible / reversible

* Use update instead of update_attribute

* Display when attachment will be released

* Update tests

* Simplify code

* Use Time instead of DateTime

* Add download icon for students

* Vertically align icons

* Hide assessment attachments from course attachment index

* Add vertical space above release date

* Passwordless temporary login (#1984)

* Passwordless temporary login created

* Login using devise

* User is not signed in before changing password

* Removing unneeded files

* Removing changes to user.rb

* Removing unneeded files

* Resetting password does not log you out

* Added mailer

* Added/removed newlines

* Changed naming

* Added checks for nil user or params

* Error handling for passwords

* Removed email after password reset

* Added documentation

* Updated documentation

* Moved documentation to features

* Renamed to admin-features

* Added link in mkdocs.yml

* Visual cue for assessments (#2016)

* Add dates to assessment card

* Add CSS formatting for date

* Fix margin and card sizes to be more pretty

* Show all students on gradesheet (#2019)

* add course members with blank info if no submissions found

* add email for no submission users

* update bg color

* Move submission version logic to be handled by AUD (#2024)

* Move submission version logic to be handled by AUD

* update migration variable naming

* fix unit tests, version number for new auds

* fix coderabbit issues

* add version number to schema

* change schema timestamp

* Use ActiveStorage for attachments, add attachment size limit (#2023)

* 1810 Use ActiveStorage for attachments

* 1864 Add backwards compatibility to ActiveStorage Attachments

* 1872 Add size limit to attachments

* Set mime_type

* Remove require

* redirect to index on error

* Rails 6.1.7.6 Migration (#2037)

* Initial update to 6.1.7.6

* Lock fomantic-ui-sass to 2.8.8.1

* Update schema.rb

* Avoid locking setup-ruby version

* Include net-http in Gemfile to avoid errors

* Run rubocop

* Lock uri to 0.10.0

* Fix lint issue

* Fix course_number values for roster export

* Use flash for drop warning

* Properly display submission errors

* Only show invalid assessment warning to instructors

* Ensure gradebook search bar renders correctly for CAs

* Filter by lecture too when CA views section

* Only show missing submissions from section if CA filters by section

* Update tests

* Better handling for submission errors

* More specific error handling for save_entries

* Better error display for statistics page

* Return 404 for popover on non-existent submission

* load Archive in files that use its methods

* Update Ruby to 3.2.2, Misc fixes (#2040)

* Update Ruby to 3.2.2
- update Capybara config so that it works with new ruby version and so that js can be enabled again on selenium test
- update releaseSectionGrades redirect to go to viewGradesheet for CA's section
- add some more status text / more informative flash when instructor drops student
- redact tango key in getjob

* Address nits, update bundler / github integration

* add arm64-darwin-23 to platforms

* fix users nit

* Bump uri from 0.10.0 to 0.10.3 (#2039)

Bumps [uri](https:/ruby/uri) from 0.10.0 to 0.10.3.
- [Release notes](https:/ruby/uri/releases)
- [Commits](ruby/uri@v0.10.0...v0.10.3)

---
updated-dependencies:
- dependency-name: uri
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update old migrations for Ruby 3 (#2044)

Use splat on old migrations

* Remove grading deadline (#2014)

* Initial removal of grading_deadline

* Add brackets around arguments to grading_complete?

* Consistency fixes

* Migration to remove grading deadline

* Add guards to migration

* Rename grading_complete? to grades_released?

* Address issues from v2.8.0 testing, misc fixes/changes (#2038)

* Fix command for promoting a user to admin

* Extract aria/collapsible code, switch to path helpers

* Automatically open first accordion

* Fix docs for Tango info endpoint

* Create user directory on autograde_done

* Coalesce accordions, simplify js, remove admin options

* Update doorkeeper translations

* Remove extraneous quotes

* Remove redundant / useless assessment nil check

* Fix error display when calling downloadAll on invalid assessment

* Simplify failure redirect logic for downloadAll

* Deduplicate logic for autograde feedback path and handin file path

* Remove unused ass_dir variable

* Remove redundant gitignores

* Uncoalesce accordions

* Fix redirects for invalid assessment

Previously, calling downloadAll with an invalid assessment led to infinite redirects

* Update the API to allow retrieving group members (#1956)

* Add a param to the index groups api to retriee group members

* Add api show endpoint for groups

* Update docs

* Update api docs for groups#show

* Compact group members api response

* Move fetching group json to a private method

* Remove empty line

---------

Co-authored-by: Damian Ho <[email protected]>

* Update index and show docs for Groups API (#2045)

Update index and show docs

* Main Table UI Changes (#1886)

* Start Manage Submissions

* Center checkbox in manage submission table (#1868)

fix checkbox issue

* Main Table UI

* Updates with selecting students and buttons

* Add Score Popup Icon

* Icon spacing and codebase style

---------

Co-authored-by: Michelle Liu <[email protected]>

* Add sorting icons to new manage submissions (#1890)

* change icon to swap_vert, hide for file and actions headers

* change icon on diff sort

* Adds Score Details (#1893)

* Adds score details without styling

* address general styling for score details

* refactor code

* address pr issues

* bring back css

* bring back div

* add back class names

* add back icons

* addressed nits

* address nits

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Joey Wildman <[email protected]>
Co-authored-by: Nicholas Myers <[email protected]>
Co-authored-by: Damian Ho <[email protected]>
Co-authored-by: Kester <[email protected]>
Co-authored-by: kestertan <[email protected]>
Co-authored-by: SimonMen65 <[email protected]>
Co-authored-by: Simon Men <[email protected]>
Co-authored-by: Ugo <[email protected]>
Co-authored-by: Nicholas AJ Clark <[email protected]>
Co-authored-by: Nicholas Clark <[email protected]>
Co-authored-by: lykimchee <[email protected]>
Co-authored-by: Joanna Ge <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Umar Alkafaween <[email protected]>
Co-authored-by: Victor Huang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
large Pull request is large
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade Ruby to 3.2
2 participants