Skip to content

Ruby 3 compatibility#251

Merged
andreslucena merged 51 commits intodevelopfrom
fix/ruby3
Apr 5, 2022
Merged

Ruby 3 compatibility#251
andreslucena merged 51 commits intodevelopfrom
fix/ruby3

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen commented Mar 25, 2022

This PR started with updating the Graphlient gem but it turned out to a wider Ruby 3 upgrade where we upgrade also other gems as well as the base docker image. After this is completed, we can publish a new version of the gem which allows us to update Decidim to Ruby 3.

The current version of the Graphlient gem is not Ruby 3 compatible but 0.5.0 makes it run on Ruby 3.

This is an issue for upgrading Decidim to Ruby 3 as discussed at decidim/decidim#8452.

Fixes #262.

@ahukkanen
Copy link
Copy Markdown
Contributor Author

We need to release a new version of the base Docker image (ruby-node-python-electionguard) which is currently under the Codegram organization at DockerHub:
https://hub.docker.com/u/codegram

It is based on this Dockerfile:
https://github.com/decidim/decidim-bulletin-board/blob/5b79ff859f3754bd4270e986094b7a26414e132c/voting_schemes/electionguard/docker/ruby-node-python-electionguard/Dockerfile

So this is what I want to discuss about @andreslucena, we need to release this under the Decidim organization and then update the Docker image references accordingly.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 30, 2022

Codecov Report

Merging #251 (8885cc7) into develop (8d10d79) will increase coverage by 0.36%.
The diff coverage is 73.33%.

@@             Coverage Diff             @@
##           develop     #251      +/-   ##
===========================================
+ Coverage    69.05%   69.42%   +0.36%     
===========================================
  Files           95       96       +1     
  Lines         1616     1622       +6     
===========================================
+ Hits          1116     1126      +10     
+ Misses         500      496       -4     
Impacted Files Coverage Δ
...in_board/server/app/commands/process_tally_step.rb 100.00% <ø> (ø)
...oard/server/app/commands/report_missing_trustee.rb 100.00% <ø> (ø)
...er/app/controllers/sandbox/elections_controller.rb 0.00% <0.00%> (ø)
...oard/server/app/jobs/sandbox/generate_votes_job.rb 0.00% <0.00%> (ø)
bulletin_board/server/app/commands/start_tally.rb 100.00% <100.00%> (ø)
bulletin_board/server/app/models/election.rb 100.00% <100.00%> (ø)
...ard/server/app/services/concerns/redis_provider.rb 100.00% <100.00%> (ø)
bulletin_board/server/app/models/log_entry.rb 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d10d79...8885cc7. Read the comment docs.

@ahukkanen ahukkanen changed the title Update graphlient for Ruby 3 compatibility Ruby 3 compatibility Mar 30, 2022
@ahukkanen ahukkanen requested a review from andreslucena March 31, 2022 08:06
This fixes the following deprecation message:
```
Redis.current=` is deprecated and will be removed in 5.0.
```
Comment thread bulletin_board/server/app/models/election.rb
Copy link
Copy Markdown
Contributor Author

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

These I needed to change because the pending_message.to_json was causing a "Stack level too deep" error after the gems update.

@ahukkanen
Copy link
Copy Markdown
Contributor Author

@andreslucena All tests are now passing, so I would appreciate if you could take a look as well. I left some review comments to help you out above.

Most of the changes are in the configurations (i.e. Ruby 3.0.2 instead of Ruby 2.6.6) and some minor changes in the server application. For the ruby-client itself the only other change is upgrading graphlient to the 0.5.x version which supports Ruby 3.

Copy link
Copy Markdown
Contributor Author

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Comment thread bulletin_board/server/app/jobs/sandbox/generate_votes_job.rb
Comment thread bulletin_board/server/app/services/concerns/redis_provider.rb
Comment thread bulletin_board/server/config/initializers/redis.rb
@andreslucena
Copy link
Copy Markdown
Member

Code wise I see it all OK. I didn't have the chance to try this out locally.

As we've talked Wednesday, I'm in the process of trying this app integration with Decidim, but I'm actually blocked in one specific step of the process (already reported at #9120).

What we can try meanwhile, so we don't block this merge, is the Sandbox feature, just to be sure that everything works as expected. It emulates all the different steps of an Election. I don't know if you've already checked that, but if not, I can try to do that Monday and let you know.

@ahukkanen
Copy link
Copy Markdown
Contributor Author

What we can try meanwhile, so we don't block this merge, is the Sandbox feature, just to be sure that everything works as expected. It emulates all the different steps of an Election. I don't know if you've already checked that, but if not, I can try to do that Monday and let you know.

@andreslucena Yes I've played with the sandbox and to me everything seems to work correctly.

There is also the Cypress E2E integration tests in this repo which I believe should run through all the functionality the Sandbox app provides, right? These tests are also part of the CI and passing.

@andreslucena
Copy link
Copy Markdown
Member

Oh great, if sandbox is covered by specs, and you've checked that manually, then we're good to go for me!

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

👍🏽

@ahukkanen
Copy link
Copy Markdown
Contributor Author

Yes, I've tested all the actions in the sandbox app and to me they all seem to work. I could not get the tally process to work automatically without "Restoring" the keys, if I understood correctly it should read it automatically from the browser's database without having to "restore" the key from the backup file. But this may be just a problem with my browser (or the client implementation) and I don't think anything in the app has changed with this part (as it's front-end functionality).

Only thing I noticed is that sometimes when I click e.g. "Start tally", the state won't update in the view but after I refresh the page, it is updated. This is because some actions in the sandbox app won't wait for the action to finish at the bulletin board before sending the response to the client, e.g. in this case:

bulletin_board_client.start_tally(election_id)
go_back

But I believe this is a problem also in the current version of the sandbox app, nothing is changed with these actions with the Ruby 3 update and the E2E tests still work (it's just a matter how fast you are loading the view after the redirect).

@ahukkanen
Copy link
Copy Markdown
Contributor Author

@andreslucena I did a small change still after testing this with the Decidim integration.

We will also need to release a new version of the bulletin board docker image, so I changed that also to reference the Decidim organization at DockerHub. I will push the image there once this PR is merged.

@andreslucena andreslucena added dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code labels Apr 5, 2022
@andreslucena andreslucena merged commit ed12a53 into develop Apr 5, 2022
@andreslucena andreslucena deleted the fix/ruby3 branch April 5, 2022 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken CI: template is not valid

3 participants