Flaky test on ./spec/features/projects/show/user_sees_git_instructions_spec.rb[1:1:3:2:1:1]

./spec/features/projects/show/user_sees_git_instructions_spec.rb[1:1:3:2:1:1] fails when run the first time, but passes after retries:

Running with retries:

$ RETRIES=1 bundle exec spring rspec spec/features/projects/show/user_sees_git_instructions_spec.rb --format=doc
Running via Spring preloader in process 2654
WARNING: `around(:context)` hooks are not supported and behave like `around(:example). Called from /Users/albert/Dev/src/gitlab.com/gitlab-org/gdk/gitlab/spec/support/omniauth_strategy.rb:36:in `block in <main>'.
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Projects > Show > User sees Git instructions
  when project is public
    when project has no repo
WARNING: Active Record does not support composite primary key.

project_authorizations has composite primary key. Composite primary key is ignored.
      shows Git command line instructions
    :default_branch_name is specified
      recommends default_branch_name instead of master
    when project is empty
      when not signed in
        shows details
      when signed in
        when user does not have ssh keys
          shows details
        when user has ssh keys
          shows details
    when project is not empty
      when not signed in
        shows details
      when signed in
        when user does not have ssh keys
          shows details

1st Try error in ./spec/features/projects/show/user_sees_git_instructions_spec.rb:43:
Validation failed: Notification settings is invalid

RSpec::Retry: 2nd try ./spec/features/projects/show/user_sees_git_instructions_spec.rb:43
        when user has ssh keys
          shows details
  when project is internal
    when not signed in
      redirects to the sign in page
    when signed in
      shows details
  when project is private
    redirects to the sign in page

Finished in 32.84 seconds (files took 4.9 seconds to load)
11 examples, 0 failures

Without RETRIES=1:

Failures:

  1) Projects > Show > User sees Git instructions when project is public when project is not empty when signed in when user does not have ssh keys shows details
     Failure/Error: instance.save! if Gitlab::Database.read_write?

     ActionView::Template::Error:
       Validation failed: Notification settings is invalid
     Shared Example Group: "shows details of non empty project" called from ./spec/features/projects/show/user_sees_git_instructions_spec.rb:145
     # ./app/models/concerns/token_authenticatable_strategies/base.rb:44:in `reset_token!'
     # ./app/models/concerns/token_authenticatable_strategies/base.rb:37:in `ensure_token!'
     # ./app/models/concerns/token_authenticatable.rb:48:in `block in add_authentication_token_field'
     # ./app/models/user.rb:1691:in `feed_token'
     # ./app/helpers/rss_helper.rb:5:in `rss_url_options'
     # ./app/views/projects/show.html.haml:7:in `block in _app_views_projects_show_html_haml__4292093732577306305_323760'
     # ./app/views/projects/show.html.haml:6:in `_app_views_projects_show_html_haml__4292093732577306305_323760'
     # ./app/controllers/application_controller.rb:125:in `render'
     # ./app/controllers/application_controller.rb:537:in `block in allow_gitaly_ref_name_caching'
     # ./lib/gitlab/gitaly_client.rb:322:in `allow_ref_name_caching'
     # ./app/controllers/application_controller.rb:536:in `allow_gitaly_ref_name_caching'
     # ./ee/lib/gitlab/ip_address_state.rb:10:in `with'
     # ./ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address'
     # ./lib/gitlab/auth/current_user_mode.rb:56:in `with_current_admin'
     # ./app/controllers/application_controller.rb:485:in `set_current_admin'
     # ./lib/gitlab/session.rb:11:in `with_session'
     # ./app/controllers/application_controller.rb:473:in `set_session_storage'
     # ./lib/gitlab/i18n.rb:73:in `with_locale'
     # ./lib/gitlab/i18n.rb:79:in `with_user_locale'
     # ./app/controllers/application_controller.rb:467:in `set_locale'
     # ./lib/gitlab/error_tracking.rb:52:in `with_context'
     # ./app/controllers/application_controller.rb:532:in `sentry_context'
     # ./app/controllers/application_controller.rb:460:in `block in set_current_context'
     # ./lib/gitlab/application_context.rb:56:in `block in use'
     # ./lib/gitlab/application_context.rb:56:in `use'
     # ./lib/gitlab/application_context.rb:22:in `with_context'
     # ./app/controllers/application_controller.rb:451:in `set_current_context'
     # ./lib/gitlab/request_profiler/middleware.rb:17:in `call'
     # ./lib/gitlab/query_limiting/middleware.rb:17:in `block in call'
     # ./lib/gitlab/query_limiting/transaction.rb:39:in `run'
     # ./lib/gitlab/query_limiting/middleware.rb:16:in `call'
     # ./lib/gitlab/jira/middleware.rb:19:in `call'
     # ./lib/gitlab/middleware/go.rb:20:in `call'
     # ./lib/gitlab/etag_caching/middleware.rb:21:in `call'
     # ./lib/gitlab/middleware/multipart.rb:172:in `call'
     # ./lib/gitlab/middleware/read_only/controller.rb:50:in `call'
     # ./lib/gitlab/middleware/read_only.rb:18:in `call'
     # ./lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
     # ./lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
     # ./lib/gitlab/middleware/basic_health_check.rb:25:in `call'
     # ./lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
     # ./lib/gitlab/middleware/request_context.rb:23:in `call'
     # ./config/initializers/fix_local_cache_middleware.rb:9:in `call'
     # ./lib/gitlab/middleware/static.rb:11:in `call'
     # ./lib/gitlab/testing/clear_process_memory_cache_middleware.rb:13:in `call'
     # ./lib/gitlab/testing/request_inspector_middleware.rb:33:in `call'
     # ./lib/gitlab/testing/robots_blocker_middleware.rb:30:in `call'
     # ./lib/gitlab/testing/request_blocker_middleware.rb:47:in `call'
     # ./lib/gitlab/metrics/requests_rack_middleware.rb:76:in `call'
     # ./spec/features/projects/show/user_sees_git_instructions_spec.rb:142:in `block (6 levels) in <main>'
     # ./spec/spec_helper.rb:325:in `block (3 levels) in <main>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:316:in `block (2 levels) in <main>'
     # ./spec/spec_helper.rb:312:in `block (3 levels) in <main>'
     # ./spec/spec_helper.rb:312:in `block (2 levels) in <main>'
     # -e:1:in `<main>'
     # ------------------
     # --- Caused by: ---
     # ActiveRecord::RecordInvalid:
     #   Validation failed: Notification settings is invalid
     #   ./app/models/concerns/token_authenticatable_strategies/base.rb:44:in `reset_token!'

Finished in 31.9 seconds (files took 5.41 seconds to load)
11 examples, 1 failure