| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Addresses the following error that was encountered when attempting to execute the GitHub Actions that correspond with the edited workflows files: https://github.com/DMPRoadmap/roadmap/actions/runs/9513143079/job/26222602325 3s ``` Run bundle exec rails db:create RAILS_ENV=test To use retry middleware with Faraday v2.0+, install `faraday-retry` gem To use multipart middleware with Faraday v2.0+, install `faraday-multipart` gem; note: this is used by the ManageGHES client for uploading licenses Copying Bootstrap glyphicons to the public directory ... Copying TinyMCE skins to the public directory ... /home/runner/work/roadmap/roadmap/config/initializers/recaptcha.rb:8:in `block in <main>': undefined method `[]' for nil:NilClass (NoMethodError) from /home/runner/work/roadmap/roadmap/vendor/bundle/ruby/3.0.0/gems/recaptcha-5.17.0/lib/recaptcha.rb:37:in `configure' from /home/runner/work/roadmap/roadmap/config/initializers/recaptcha.rb:7:in `<main>' ```
Prior to this commit, the Rails credentials were not being updated during this setup process.
Here are links to the errors being raised prior to this commit: https://github.com/DMPRoadmap/roadmap/actions/runs/9822436610/job/27119190298?pr=3435 https://github.com/DMPRoadmap/roadmap/actions/runs/9822436613/job/27119190303?pr=3435 https://github.com/DMPRoadmap/roadmap/actions/runs/9844975903/job/27179509035?pr=3435
This commit undoes some Rubocop fixes made from a prior commit ( bda5b6e ). However, it also resolves the following error that was being raised: https://github.com/DMPRoadmap/roadmap/actions/runs/9845084297/job/27179836711
</tr>
Generated by 🚫 Danger |
Sorry, something went wrong.
|
The failing tests still need to be addressed for the PostgreSQL GitHub action, but the workflow is now executing. The MySQL GitHub action is still failing to execute. Many errors like the following are being thrown: ActiveRecord::MismatchedForeignKey: Column `org_id` on table `annotations` does not match column `id` on `orgs`, which has type `bigint unsigned`. To resolve this issue, change the type of the `org_id` column on `annotations` to be :bigint. (For example `t.bigint :org_id`). These errors are related to the migrations added to #3426. When the migrations were run, many tables not targeted by the migrations were also updated. Here is an example: # before running migrations
create_table "orgs", id: :integer, force: :cascade do |t|
# after running migrations
create_table "orgs", id: :serial, force: :cascade do |t|It seems that :serial is interpreted differently by MySQL and PostgreSQL. I think PostgreSQL casts it to type :integer, whereas MySQL casts it to type :bigint. Because the associated foreign keys are defined as type :integer, This would explain why the MySQL GitHub Action is now failing. I'm not sure how to proceed here. Should we simply retire the MySQL GitHub Actions? Or perhaps re-running the migrations with a MySQL db would re-cast the primary keys to type :integer (I can't seem to get ruby bin/setup mysql to work on my machine)? Wondering what your thoughts might be here @benjaminfaure and @briri. Thank you. |
Sorry, something went wrong.
Omitting the arguments results in lambda implicitly using self, which appears to be the desired behaviour here. It also resolves the Rubocop offences.
|
There are now two failing tests within the PostgreSQL workflow. Although the tests were passing prior to this Rails 7 upgrade, there were known issues prior to it:
Failures:
1) Template#customize! sets visibility to Organisationally visible
Failure/Error: expect(subject.visibility).to eql(Template.visibilities['organisationally_visible'])
expected: 0
got: "organisationally_visible"
(compared using eql?)
# ./spec/models/template_spec.rb:1086:in `block (3 levels) in <main>'
2) Template#upgrade_customization! sets the visibility to Organisationally visible
Failure/Error: expect(subject.visibility).to eql(Template.visibilities['organisationally_visible'])
expected: 0
got: "organisationally_visible"
(compared using eql?)
# ./spec/models/template_spec.rb:1155:in `block (3 levels) in <main>' |
Sorry, something went wrong.
`template.visibilty` now returns a string rather than an integer. The Rails 7 upgrade actually fixes a couple of bugs within `app/views/org_admin/templates/_form.html.erb` and `app/views/org_admin/templates/_show.html.erb`. Prior to this upgrade, template.visibility would return an integer. Now that it is returning a string, the `f.object.visibility == 'organisationally_visible'` and `template.visibility == 'organisationally_visible'` checks within the aforementioned files are behaving as desired.
Prior to this commit, the default checked/unchecked values were used (i.e. "1" would be returned when checked, and "0" would be returned when unchecked). However, the box is meant to be checked when selecting 'organisationally_visible' ('for internal %{org_name} use only'), which makes the default checked/unchecked values opposite to the mapping of our enums (i.e. `{"organisationally_visible"=>0, "publicly_visible"=>1}`).
The aforementioned issues have been addressed, but now the following ./spec/requests/api/v1/authentication_controller_spec.rb tests are breaking: Failures:
1) Api::V1::AuthenticationController actions POST /api/v1/authenticate renders /api/v1/error template if authentication fails
Failure/Error: expect(response.code).to eql('401')
expected: #<Encoding:UTF-8> "401"
got: #<Encoding:US-ASCII> "400"
(compared using eql?)
# ./spec/requests/api/v1/authentication_controller_spec.rb:31:in `block (4 levels) in <main>'
2) Api::V1::AuthenticationController actions POST /api/v1/authenticate returns a JSON Web Token
Failure/Error: expect(response.code).to eql('[200](https://github.com/DMPRoadmap/roadmap/actions/runs/9881513683/job/27292456367?pr=3435#step:13:201)')
expected: #<Encoding:UTF-8> "200"
got: #<Encoding:US-ASCII> "400"
(compared using eql?)
# ./spec/requests/api/v1/authentication_controller_spec.rb:39:in `block (4 levels) in <main>'
|
Sorry, something went wrong.
29: # POST /api/v1/authenticate 30: # rubocop:disable Metrics/AbcSize 31: def authenticate 32: byebug => 33: body = request.body.read 34: json = JSON.parse(body) 35: auth_svc = Api::V1::Auth::Jwt::AuthenticationService.new(json: json) 36: @token = auth_svc.call 37: (byebug) request.headers['Content-Type'] "application/x-www-form-urlencoded" (byebug) request.body.read "" Rails 7 appears to apply stricter parsing rules. If the Content-Type is application/x-www-form-urlencoded, the body will not be parsed as JSON. The following code changes throughout the codebase seem to resolve this: # Old Code
post api_v1_authenticate_path, params: @payload.to_json
# New Code (use `as:` for encoding the request's content type)
post api_v1_authenticate_path, params: @payload, as: :json |
Sorry, something went wrong.
Rails 7 appears to apply stricter parsing rules. If the Content-Type is not JSON, then the body will not be parsed as JSON.
Prior to this code change, any value assigned to the `'data-method':` attribute of the `link_to` method was not being read (and instead defaulting to `GET`). This was resulting in the breaking of several `spec/features/` tests (https://github.com/DMPRoadmap/roadmap/actions/runs/9946998559/job/27478725801). The `@rails/ujs` library is meant to handle this `'data-method':` attribute.
|
Hi @benjaminfaure, thanks for the approval on this PR. I added a couple more commits, so maybe it'd be best to get one more review/approval before I merge it into your Rails 7 upgrade branch? Thank you. :) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #3419
Changes proposed in this PR:
This PR seeks to fix the PostgreSQL GitHub Actions for PR Updated app to rails 7 #3426 (NOTE: Fix PostgreSQL GitHub Action and Tests For Rails 7 Upgrade #3435 (comment) explains why the MySQL GitHub Action is still not working)
The Style/SymbolProc-related Rubocop fixes applied in commit bda5b6e have been undone. Although executing rubocop -A results in these changes, those changes were causing errors within the code. (To address these Rubocop offences, commit 283e585 has been added instead.)
This PR also fixes failing tests executed by the PostgreSQL GitHub Action. These changes include the following:
This PR also resolves the GitHub issue Template.visibililty Checks Not Always Working as Expected #3419.