Skip to content

Key React Native gem cache by Ruby interpreter - #533

Merged
kiftio merged 1 commit into
mainfrom
07-29-key_react_native_gem_cache_by_ruby_interpreter
Jul 29, 2026
Merged

Key React Native gem cache by Ruby interpreter#533
kiftio merged 1 commit into
mainfrom
07-29-key_react_native_gem_cache_by_ruby_interpreter

Conversation

@kiftio

@kiftio kiftio commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

River thread -> https://shopify.slack.com/archives/C0ANGTU8ZV0/p1785316055543009

Fixes a flaky CI failure on Bitrise where native Ruby gems (e.g. bigdecimal, ffi) compiled against one Ruby interpreter fail to load after a stack image refresh serves a different interpreter path, even when the Ruby version string is unchanged.

The root cause is that Bitrise stacks serve Ruby out of the nix store, and the absolute interpreter path baked into compiled .bundle/.so files changes whenever the stack image is refreshed. The previous gem cache key did not account for this, so a bundle compiled against the old Ruby could be restored onto the new one, causing every native gem to fail to dlopen and taking down pod install before it did any work.

Two fixes are applied together:

  • Cache key now includes the Ruby interpreter path. A new script step runs before restore-cache and writes the Ruby prefix, version, and platform to .ruby-cache-fingerprint. This file is included in the cache key so that a cache miss is forced whenever the interpreter changes, not just when the version string or Gemfile.lock changes.
  • Poisoned cache self-heals. After a cache restore, the bundle is validated by attempting to require "bigdecimal". If it fails, vendor/bundle is deleted and bundle install runs from scratch, so a stale cache entry costs one slow build rather than a red run.

.ruby-cache-fingerprint is added to .gitignore since it is a generated file produced by the CI step.

How to test

Trigger a Bitrise build after a stack image refresh and confirm that pod install completes successfully without native gem dlopen errors. Verify the gem cache key changes when the Ruby interpreter path changes but remains stable across builds on the same stack image.


Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Embedded Checkout Protocol version?
  • I have bumped embeddedCheckoutProtocolAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated protocol/languages/kotlin/embedded-checkout-protocol/api/embedded-checkout-protocol.api if the public API changed
Releasing a new Android version?
  • I have bumped checkoutKitAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

@kiftio
kiftio marked this pull request as ready for review July 29, 2026 09:32
@kiftio
kiftio requested a review from a team as a code owner July 29, 2026 09:32
@kiftio kiftio mentioned this pull request Jul 29, 2026
11 tasks
@bitrise

bitrise Bot commented Jul 29, 2026

Copy link
Copy Markdown

Install this build

Open Tophat, select your target device, then click Install. Links open on the Mac running Tophat.

SDK Install
React Native Install with Tophat
Swift Install with Tophat
Kotlin Install with Tophat

Checkout Kit E2E results

Status Suite Target Platform OS version tag Device
tests/shared/launch-smoke.yaml react-native ios latest iPhone 15
iOS 27 Beta
tests/shared/launch-smoke.yaml react-native android latest Google Pixel 9
Android 17.0
tests/shared/launch-smoke.yaml kotlin android latest Google Pixel 9
Android 17.0
tests/shared/launch-smoke.yaml swift ios latest iPhone 15
iOS 27 Beta

Comment thread e2e/bitrise.yml Outdated
@kiftio
kiftio force-pushed the 07-29-key_react_native_gem_cache_by_ruby_interpreter branch from 58c988b to f2d7498 Compare July 29, 2026 10:17
@kiftio
kiftio force-pushed the 07-29-limit_react_native_ci_to_relevant_changes branch from 39a736a to f1e1ecb Compare July 29, 2026 10:17

kiftio commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jul 29, 10:37 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 29, 11:16 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 29, 11:16 AM UTC: @kiftio merged this pull request with Graphite.

@kiftio
kiftio changed the base branch from 07-29-limit_react_native_ci_to_relevant_changes to graphite-base/533 July 29, 2026 10:59
@kiftio
kiftio changed the base branch from graphite-base/533 to main July 29, 2026 11:14
Assisted-By: devx/4075c309-3611-4ac8-9ea7-26a8974e7963
@kiftio
kiftio force-pushed the 07-29-key_react_native_gem_cache_by_ruby_interpreter branch from f2d7498 to 7037023 Compare July 29, 2026 11:15
@kiftio
kiftio merged commit 31b1697 into main Jul 29, 2026
27 of 28 checks passed
@kiftio
kiftio deleted the 07-29-key_react_native_gem_cache_by_ruby_interpreter branch July 29, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants