From a2919993b16bebbb889f39e72900b56f79d6ba1f Mon Sep 17 00:00:00 2001
From: Igor Drozdov <idrozdov@gitlab.com>
Date: Wed, 7 Aug 2024 12:47:31 +0000
Subject: [PATCH] Update activerecord-gitlab to support both 7.0 and 7.1

---
 Gemfile.next.checksum                         |  30 ++--
 Gemfile.next.lock                             |  90 ++++++------
 gems/activerecord-gitlab/.gitlab-ci.yml       |   1 +
 gems/activerecord-gitlab/Gemfile              |   2 +
 gems/activerecord-gitlab/Gemfile.lock         |  13 +-
 gems/activerecord-gitlab/Gemfile.next         |   7 +
 gems/activerecord-gitlab/Gemfile.next.lock    | 131 ++++++++++++++++++
 .../gitlab_patches/partitioning/base.rb       |  30 ++--
 .../associations/belongs_to_spec.rb           |   4 +-
 .../associations/has_many_spec.rb             |   4 +-
 .../partitioning/associations/has_one_spec.rb |   6 +-
 .../partitioning/single_model_queries_spec.rb |   2 +-
 gems/gem.gitlab-ci.yml                        |  11 +-
 spec/lib/gitlab_spec.rb                       |   2 +
 14 files changed, 249 insertions(+), 84 deletions(-)
 create mode 100644 gems/activerecord-gitlab/Gemfile.next
 create mode 100644 gems/activerecord-gitlab/Gemfile.next.lock

diff --git a/Gemfile.next.checksum b/Gemfile.next.checksum
index e6e6d7c8b7b50..bde3d0f46de15 100644
--- a/Gemfile.next.checksum
+++ b/Gemfile.next.checksum
@@ -31,15 +31,15 @@
 {"name":"ast","version":"2.4.2","platform":"ruby","checksum":"1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12"},
 {"name":"async","version":"2.12.1","platform":"ruby","checksum":"146fb3acf6d05ad40abb9ae659dd3b574067a3420fe7d6d5d6a3cf5413de3ea5"},
 {"name":"atlassian-jwt","version":"0.2.1","platform":"ruby","checksum":"2fd2d87418773f2e140c038cb22e049069708aff2bd0a423a7e1740574e97823"},
-{"name":"attr_required","version":"1.0.1","platform":"ruby","checksum":"024e10393bd30901e1adf6769bd756b873a5ef7da60f86f8f11066116b5742bc"},
+{"name":"attr_required","version":"1.0.2","platform":"ruby","checksum":"f0ebfc56b35e874f4d0ae799066dbc1f81efefe2364ca3803dc9ea6a4de6cb99"},
 {"name":"awesome_print","version":"1.9.2","platform":"ruby","checksum":"e99b32b704acff16d768b3468680793ced40bfdc4537eb07e06a4be11133786e"},
 {"name":"awrence","version":"1.2.1","platform":"ruby","checksum":"dd1d214c12a91f449d1ef81d7ee3babc2816944e450752e7522c65521872483e"},
 {"name":"aws-eventstream","version":"1.3.0","platform":"ruby","checksum":"f1434cc03ab2248756eb02cfa45e900e59a061d7fbdc4a9fd82a5dd23d796d3f"},
-{"name":"aws-partitions","version":"1.877.0","platform":"ruby","checksum":"9552ed7bbd3700ed1eeb0121c160ceaf64fa5dbaff5a1ff5fe6fd8481ecd9cfd"},
+{"name":"aws-partitions","version":"1.960.0","platform":"ruby","checksum":"0847ac5526305080ba6056d7f6b96c8d580d1526b79915d541333e58bf5ff857"},
 {"name":"aws-sdk-cloudformation","version":"1.41.0","platform":"ruby","checksum":"31e47539719734413671edf9b1a31f8673fbf9688549f50c41affabbcb1c6b26"},
-{"name":"aws-sdk-core","version":"3.200.0","platform":"ruby","checksum":"1d9ac535f82b5ea7b3d6e0cee7be3c48981a948123a48ff755504b7343d16951"},
-{"name":"aws-sdk-kms","version":"1.76.0","platform":"ruby","checksum":"e7f75013cba9ba357144f66bbc600631c192e2cda9dd572794be239654e2cf49"},
-{"name":"aws-sdk-s3","version":"1.155.0","platform":"ruby","checksum":"4674e07846cc6d77d5bd122cef7fea5055e8b53bf238ab05beebc25ecb01c2e2"},
+{"name":"aws-sdk-core","version":"3.201.3","platform":"ruby","checksum":"c045a7ff37b4a6f1de5742e64def0841bdf70d215cb17d3875b2c5bdd9e99d52"},
+{"name":"aws-sdk-kms","version":"1.88.0","platform":"ruby","checksum":"13588d90df1eece81f6d79bd304b3857dc3168e7ea75c933b3b835cfe8a0e309"},
+{"name":"aws-sdk-s3","version":"1.156.0","platform":"ruby","checksum":"9302da1d1a70363308854d5065035f6c72cf8b8af895d8789487cd5c6b076a46"},
 {"name":"aws-sigv4","version":"1.8.0","platform":"ruby","checksum":"84dd99768b91b93b63d1d8e53ee837cfd06ab402812772a7899a78f9f9117cbc"},
 {"name":"axe-core-api","version":"4.9.1","platform":"ruby","checksum":"9ea7ac16bfee1cb3545345d210878aa8cccfb41b493e00fe1faab79af4d9fed8"},
 {"name":"axe-core-rspec","version":"4.9.1","platform":"ruby","checksum":"31ef067bee36d6efb3f156a83aa2fb6ac721270a53fb9473f0268e325a3e6efd"},
@@ -97,7 +97,7 @@
 {"name":"creole","version":"0.5.0","platform":"ruby","checksum":"951701e2d80760f156b1cb2a93471ca97c076289becc067a33b745133ed32c03"},
 {"name":"crystalball","version":"0.7.0","platform":"ruby","checksum":"6e729f372a5071daec877adb40c5df4cb25fe21f350635e2a9624373fc151ef2"},
 {"name":"css_parser","version":"1.14.0","platform":"ruby","checksum":"f2ce6148cd505297b07bdbe7a5db4cce5cf530071f9b732b9a23538d6cdc0113"},
-{"name":"cssbundling-rails","version":"1.4.0","platform":"ruby","checksum":"082034653af0ec53d7662e4cd2f518f36167fe7c014dbcf37a941a4a8324f7db"},
+{"name":"cssbundling-rails","version":"1.4.1","platform":"ruby","checksum":"4b21273d627b21890da9155c88c67efc9274373d8b0add09149c262cf56c7ce1"},
 {"name":"cvss-suite","version":"3.0.1","platform":"ruby","checksum":"b5ca9e9e94032a42fd0dc28c1e305378b62c949e35ed7111fc4a1d76f68ad3f9"},
 {"name":"danger","version":"9.4.2","platform":"ruby","checksum":"43e552c6731030235a30fdeafe703d2e2ab9c30917154489cb0ecd9ad3259d80"},
 {"name":"danger-gitlab","version":"8.0.0","platform":"ruby","checksum":"497dd7d0f6513913de651019223d8058cf494df10acbd17de92b175dfa04a3a8"},
@@ -148,6 +148,7 @@
 {"name":"elasticsearch-transport","version":"7.17.11","platform":"ruby","checksum":"d18057d5295e4c39fe80084ede9e00e9c0e0d74580348985f8677b2fb7f70f03"},
 {"name":"email_reply_trimmer","version":"0.1.6","platform":"ruby","checksum":"9fede222ce660993e4e2e3dad282535ceb7914e246eb8302c19aa9e021f7326e"},
 {"name":"email_spec","version":"2.2.0","platform":"ruby","checksum":"60b7980580a835e7f676db60667f17a2d60e8e0e39c26d81cfc231805c544d79"},
+{"name":"email_validator","version":"2.2.4","platform":"ruby","checksum":"5ab238095bec7aef9389f230e9e0c64c5081cdf91f19d6c5cecee0a93af20604"},
 {"name":"encryptor","version":"3.0.0","platform":"ruby","checksum":"abf23f94ab4d864b8cea85b43f3432044a60001982cda7c33c1cd90da8db1969"},
 {"name":"erubi","version":"1.12.0","platform":"ruby","checksum":"27bedb74dfb1e04ff60674975e182d8ca787f2224f2e8143268c7696f42e4723"},
 {"name":"escape_utils","version":"1.3.0","platform":"ruby","checksum":"dffb7010922880ace6ceed642156c64e2a64620f27e0849f43bc4f68fd3c2c09"},
@@ -335,7 +336,7 @@
 {"name":"js_regex","version":"3.8.0","platform":"ruby","checksum":"7934bcdd5a0e6d5af4a520288fd4684a02a472ae55831d9178ccaf82356344b5"},
 {"name":"json","version":"2.7.2","platform":"java","checksum":"138e3038b5361b3d06ee2e8aa2be00bed0d0de4ef5f1553fc5935e5b93aca7ee"},
 {"name":"json","version":"2.7.2","platform":"ruby","checksum":"1898b5cbc81cd36c0fd4d0b7ad2682c39fb07c5ff682fc6265f678f550d4982c"},
-{"name":"json-jwt","version":"1.15.3","platform":"ruby","checksum":"66db4f14e538a774c15502a5b5b26b1f3e7585481bbb96df490aa74b5c2d6110"},
+{"name":"json-jwt","version":"1.16.6","platform":"ruby","checksum":"ab451f9cd8743cecc4137f4170806046c1d8a6d4ee6e8570e0b5c958409b266c"},
 {"name":"json_schemer","version":"2.3.0","platform":"ruby","checksum":"9f1fa173b859ca520f15e9e8d08b0892ffca80b78dd8221feb3e360ff4cdeb35"},
 {"name":"jsonb_accessor","version":"1.3.10","platform":"java","checksum":"6630ac69dac46457b03e1352178ed3e2d7ba2d8edb99f2e9b64a0e60cda9ed26"},
 {"name":"jsonb_accessor","version":"1.3.10","platform":"ruby","checksum":"670f80a257ae39e3be9233c6a8ef3b03517e06687affe510dfe61237454c58e0"},
@@ -345,7 +346,7 @@
 {"name":"kaminari-actionview","version":"1.2.2","platform":"ruby","checksum":"1330f6fc8b59a4a4ef6a549ff8a224797289ebf7a3a503e8c1652535287cc909"},
 {"name":"kaminari-activerecord","version":"1.2.2","platform":"ruby","checksum":"0dd3a67bab356a356f36b3b7236bcb81cef313095365befe8e98057dd2472430"},
 {"name":"kaminari-core","version":"1.2.2","platform":"ruby","checksum":"3bd26fec7370645af40ca73b9426a448d09b8a8ba7afa9ba3c3e0d39cdbb83ff"},
-{"name":"kas-grpc","version":"0.5.0","platform":"ruby","checksum":"6c796f5afb1f1f37ae7a9d958d9f4b0ba46249e0dd4ca6ee268d4210b85dce35"},
+{"name":"kas-grpc","version":"0.6.0","platform":"ruby","checksum":"43f7364cf45d50d5696ca4e1689bb648f22e5cec70fcf8ffe58330c04455af79"},
 {"name":"knapsack","version":"4.0.0","platform":"ruby","checksum":"a9422688751989d09a40b4bf7f959a71a3bfe7bc49d3cd610c2fcfb6e45482b8"},
 {"name":"kramdown","version":"2.3.2","platform":"ruby","checksum":"cb4530c2e9d16481591df2c9336723683c354e5416a5dd3e447fa48215a6a71c"},
 {"name":"kramdown-parser-gfm","version":"1.1.0","platform":"ruby","checksum":"fb39745516427d2988543bf01fc4cf0ab1149476382393e0e9c48592f6581729"},
@@ -444,9 +445,9 @@
 {"name":"omniauth-oauth2-generic","version":"0.2.8","platform":"ruby","checksum":"ce6e8539019d5ebf2f48867072b9f248f148bb4cbe7166dee655865abfae7613"},
 {"name":"omniauth-saml","version":"2.1.0","platform":"ruby","checksum":"969cb7ba271891d09dfa57b206fc274f43203c52727492517decda93decc6906"},
 {"name":"omniauth-shibboleth-redux","version":"2.0.0","platform":"ruby","checksum":"e9b353fd103405fcc8549e8510b9cad857acf0b286d764fac5dba8a93ab8ffe1"},
-{"name":"omniauth_openid_connect","version":"0.6.1","platform":"ruby","checksum":"5f1318f5b19b05e339ff494def060b57a503b1e3ea83c3a0ced6cc014407d423"},
+{"name":"omniauth_openid_connect","version":"0.8.0","platform":"ruby","checksum":"1f2f3890386e2a742221cee0d2e903b78d874e6fab9ea3bfa31c1462f4793d25"},
 {"name":"open4","version":"1.3.4","platform":"ruby","checksum":"a1df037310624ecc1ea1d81264b11c83e96d0c3c1c6043108d37d396dcd0f4b1"},
-{"name":"openid_connect","version":"1.3.0","platform":"ruby","checksum":"a796855096850cc01140e37ea6ae9fd14f2be818b9b5bc698418063dfe228770"},
+{"name":"openid_connect","version":"2.3.0","platform":"ruby","checksum":"0dbb9cefeb11e0a65e706349266355bbbb060382ae138fc9e199ab1aa622744c"},
 {"name":"openssl","version":"3.1.0","platform":"ruby","checksum":"e3a01279e918a7a5cf741db69b124864878b1a9783b1f2d34854bc1d444ac430"},
 {"name":"openssl-signature_algorithm","version":"1.3.0","platform":"ruby","checksum":"a3b40b5e8276162d4a6e50c7c97cdaf1446f9b2c3946a6fa2c14628e0c957e80"},
 {"name":"opentelemetry-api","version":"1.2.5","platform":"ruby","checksum":"ab3d9a0566cd2ee068ade40e840bc973383ab8568e693c0c5712f0c789122cc9"},
@@ -526,7 +527,7 @@
 {"name":"rack-accept","version":"0.4.5","platform":"ruby","checksum":"66247b5449db64ebb93ae2ec4af4764b87d1ae8a7463c7c68893ac13fa8d4da2"},
 {"name":"rack-attack","version":"6.7.0","platform":"ruby","checksum":"3ca47e8f66cd33b2c96af53ea4754525cd928ed3fa8da10ee6dad0277791d77c"},
 {"name":"rack-cors","version":"2.0.2","platform":"ruby","checksum":"415d4e1599891760c5dc9ef0349c7fecdf94f7c6a03e75b2e7c2b54b82adda1b"},
-{"name":"rack-oauth2","version":"1.21.3","platform":"ruby","checksum":"4e72a79dd6a866692e84422a552b27c38a5a1918ded06661e04910f2bbe676ba"},
+{"name":"rack-oauth2","version":"2.2.1","platform":"ruby","checksum":"c73aa87c508043e2258f02b4fb110cacba9b37d2ccf884e22487d014a120d1a5"},
 {"name":"rack-protection","version":"2.2.2","platform":"ruby","checksum":"fd41414dbabbec274af0bdb1f72a48504449de4d979782c9af38cbb5dfff3299"},
 {"name":"rack-proxy","version":"0.7.7","platform":"ruby","checksum":"446a4b57001022145d5c3ba73b775f66a2260eaf7420c6907483141900395c8a"},
 {"name":"rack-session","version":"1.0.2","platform":"ruby","checksum":"a02115e5420b4de036839b9811e3f7967d73446a554b42aa45106af335851d76"},
@@ -699,7 +700,7 @@
 {"name":"strings-ansi","version":"0.2.0","platform":"ruby","checksum":"90262d760ea4a94cc2ae8d58205277a343409c288cbe7c29416b1826bd511c88"},
 {"name":"strscan","version":"3.1.0","platform":"java","checksum":"8645aa76e017e21764c6df572d2d79fcc1672284014f5bdbd806278cdbcd11b0"},
 {"name":"strscan","version":"3.1.0","platform":"ruby","checksum":"01b8a81d214fbf7b5308c6fb51b5972bbfc4a6aa1f166fd3618ba97e0fcd5555"},
-{"name":"swd","version":"1.3.0","platform":"ruby","checksum":"bc382a19e1d36a95529b25152976db61b80376c3d486b21c8dd60ac2b5c06389"},
+{"name":"swd","version":"2.0.3","platform":"ruby","checksum":"4cdbe2a4246c19f093fce22e967ec3ebdd4657d37673672e621bf0c7eb770655"},
 {"name":"sync","version":"0.5.0","platform":"ruby","checksum":"668356cc07c59ac7ed9ecf34fec3929831f179c07adb1f3e1c3b7a1609a638fd"},
 {"name":"sys-filesystem","version":"1.4.3","platform":"ruby","checksum":"390919de89822ad6d3ba3daf694d720be9d83ed95cdf7adf54d4573c98b17421"},
 {"name":"sysexits","version":"1.2.0","platform":"ruby","checksum":"598241c4ae57baa403c125182dfdcc0d1ac4c0fb606dd47fbed57e4aaf795662"},
@@ -738,7 +739,7 @@
 {"name":"typhoeus","version":"1.4.0","platform":"ruby","checksum":"fff9880d5dc35950e7706cf132fd297f377c049101794be1cf01c95567f642d4"},
 {"name":"tzinfo","version":"2.0.6","platform":"ruby","checksum":"8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b"},
 {"name":"uber","version":"0.1.0","platform":"ruby","checksum":"5beeb407ff807b5db994f82fa9ee07cfceaa561dad8af20be880bc67eba935dc"},
-{"name":"undercover","version":"0.4.6","platform":"ruby","checksum":"7255959205be7ba492731d4376d89d7cceaed1e675a14ae55c90f71a1621e6ae"},
+{"name":"undercover","version":"0.5.0","platform":"ruby","checksum":"ef99a8478be5466fb13fcd199f659ae308b81f71145a5a4e57428ff67d109fae"},
 {"name":"unf","version":"0.1.4","platform":"java","checksum":"49a5972ec0b3d091d3b0b2e00113f2f342b9b212f0db855eb30a629637f6d302"},
 {"name":"unf","version":"0.1.4","platform":"ruby","checksum":"4999517a531f2a955750f8831941891f6158498ec9b6cb1c81ce89388e63022e"},
 {"name":"unf_ext","version":"0.0.8.2","platform":"ruby","checksum":"90b9623ee359cc4878461c5d2eab7d3d3ce5801a680a9e7ac83b8040c5b742fa"},
@@ -752,7 +753,6 @@
 {"name":"unparser","version":"0.6.7","platform":"ruby","checksum":"ae42e73edfa273766e66c166368fb75ca5972cd8ec50c536253e0f6299a9dec8"},
 {"name":"uri","version":"0.13.0","platform":"ruby","checksum":"26553c2a9399762e1e8bebd4444b4361c4b21298cf1c864b22eeabc9c4998f24"},
 {"name":"valid_email","version":"0.1.3","platform":"ruby","checksum":"b81452b51b64c4beb67913f68db52c20ecb4d73d45512f5b282ab4a3f4416570"},
-{"name":"validate_email","version":"0.1.6","platform":"ruby","checksum":"9dfe9016d527b17a8d3a6e95e4dc50a125400eef899d13d4cc2a254393f82ee4"},
 {"name":"validate_url","version":"1.0.15","platform":"ruby","checksum":"72fe164c0713d63a9970bd6700bea948babbfbdcec392f2342b6704042f57451"},
 {"name":"validates_hostname","version":"1.0.13","platform":"ruby","checksum":"eac40178cc0b4f727df9cc6a5cb5bc2550718ad8d9bb3728df9aba6354bdda19"},
 {"name":"version_gem","version":"1.1.0","platform":"ruby","checksum":"6b009518020db57f51ec7b410213fae2bf692baea9f1b51770db97fbc93d9a80"},
@@ -765,7 +765,7 @@
 {"name":"warden","version":"1.2.9","platform":"ruby","checksum":"46684f885d35a69dbb883deabf85a222c8e427a957804719e143005df7a1efd0"},
 {"name":"warning","version":"1.3.0","platform":"ruby","checksum":"23695a5d8e50bd5c46068931b529bee0b28e4982cbcefbe77d867800dde8069e"},
 {"name":"webauthn","version":"3.0.0","platform":"ruby","checksum":"3f77d422c2a8a4b31e56cf42f83414bd066e0506e9896936e1730262dc4a20e6"},
-{"name":"webfinger","version":"1.2.0","platform":"ruby","checksum":"7814ef1c85da47514f65c6e5ca14205fa9ce41ea2a70785e0c872842162852a2"},
+{"name":"webfinger","version":"2.1.3","platform":"ruby","checksum":"567a52bde77fb38ca6b67e55db755f988766ec4651c1d24916a65aa70540695c"},
 {"name":"webmock","version":"3.23.1","platform":"ruby","checksum":"0fa738c0767d1c4ec8cc57f6b21998f0c238c8a5b32450df1c847f2767140d95"},
 {"name":"webrick","version":"1.8.1","platform":"ruby","checksum":"19411ec6912911fd3df13559110127ea2badd0c035f7762873f58afc803e158f"},
 {"name":"websocket","version":"1.2.10","platform":"ruby","checksum":"2cc1a4a79b6e63637b326b4273e46adcddf7871caa5dc5711f2ca4061a629fa8"},
diff --git a/Gemfile.next.lock b/Gemfile.next.lock
index a686460eb4763..817d4d5806e2d 100644
--- a/Gemfile.next.lock
+++ b/Gemfile.next.lock
@@ -2,7 +2,7 @@ PATH
   remote: gems/activerecord-gitlab
   specs:
     activerecord-gitlab (0.2.0)
-      activerecord (< 7.2)
+      activerecord (>= 7)
 
 PATH
   remote: gems/click_house-client
@@ -321,26 +321,26 @@ GEM
       io-event (~> 1.6, >= 1.6.5)
     atlassian-jwt (0.2.1)
       jwt (~> 2.1)
-    attr_required (1.0.1)
+    attr_required (1.0.2)
     awesome_print (1.9.2)
     awrence (1.2.1)
     aws-eventstream (1.3.0)
-    aws-partitions (1.877.0)
+    aws-partitions (1.960.0)
     aws-sdk-cloudformation (1.41.0)
       aws-sdk-core (~> 3, >= 3.99.0)
       aws-sigv4 (~> 1.1)
-    aws-sdk-core (3.200.0)
+    aws-sdk-core (3.201.3)
       aws-eventstream (~> 1, >= 1.3.0)
       aws-partitions (~> 1, >= 1.651.0)
       aws-sigv4 (~> 1.8)
       jmespath (~> 1, >= 1.6.1)
-    aws-sdk-kms (1.76.0)
-      aws-sdk-core (~> 3, >= 3.188.0)
-      aws-sigv4 (~> 1.1)
-    aws-sdk-s3 (1.155.0)
-      aws-sdk-core (~> 3, >= 3.199.0)
+    aws-sdk-kms (1.88.0)
+      aws-sdk-core (~> 3, >= 3.201.0)
+      aws-sigv4 (~> 1.5)
+    aws-sdk-s3 (1.156.0)
+      aws-sdk-core (~> 3, >= 3.201.0)
       aws-sdk-kms (~> 1)
-      aws-sigv4 (~> 1.8)
+      aws-sigv4 (~> 1.5)
     aws-sigv4 (1.8.0)
       aws-eventstream (~> 1, >= 1.0.2)
     axe-core-api (4.9.1)
@@ -451,7 +451,7 @@ GEM
       git
     css_parser (1.14.0)
       addressable
-    cssbundling-rails (1.4.0)
+    cssbundling-rails (1.4.1)
       railties (>= 6.0.0)
     cvss-suite (3.0.1)
     danger (9.4.2)
@@ -568,6 +568,8 @@ GEM
       htmlentities (~> 4.3.3)
       launchy (~> 2.1)
       mail (~> 2.7)
+    email_validator (2.2.4)
+      activemodel
     encryptor (3.0.0)
     erubi (1.12.0)
     escape_utils (1.3.0)
@@ -1005,11 +1007,13 @@ GEM
       regexp_parser (~> 2.5)
       regexp_property_values (~> 1.0)
     json (2.7.2)
-    json-jwt (1.15.3)
+    json-jwt (1.16.6)
       activesupport (>= 4.2)
       aes_key_wrap
+      base64
       bindata
-      httpclient
+      faraday (~> 2.0)
+      faraday-follow_redirects
     json_schemer (2.3.0)
       bigdecimal
       hana (~> 1.3)
@@ -1034,7 +1038,7 @@ GEM
       activerecord
       kaminari-core (= 1.2.2)
     kaminari-core (1.2.2)
-    kas-grpc (0.5.0)
+    kas-grpc (0.6.0)
       grpc (~> 1.0)
     knapsack (4.0.0)
       rake
@@ -1232,20 +1236,23 @@ GEM
       ruby-saml (~> 1.12)
     omniauth-shibboleth-redux (2.0.0)
       omniauth (>= 2.0.0)
-    omniauth_openid_connect (0.6.1)
+    omniauth_openid_connect (0.8.0)
       omniauth (>= 1.9, < 3)
-      openid_connect (~> 1.1)
+      openid_connect (~> 2.2)
     open4 (1.3.4)
-    openid_connect (1.3.0)
+    openid_connect (2.3.0)
       activemodel
       attr_required (>= 1.0.0)
-      json-jwt (>= 1.5.0)
-      rack-oauth2 (>= 1.6.1)
-      swd (>= 1.0.0)
+      email_validator
+      faraday (~> 2.0)
+      faraday-follow_redirects
+      json-jwt (>= 1.16)
+      mail
+      rack-oauth2 (~> 2.2)
+      swd (~> 2.0)
       tzinfo
-      validate_email
       validate_url
-      webfinger (>= 1.0.1)
+      webfinger (~> 2.0)
     openssl (3.1.0)
     openssl-signature_algorithm (1.3.0)
       openssl (> 2.0)
@@ -1439,10 +1446,11 @@ GEM
       rack (>= 1.0, < 4)
     rack-cors (2.0.2)
       rack (>= 2.0.0)
-    rack-oauth2 (1.21.3)
+    rack-oauth2 (2.2.1)
       activesupport
       attr_required
-      httpclient
+      faraday (~> 2.0)
+      faraday-follow_redirects
       json-jwt (>= 1.11.0)
       rack (>= 2.1.0)
     rack-protection (2.2.2)
@@ -1782,10 +1790,11 @@ GEM
       unicode_utils (~> 1.4)
     strings-ansi (0.2.0)
     strscan (3.1.0)
-    swd (1.3.0)
+    swd (2.0.3)
       activesupport (>= 3)
       attr_required (>= 0.0.5)
-      httpclient (>= 2.4)
+      faraday (~> 2.0)
+      faraday-follow_redirects
     sync (0.5.0)
     sys-filesystem (1.4.3)
       ffi (~> 1.1)
@@ -1857,10 +1866,11 @@ GEM
     tzinfo (2.0.6)
       concurrent-ruby (~> 1.0)
     uber (0.1.0)
-    undercover (0.4.6)
+    undercover (0.5.0)
+      bigdecimal
       imagen (>= 0.1.8)
       rainbow (>= 2.1, < 4.0)
-      rugged (>= 0.27, < 1.7)
+      rugged (>= 0.27, < 1.8)
     unf (0.1.4)
       unf_ext
     unf_ext (0.0.8.2)
@@ -1876,9 +1886,6 @@ GEM
     valid_email (0.1.3)
       activemodel
       mail (>= 2.6.1)
-    validate_email (0.1.6)
-      activemodel (>= 3.0)
-      mail (>= 2.2.5)
     validate_url (1.0.15)
       activemodel (>= 3.0.0)
       public_suffix
@@ -1915,9 +1922,10 @@ GEM
       openssl (>= 2.2)
       safety_net_attestation (~> 0.4.0)
       tpm-key_attestation (~> 0.12.0)
-    webfinger (1.2.0)
+    webfinger (2.1.3)
       activesupport
-      httpclient (>= 2.4)
+      faraday (~> 2.0)
+      faraday-follow_redirects
     webmock (3.23.1)
       addressable (>= 2.8.0)
       crack (>= 0.3.2)
@@ -1966,8 +1974,8 @@ DEPENDENCIES
   attr_encrypted (~> 3.2.4)!
   awesome_print
   aws-sdk-cloudformation (~> 1)
-  aws-sdk-core (~> 3.200.0)
-  aws-sdk-s3 (~> 1.155.0)
+  aws-sdk-core (~> 3.201.0)
+  aws-sdk-s3 (~> 1.156.0)
   axe-core-rspec (~> 4.9.0)
   babosa (~> 2.0)
   base32 (~> 0.3.0)
@@ -1994,7 +2002,7 @@ DEPENDENCIES
   coverband (= 6.1.2)
   creole (~> 0.5.0)
   crystalball (~> 0.7.0)
-  cssbundling-rails (= 1.4.0)
+  cssbundling-rails (= 1.4.1)
   csv_builder!
   cvss-suite (~> 3.0.1)
   database_cleaner-active_record (~> 2.2.0)
@@ -2121,7 +2129,7 @@ DEPENDENCIES
   jsonb_accessor (~> 1.3.10)
   jwt (~> 2.5)
   kaminari (~> 1.2.2)
-  kas-grpc (~> 0.5.0)
+  kas-grpc (~> 0.6.0)
   knapsack (~> 4.0.0)
   kramdown (~> 2.3.1)
   kubeclient (~> 4.11.0)
@@ -2168,9 +2176,9 @@ DEPENDENCIES
   omniauth-saml (~> 2.1.0)
   omniauth-shibboleth-redux (~> 2.0)
   omniauth_crowd (~> 2.4.0)!
-  omniauth_openid_connect (~> 0.6.1)
+  omniauth_openid_connect (~> 0.8.0)
   openbao_client!
-  openid_connect (= 1.3.0)
+  openid_connect (~> 2.3.0)
   openssl (~> 3.0)
   opentelemetry-exporter-otlp
   opentelemetry-instrumentation-action_pack
@@ -2214,7 +2222,7 @@ DEPENDENCIES
   rack (~> 2.2.9)
   rack-attack (~> 6.7.0)
   rack-cors (~> 2.0.1)
-  rack-oauth2 (~> 1.21.3)
+  rack-oauth2 (~> 2.2.1)
   rack-proxy (~> 0.7.7)
   rack-timeout (~> 0.7.0)
   rails (~> 7.1.3.4)
@@ -2292,7 +2300,7 @@ DEPENDENCIES
   truncato (~> 0.7.12)
   tty-prompt (~> 0.23)
   typhoeus (~> 1.4.0)
-  undercover (~> 0.4.4)
+  undercover (~> 0.5.0)
   unleash (~> 3.2.2)
   valid_email (~> 0.1)
   validates_hostname (~> 1.0.13)
diff --git a/gems/activerecord-gitlab/.gitlab-ci.yml b/gems/activerecord-gitlab/.gitlab-ci.yml
index eb94904ce90fe..9797e87de1ef3 100644
--- a/gems/activerecord-gitlab/.gitlab-ci.yml
+++ b/gems/activerecord-gitlab/.gitlab-ci.yml
@@ -2,3 +2,4 @@ include:
   - local: gems/gem.gitlab-ci.yml
     inputs:
       gem_name: "activerecord-gitlab"
+      bundle_gemfiles: ['Gemfile', 'Gemfile.next']
diff --git a/gems/activerecord-gitlab/Gemfile b/gems/activerecord-gitlab/Gemfile
index be173b205f701..6fa23eafde9de 100644
--- a/gems/activerecord-gitlab/Gemfile
+++ b/gems/activerecord-gitlab/Gemfile
@@ -3,3 +3,5 @@
 source "https://rubygems.org"
 
 gemspec
+
+gem 'activerecord', '~> 7.0.8' # rubocop:disable Gemfile/MissingFeatureCategory
diff --git a/gems/activerecord-gitlab/Gemfile.lock b/gems/activerecord-gitlab/Gemfile.lock
index ba0118eb8e397..9ee91e06a0b4f 100644
--- a/gems/activerecord-gitlab/Gemfile.lock
+++ b/gems/activerecord-gitlab/Gemfile.lock
@@ -7,12 +7,12 @@ PATH
 GEM
   remote: https://rubygems.org/
   specs:
-    activemodel (7.0.6)
-      activesupport (= 7.0.6)
-    activerecord (7.0.6)
-      activemodel (= 7.0.6)
-      activesupport (= 7.0.6)
-    activesupport (7.0.6)
+    activemodel (7.0.8.4)
+      activesupport (= 7.0.8.4)
+    activerecord (7.0.8.4)
+      activemodel (= 7.0.8.4)
+      activesupport (= 7.0.8.4)
+    activesupport (7.0.8.4)
       concurrent-ruby (~> 1.0, >= 1.0.2)
       i18n (>= 1.6, < 2)
       minitest (>= 5.1)
@@ -93,6 +93,7 @@ PLATFORMS
   ruby
 
 DEPENDENCIES
+  activerecord (~> 7.0.8)
   activerecord-gitlab!
   gitlab-styles (~> 10.1.0)
   rspec (~> 3.12)
diff --git a/gems/activerecord-gitlab/Gemfile.next b/gems/activerecord-gitlab/Gemfile.next
new file mode 100644
index 0000000000000..eca22b2641303
--- /dev/null
+++ b/gems/activerecord-gitlab/Gemfile.next
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+gemspec
+
+gem 'activerecord', '~> 7.1' # rubocop:disable Gemfile/MissingFeatureCategory
diff --git a/gems/activerecord-gitlab/Gemfile.next.lock b/gems/activerecord-gitlab/Gemfile.next.lock
new file mode 100644
index 0000000000000..16ebd85ec1c76
--- /dev/null
+++ b/gems/activerecord-gitlab/Gemfile.next.lock
@@ -0,0 +1,131 @@
+PATH
+  remote: .
+  specs:
+    activerecord-gitlab (0.2.0)
+      activerecord (>= 7)
+
+GEM
+  remote: https://rubygems.org/
+  specs:
+    activemodel (7.1.3.4)
+      activesupport (= 7.1.3.4)
+    activerecord (7.1.3.4)
+      activemodel (= 7.1.3.4)
+      activesupport (= 7.1.3.4)
+      timeout (>= 0.4.0)
+    activesupport (7.1.3.4)
+      base64
+      bigdecimal
+      concurrent-ruby (~> 1.0, >= 1.0.2)
+      connection_pool (>= 2.2.5)
+      drb
+      i18n (>= 1.6, < 2)
+      minitest (>= 5.1)
+      mutex_m
+      tzinfo (~> 2.0)
+    ast (2.4.2)
+    base64 (0.2.0)
+    bigdecimal (3.1.8)
+    concurrent-ruby (1.3.3)
+    connection_pool (2.4.1)
+    diff-lcs (1.5.1)
+    drb (2.2.1)
+    gitlab-styles (10.1.0)
+      rubocop (~> 1.50.2)
+      rubocop-graphql (~> 0.18)
+      rubocop-performance (~> 1.15)
+      rubocop-rails (~> 2.17)
+      rubocop-rspec (~> 2.22)
+    i18n (1.14.5)
+      concurrent-ruby (~> 1.0)
+    json (2.7.2)
+    minitest (5.24.1)
+    mutex_m (0.2.0)
+    parallel (1.25.1)
+    parser (3.3.4.0)
+      ast (~> 2.4.1)
+      racc
+    racc (1.8.1)
+    rack (3.1.7)
+    rainbow (3.1.1)
+    regexp_parser (2.9.2)
+    rexml (3.3.4)
+      strscan
+    rspec (3.13.0)
+      rspec-core (~> 3.13.0)
+      rspec-expectations (~> 3.13.0)
+      rspec-mocks (~> 3.13.0)
+    rspec-core (3.13.0)
+      rspec-support (~> 3.13.0)
+    rspec-expectations (3.13.1)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.13.0)
+    rspec-mocks (3.13.1)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.13.0)
+    rspec-support (3.13.1)
+    rubocop (1.50.2)
+      json (~> 2.3)
+      parallel (~> 1.10)
+      parser (>= 3.2.0.0)
+      rainbow (>= 2.2.2, < 4.0)
+      regexp_parser (>= 1.8, < 3.0)
+      rexml (>= 3.2.5, < 4.0)
+      rubocop-ast (>= 1.28.0, < 2.0)
+      ruby-progressbar (~> 1.7)
+      unicode-display_width (>= 2.4.0, < 3.0)
+    rubocop-ast (1.31.3)
+      parser (>= 3.3.1.0)
+    rubocop-capybara (2.21.0)
+      rubocop (~> 1.41)
+    rubocop-factory_bot (2.26.0)
+      rubocop (~> 1.41)
+    rubocop-graphql (0.19.0)
+      rubocop (>= 0.87, < 2)
+    rubocop-performance (1.21.1)
+      rubocop (>= 1.48.1, < 2.0)
+      rubocop-ast (>= 1.31.1, < 2.0)
+    rubocop-rails (2.25.1)
+      activesupport (>= 4.2.0)
+      rack (>= 1.1)
+      rubocop (>= 1.33.0, < 2.0)
+      rubocop-ast (>= 1.31.1, < 2.0)
+    rubocop-rspec (2.31.0)
+      rubocop (~> 1.40)
+      rubocop-capybara (~> 2.17)
+      rubocop-factory_bot (~> 2.22)
+      rubocop-rspec_rails (~> 2.28)
+    rubocop-rspec_rails (2.29.0)
+      rubocop (~> 1.40)
+    ruby-progressbar (1.13.0)
+    sqlite3 (1.7.3-aarch64-linux)
+    sqlite3 (1.7.3-arm-linux)
+    sqlite3 (1.7.3-arm64-darwin)
+    sqlite3 (1.7.3-x86-linux)
+    sqlite3 (1.7.3-x86_64-darwin)
+    sqlite3 (1.7.3-x86_64-linux)
+    strscan (3.1.0)
+    timeout (0.4.1)
+    tzinfo (2.0.6)
+      concurrent-ruby (~> 1.0)
+    unicode-display_width (2.5.0)
+
+PLATFORMS
+  aarch64-linux
+  arm-linux
+  arm64-darwin
+  x86-linux
+  x86_64-darwin
+  x86_64-linux
+
+DEPENDENCIES
+  activerecord (~> 7.1)
+  activerecord-gitlab!
+  gitlab-styles (~> 10.1.0)
+  rspec (~> 3.12)
+  rubocop (~> 1.50)
+  rubocop-rspec (~> 2.22)
+  sqlite3 (~> 1.6)
+
+BUNDLED WITH
+   2.5.11
diff --git a/gems/activerecord-gitlab/lib/active_record/gitlab_patches/partitioning/base.rb b/gems/activerecord-gitlab/lib/active_record/gitlab_patches/partitioning/base.rb
index d9b0326e0575e..fcc195dabe49d 100644
--- a/gems/activerecord-gitlab/lib/active_record/gitlab_patches/partitioning/base.rb
+++ b/gems/activerecord-gitlab/lib/active_record/gitlab_patches/partitioning/base.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-if ::ActiveRecord::VERSION::STRING >= "7.1"
+if ::ActiveRecord::VERSION::STRING >= "7.2"
   raise 'New version of active-record detected, please remove or update this patch'
 end
 
@@ -9,12 +9,14 @@ module ActiveRecord
   module GitlabPatches
     module Partitioning
       module Base
-        def _query_constraints_hash
-          if self.class.query_constraints_list.nil?
-            { @primary_key => id_in_database }
-          else
-            self.class.query_constraints_list.index_with do |column_name|
-              attribute_in_database(column_name)
+        if ::ActiveRecord::VERSION::STRING <= "7.1"
+          def _query_constraints_hash
+            if self.class.query_constraints_list.nil?
+              { @primary_key => id_in_database }
+            else
+              self.class.query_constraints_list.index_with do |column_name|
+                attribute_in_database(column_name)
+              end
             end
           end
         end
@@ -26,12 +28,14 @@ def query_constraints(*columns_list)
             @query_constraints_list = columns_list.map(&:to_s)
           end
 
-          def query_constraints_list # :nodoc:
-            @query_constraints_list ||= if base_class? || primary_key != base_class.primary_key
-                                          primary_key if primary_key.is_a?(Array)
-                                        else
-                                          base_class.query_constraints_list
-                                        end
+          if ::ActiveRecord::VERSION::STRING <= "7.1"
+            def query_constraints_list # :nodoc:
+              @query_constraints_list ||= if base_class? || primary_key != base_class.primary_key
+                                            primary_key if primary_key.is_a?(Array)
+                                          else
+                                            base_class.query_constraints_list
+                                          end
+            end
           end
         end
       end
diff --git a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/belongs_to_spec.rb b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/belongs_to_spec.rb
index 900a270c0a810..4b73ba42b1bc4 100644
--- a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/belongs_to_spec.rb
+++ b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/belongs_to_spec.rb
@@ -33,7 +33,7 @@
 
     result = QueryRecorder.log do
       job.build_pipeline.save!
-    end
+    end.join
 
     expect(result).to include(create_statement)
   end
@@ -45,7 +45,7 @@
 
     result = QueryRecorder.log do
       job.create_pipeline!
-    end
+    end.join
 
     expect(result).to include(create_statement)
   end
diff --git a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/has_many_spec.rb b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/has_many_spec.rb
index 3d6b24de998d9..1c37d61b75f59 100644
--- a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/has_many_spec.rb
+++ b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/has_many_spec.rb
@@ -52,7 +52,7 @@
     result = QueryRecorder.log do
       build = pipeline.jobs.new(name: 'test job')
       build.save!
-    end
+    end.join
 
     expect(result).to include(create_statement)
   end
@@ -65,7 +65,7 @@
 
     result = QueryRecorder.log do
       pipeline.jobs.create!(name: 'test job')
-    end
+    end.join
 
     expect(result).to include(create_statement)
   end
diff --git a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/has_one_spec.rb b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/has_one_spec.rb
index aeb565c6dad22..b9f8f3549ec85 100644
--- a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/has_one_spec.rb
+++ b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/associations/has_one_spec.rb
@@ -34,7 +34,7 @@
 
     result = QueryRecorder.log do
       job.build_metadata.save!
-    end
+    end.join
 
     expect(result).to include(create_statement)
   end
@@ -46,7 +46,7 @@
 
     result = QueryRecorder.log do
       job.create_metadata
-    end
+    end.join
 
     expect(result).to include(create_statement)
   end
@@ -92,7 +92,7 @@
 
     result = QueryRecorder.log do
       job.save!
-    end
+    end.join
 
     update_statements.each do |statement|
       expect(result).to include(statement)
diff --git a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/single_model_queries_spec.rb b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/single_model_queries_spec.rb
index b035d7a627767..da3fc48d81c6f 100644
--- a/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/single_model_queries_spec.rb
+++ b/gems/activerecord-gitlab/spec/active_record/gitlab_patches/partitioning/single_model_queries_spec.rb
@@ -13,7 +13,7 @@
 
     result = QueryRecorder.log do
       Job.create!(pipeline_id: pipeline.id, partition_id: pipeline.partition_id)
-    end
+    end.join
 
     expect(result).to include(create_statement)
   end
diff --git a/gems/gem.gitlab-ci.yml b/gems/gem.gitlab-ci.yml
index d2791c62c2c68..eb987b8e62707 100644
--- a/gems/gem.gitlab-ci.yml
+++ b/gems/gem.gitlab-ci.yml
@@ -8,6 +8,9 @@
 spec:
   inputs:
     gem_name:
+    bundle_gemfiles:
+      type: array
+      default: ['Gemfile']
     gem_path_prefix:
       default: "gems/"
     skip_gem_validation:
@@ -54,6 +57,12 @@ default:
     matrix:
       - RUBY_VERSION: ["${RUBY_VERSION_DEFAULT}", "${RUBY_VERSION_NEXT}"]
 
+.ruby_on_rails_matrix:
+  parallel:
+    matrix:
+      - RUBY_VERSION: ["${RUBY_VERSION_DEFAULT}", "${RUBY_VERSION_NEXT}"]
+      - BUNDLE_GEMFILE: $[[inputs.bundle_gemfiles]]
+
 validate-gem:
   rules:
     - if: "'$[[inputs.skip_gem_validation]]' == 'true'"
@@ -71,7 +80,7 @@ rubocop:
     - bundle exec rubocop
 
 rspec:
-  extends: .ruby_matrix
+  extends: .ruby_on_rails_matrix
   script:
     - RAILS_ENV=test bundle exec rspec
   coverage: '/LOC \((\d+\.\d+%)\) covered.$/'
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb
index 9ab5f93f5bcc3..726824497dc27 100644
--- a/spec/lib/gitlab_spec.rb
+++ b/spec/lib/gitlab_spec.rb
@@ -383,6 +383,8 @@
 
   describe '.next_rails?' do
     around do |example|
+      described_class.instance_variable_set(:@next_bundle_gemfile, nil)
+
       example.run
     ensure
       described_class.instance_variable_set(:@next_bundle_gemfile, nil)
-- 
GitLab