-
Notifications
You must be signed in to change notification settings - Fork 155
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
chore: upgrade to ruby 3 #392
Conversation
Thanks for the pull request, @xitij2000! As a core committer in this repo, you can merge this once the pull request is approved per the core committer reviewer requirements and according to the agreement with your edX Champion. |
e44db28
to
0830b1f
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #392 +/- ##
=========================================
Coverage ? 96.08%
=========================================
Files ? 58
Lines ? 4522
Branches ? 0
=========================================
Hits ? 4345
Misses ? 177
Partials ? 0 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
0830b1f
to
75afe61
Compare
75afe61
to
207d17c
Compare
@xitij2000 Thank you for the contribution, let me know once this is ready. |
@xitij2000 Following our today BTR call, we were disucssing whether discussion (backend service) should run on Ruby 3 or not. One factor obviously is deadline of this PR, can you by any chance estimae when this would be ready/merged? Also can you confirm that the alternative is to run the service on a ruby version (2.5.7) ref which already has reached its EOL? Note: I personally tested this locally but I had to do #395 first and the test was run tutor based using the forum plugin, overhangio/tutor-forum#11 and we are in the process of testing in the acutal production. |
It looks like there's also a Ruby 2.7.6 upgrade option that might be easier, but that would also go EOL about 3 months before Palm is released. I think this one slipped under the radar because our Ruby entries in the support windows doc were outdated. |
I will try to prioritise this in the upcoming sprint. Initially the aim was just to get tests running on Ruby 3.0 to catch any new failures, and slowly fix things over time, but I can put some of my CC time to getting this running. @jmbowman I aimed for 3.x for that very reason, that 2.7 was also close to EOL. I will see if I can get all tests passing and if the forum is running without issues on 3.x, and if not I'll see if 2.7 is easier. |
0fab65e
to
41946be
Compare
@xitij2000 This looks great and it required less changes than I thought it would! |
@@ -96,7 +96,7 @@ def get_paged_merged_responses(thread_id, responses, skip, limit, recursive=fals | |||
paged_response_ids = limit.nil? ? response_ids.drop(skip) : response_ids.drop(skip).take(limit) | |||
if recursive | |||
content = Comment.where(comment_thread_id: thread_id). | |||
or({:parent_id => {"$in" => paged_response_ids}}, {:id => {"$in" => paged_response_ids}}). | |||
any_of({:parent_id => {"$in" => paged_response_ids}}, {:id => {"$in" => paged_response_ids}}). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this API works has changed in mongoid.
So while the previous version was equivalent to:
comment_thread_id == thread_id AND (parent_id in paged_response_ids OR id in paged_response_ids)
It is now equivalent to
comment_thread_id == thread_id OR parent_id in paged_response_ids OR id in paged_response_ids)
since the where is merged into the or. Using any_of
fixes this issue (ref)
@@ -331,7 +331,7 @@ def test_unicode_data(text) | |||
page_3 = parse last_response.body | |||
|
|||
|
|||
all_items["collection"].should == ( | |||
expect(all_items["collection"]).to eq( | |||
page_1["collection"] + | |||
page_2["collection"] + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These just update to the newer syntax.
@@ -40,6 +40,6 @@ | |||
body { Faker::Lorem.paragraph } | |||
course_id { comment_thread.course_id } | |||
commentable_id { comment_thread.commentable_id } | |||
endorsed false | |||
endorsed { false } | |||
end | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates tot accommodate new versions of Faker, and migration from FactoryGirl -> FactoryBot
def t(*args, **kwargs) | ||
I18n.t(*args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruby generally uses more keyword arguments, which have had major changes in Ruby 3. Without this, keyword arguments are no longer passed and translations break when paramaterised translations are used (in one place).
53684c1
to
712a8bd
Compare
I've got all the tests running and passing on both Ruby 3.0 and 3.1, however with Ruby 3.1 the CI seems to fail due to failed dependencies when building an extension. I might not have time to resolve that, but it is working otherwise. |
712a8bd
to
0cf3536
Compare
Thanks a lot for taking care of this @xitij2000! 👍
|
c713baa
to
30220dc
Compare
@asadazam93, is this something you could look at in the next couple of days? We want to have it in as part of the Olive release, since Ruby < 3 is out of support (and has been for a while). |
@xitij2000 Is this a breaking change? |
It should not be. This PR is tested against both the current version of Ruby (2.5.7) and on Ruby 3.0.x. However, the idea is to eventually start using Ruby 3.0, so it sets the stage for that. |
Hi folks, Would it be possible for this to be merged today or by tomorrow at least. Since then it need to be backported to olive and then tested again with the recent commits to olive...etc. Thus the sooner this is merged the less urguent things would need to be done for the olive relaese. I appercaite your understaning and happy to help if anything is needed with this. |
Upgrade the service to work on both on Ruby 2.5.7 (currently used by the repo) and 3.0 (which is currently supported). Additionally, switch from running tests inside a docker container launched through scripts to directly setting up and testing inside GitHub's containers.
Also update readmde about how to update the rack-timeout
30220dc
to
afeb30c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been tested in production via the Tutor demo/testing deployment, and no issues were found. Approved!
@xitij2000 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Upgrade the service to work on both on Ruby 2.5.7 (currently used by the repo) and 3.0 (which is currently supported). Additionally, switch from running tests inside a docker container launched through scripts to directly setting up and testing inside GitHub's containers. Co-authored-by: Ghassan Maslamani <[email protected]>
This PR adds support for running cs_comments_service on Ruby 3 in addition to Ruby 2.5
Given that Ruby 2.5 is EOL, 2.7 will be EOL within months. Ruby 3 gives us a bit over a year to upgrade to Ruby 3.1.
Sandbox URL: TBD - sandbox is being provisioned.
Merge deadline: "None"
Testing instructions:
This PR can be used with the corresponding devstack PR to manually test this PR.
Testing should involve manual interaction with all the aspects of the forum.
Author notes and concerns:
The code has been tested and is working with 3.1 as well, but there are issues when running 3.1 on CI. It will hopefully not require much effort to upgrade to 3.1