Skip to content

fix(deps): add multi_json dependency to 8 legacy REST gems - #27547

Merged
torreypayne merged 1 commit into
mainfrom
fix/modernize-legacy-core-constraints
Aug 3, 2026
Merged

fix(deps): add multi_json dependency to 8 legacy REST gems#27547
torreypayne merged 1 commit into
mainfrom
fix/modernize-legacy-core-constraints

Conversation

@torreypayne

@torreypayne torreypayne commented Aug 3, 2026

Copy link
Copy Markdown
Member

Description

In 8 older, unregenerated REST client libraries (cloudshell_v1alpha1, appengine_v1beta4, appengine_v1beta5, youtube_partner_v1, youtube_analytics_v1, genomics_v1, genomics_v1alpha2, analyticsdata_v1alpha), the runtime constraint for google-apis-core is set to ~> 0.1 (>= 0.1.0, < 1.0.0).

This PR fixes a dormant CI load error in these 8 gems by explicitly adding gem.add_runtime_dependency "multi_json", "~> 1.0" to their .gemspec files while preserving the original google-apis-core ~> 0.1 constraint (no 1.x major version bump).

See workflow run for an example of the CI error.


💥 Reproducible Error Sample (Without This Fix)

When running tests (bundle install && toys _nested spec or require "google/apis/cloudshell_v1alpha1") in any of these 8 legacy directories without multi_json in the bundle, RSpec/Bundler crashes with the following error:

  1) Google::Apis::CloudshellV1alpha1 should load
     Failure/Error:
       expect do
         require "google/apis/cloudshell_v1alpha1"
       end.not_to raise_error
     
       expected no Exception, got #<Gem::LoadError: multi_json is not part of the bundle. Add it to your Gemfile.> with backtrace:
         # /usr/local/google/home/torreypayne/.gem/ruby/3.2.0/gems/representable-3.2.0/lib/representable/json.rb:1:in `<top (required)>\'
         # /usr/local/google/home/torreypayne/.gem/ruby/3.2.0/gems/google-apis-core-0.18.0/lib/google/apis/core/json_representation.rb:15:in `<top (required)>\'
         # ./lib/google/apis/cloudshell_v1alpha1/service.rb:16:in `<top (required)>\'
         # ./lib/google/apis/cloudshell_v1alpha1.rb:15:in `<top (required)>\'
         # ./spec/generated_spec.rb:21:in `block (3 levels) in <top (required)>\'
         # ./spec/generated_spec.rb:20:in `block (2 levels) in <top (required)>\'

🔍 Why This Error Occurs

  1. Why google-apis-core-0.18.0 is loaded:
    The legacy library specifies gem.add_runtime_dependency "google-apis-core", "~> 0.1", which restricts google-apis-core to the 0.x major version series (resolving 0.18.0).
  2. Why representable-3.2.0 is loaded:
    google-apis-core (0.18.0) requires representable (~> 3.0), which resolves the latest 3.x version (representable 3.2.0).
  3. Why it crashes (multi_json is not part of the bundle):
    representable 3.2.0 calls require "multi_json". However, because google-apis-core 0.18.0 predates PR #26612 (which added an explicit runtime dependency on multi_json to google-apis-core 1.2.1+), neither google-apis-core (0.18.0) nor representable (3.2.0) declares a gem dependency on multi_json.
    When Bundler loads the gem (require "bundler/setup"), it blocks unlisted gems, raising Gem::LoadError: multi_json is not part of the bundle.

🛠️ Why This Fix Is Minimal & Safe

  • Zero Major Version Bump: Instead of bumping google-apis-core to 1.x (>= 0.15.0, < 2.a), we preserve ~> 0.1 so downstream consumers experience no major version bump.
  • Targeted Fix: We simply add gem.add_runtime_dependency "multi_json", "~> 1.0" directly to the 8 legacy .gemspec files, ensuring multi_json is present in the bundle when representable 3.2.0 loads.

@torreypayne
torreypayne force-pushed the fix/modernize-legacy-core-constraints branch from bda7bf6 to 2f8c801 Compare August 3, 2026 16:56
@torreypayne torreypayne changed the title fix(deps): fix multi_json CI load error in 8 unregenerated REST gems fix(deps): add multi_json dependency to 8 legacy REST gems Aug 3, 2026
…g core ~> 0.1)

In 8 older, unregenerated REST client gems (`cloudshell_v1alpha1`,
`appengine_v1beta4`, `appengine_v1beta5`, `youtube_partner_v1`,
`youtube_analytics_v1`, `genomics_v1`, `genomics_v1alpha2`,
`analyticsdata_v1alpha`), the runtime constraint for google-apis-core is
`~> 0.1` (`>= 0.1.0, < 1.0.0`).

To avoid a major version bump to 1.X during lockfile seeding while fixing
the dormant CI test failure (`Gem::LoadError: multi_json is not part of the
bundle`), this PR preserves the original `google-apis-core ~> 0.1` constraint
and adds `gem.add_runtime_dependency "multi_json", "~> 1.0"` directly to
the 8 `.gemspec` files.
@torreypayne
torreypayne force-pushed the fix/modernize-legacy-core-constraints branch from 2f8c801 to e1e13d3 Compare August 3, 2026 17:08
@torreypayne
torreypayne marked this pull request as ready for review August 3, 2026 17:14
@torreypayne
torreypayne requested review from a team and yoshi-approver as code owners August 3, 2026 17:14
@torreypayne
torreypayne merged commit 29a2882 into main Aug 3, 2026
15 checks passed
@torreypayne
torreypayne deleted the fix/modernize-legacy-core-constraints branch August 3, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants