Skip to content

chore(deps): seed Gemfile.lock for reproducible builds - #408

Merged
olavloite merged 4 commits into
mainfrom
chore/seed-lockfiles
Aug 4, 2026
Merged

chore(deps): seed Gemfile.lock for reproducible builds#408
olavloite merged 4 commits into
mainfrom
chore/seed-lockfiles

Conversation

@torreypayne

@torreypayne torreypayne commented Jul 31, 2026

Copy link
Copy Markdown
Member

Removes Gemfile.lock from .gitignore files and checks in initial lockfiles generated under Ruby 3.2.11 to ensure reproducible dependency resolution across CI test matrices.

This is a continuation of the effort to address b/509981628

closes: b/509981628

Removes Gemfile.lock from .gitignore files and checks in initial lockfiles
generated under Ruby 3.2.11 to ensure reproducible dependency resolution
across CI test matrices.
@torreypayne
torreypayne requested review from a team, olavloite and sakthivelmanii as code owners July 31, 2026 20:35
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the googleapis/ruby-spanner-activerecord API. label Jul 31, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request removes Gemfile.lock from .gitignore and adds a new lockfile to the repository. Feedback on these changes highlights potential issues with dependency resolution in CI. Specifically, locking activerecord to a single version conflicts with CI matrix legs testing other ActiveRecord versions, which could be resolved using a tool like Appraisal. Additionally, the platform-specific definitions for google-protobuf in the lockfile conflict with the force_ruby_platform: true setting used in CI, potentially causing Bundler to fail in frozen mode.

Comment thread Gemfile.lock
Comment thread Gemfile.lock

@olavloite olavloite left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Security Violation: PR contains modifications to disallowed files: .gitignore. Automated updates are strictly limited to dependency/configuration files.

@quartzmo

Copy link
Copy Markdown
Member

@olavloite This PR is a manual change to .gitignore in order to bring Gemfile.lock under version control. See b/509981628 for background.

@torreypayne

Copy link
Copy Markdown
Member Author

@olavloite pinged you over chat to align, cc @quartzmo @aandreassa

@olavloite

Copy link
Copy Markdown
Collaborator

Security Violation: PR contains modifications to disallowed files: .gitignore. Automated updates are strictly limited to dependency/configuration files.

Note: This was an automated response. This PR was incorrectly categorized as an automated dependency update.

@olavloite
olavloite force-pushed the chore/seed-lockfiles branch from 8c09b5b to 63913e0 Compare August 3, 2026 18:41

@olavloite olavloite left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Security Violation: PR contains modifications to disallowed files: .github/workflows/acceptance-tests-on-emulator.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/ci.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/nightly-acceptance-tests-on-emulator.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/nightly-unit-tests.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/samples.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0"]), .gitignore, .rubocop.yml, Appraisals, gemfiles/7.0.gemfile, gemfiles/7.0.gemfile.lock, gemfiles/7.1.gemfile, gemfiles/7.1.gemfile.lock, gemfiles/7.2.gemfile, gemfiles/7.2.gemfile.lock, gemfiles/8.0.gemfile, gemfiles/8.0.gemfile.lock, gemfiles/8.1.gemfile, gemfiles/8.1.gemfile.lock. Automated updates are strictly limited to dependency/configuration files.

…ing back to Base.connection

In ActiveRecord 7.0.x, ActiveRecord::QueryLogs does not pass the :connection
key inside the context hash (which was added in ActiveRecord 7.1.0). When running
the query-logs snippet against ActiveRecord 7.0.x, calling context[:connection].pool
crashed with NoMethodError (undefined method `pool' for nil:NilClass).

This commit adds a fallback to `ActiveRecord::Base.connection` when
`context[:connection]` is nil, restoring full compatibility across ActiveRecord
7.0, 7.1, 7.2, 8.0, and 8.1.

@olavloite olavloite left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Security Violation: PR contains modifications to disallowed files: .github/workflows/acceptance-tests-on-emulator.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/ci.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/nightly-acceptance-tests-on-emulator.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/nightly-unit-tests.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/samples.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0"]), .gitignore, .rubocop.yml, Appraisals, examples/snippets/query-logs/application.rb, gemfiles/7.0.gemfile, gemfiles/7.0.gemfile.lock, gemfiles/7.1.gemfile, gemfiles/7.1.gemfile.lock, gemfiles/7.2.gemfile, gemfiles/7.2.gemfile.lock, gemfiles/8.0.gemfile, gemfiles/8.0.gemfile.lock, gemfiles/8.1.gemfile, gemfiles/8.1.gemfile.lock. Automated updates are strictly limited to dependency/configuration files.

…iltering

In commit 63913e0 (deps: add appraisal), .github/workflows/samples.yaml was
updated to use BUNDLE_GEMFILE for matrix appraisal gemfiles, but AR_VERSION was
removed from the workflow environment.

Without AR_VERSION in the environment, ENV.fetch("AR_VERSION", "~> 7.1.0") in
examples/snippets/Rakefile defaulted to "~> 7.1.0". As a result, less_than_7_1
evaluated to false even when testing ActiveRecord 7.0.x (gemfiles/7.0.gemfile),
causing rake all to run ActiveRecord 7.1+ snippets (auto-generated-primary-key,
bit-reversed-sequence, interleaved-tables) on 7.0 and fail with:
ArgumentError: Unknown migration version "7.1".

This commit replaces the ENV["AR_VERSION"] check with a direct inspection of
the loaded ActiveRecord.version (< Gem::Version.new("7.1.0")), ensuring sample
filtering is always deterministic regardless of environment variables.

@olavloite olavloite left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Security Violation: PR contains modifications to disallowed files: .github/workflows/acceptance-tests-on-emulator.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/ci.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/nightly-acceptance-tests-on-emulator.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/nightly-unit-tests.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0", "8.1"]), .github/workflows/samples.yaml (Disallowed line addition in workflow: + ar: ["7.0", "7.1", "7.2", "8.0"]), .gitignore, .rubocop.yml, Appraisals, examples/snippets/Rakefile, examples/snippets/query-logs/application.rb, gemfiles/7.0.gemfile, gemfiles/7.0.gemfile.lock, gemfiles/7.1.gemfile, gemfiles/7.1.gemfile.lock, gemfiles/7.2.gemfile, gemfiles/7.2.gemfile.lock, gemfiles/8.0.gemfile, gemfiles/8.0.gemfile.lock, gemfiles/8.1.gemfile, gemfiles/8.1.gemfile.lock. Automated updates are strictly limited to dependency/configuration files.

@aandreassa

Copy link
Copy Markdown
Contributor

@torreypayne please look into minimizing the diff here. It looks like there are a bunch of functional changes when it shouldn't be

@olavloite

Copy link
Copy Markdown
Collaborator

@torreypayne please look into minimizing the diff here. It looks like there are a bunch of functional changes when it shouldn't be

They are not directly functional changes. None of the production code that is shipped to users is modified.

This library supports multiple versions of ActiveRecord. If we want our CI build to execute against a reproducible set of dependencies, then we need to set that up for every ActiveRecord version that we want to support, and generate gemfiles and lock files for those, and also update the test scripts that execute the tests.

In addition, this change surfaced a bug in one of the samples in the repository. This bug is also fixed as part of this pull request.

@olavloite
olavloite merged commit 83067f9 into main Aug 4, 2026
53 checks passed
@olavloite
olavloite deleted the chore/seed-lockfiles branch August 4, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/ruby-spanner-activerecord API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants