Skip to content

Replace bundle config subprocess calls with in-process helpers#9435

Open
hsbt wants to merge 8 commits intomasterfrom
reduce-test-time
Open

Replace bundle config subprocess calls with in-process helpers#9435
hsbt wants to merge 8 commits intomasterfrom
reduce-test-time

Conversation

@hsbt
Copy link
Member

@hsbt hsbt commented Mar 26, 2026

What's this change?

Replace bundle "config set --local", bundle "config set --global", bundle "config set" (no scope), and old-style bundle "config KEY VALUE" subprocess calls with in-process bundle_config / bundle_config_global helpers (~385 subprocess eliminations)

Motivation

Each bundle "config set ..." call spawns a Ruby subprocess just to write a config file. The bundle_config and bundle_config_global helpers do the same thing in-process via Bundler::Settings, eliminating the process startup overhead.

Make sure the following tasks are checked

Copilot AI review requested due to automatic review settings March 26, 2026 11:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Bundler spec suite to avoid spawning bundle config ... subprocesses by writing Bundler settings in-process via the config / global_config test helpers (which persist to .bundle/config).

Changes:

  • Replaced bundle "config set ..." / legacy bundle "config KEY VALUE" calls with config "BUNDLE_..." => "..." in many specs.
  • Replaced global-scope config writes with global_config where appropriate.
  • Standardized settings keys to the .bundle/config “BUNDLE_…” YAML key format (e.g., path.systemBUNDLE_PATH__SYSTEM).

Reviewed changes

Copilot reviewed 60 out of 60 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spec/update/gemfile_spec.rb Uses config helper to set BUNDLE_GEMFILE without a subprocess.
spec/runtime/setup_spec.rb Replaces multiple bundle config set calls with config helper writes.
spec/runtime/self_management_spec.rb Uses config helper for self-management-related settings (path, deployment, version).
spec/runtime/platform_spec.rb Uses config helper for force_ruby_platform.
spec/runtime/inline_spec.rb Uses config helper for force_ruby_platform and no_install.
spec/runtime/gem_tasks_spec.rb Uses config helper for BUNDLE_PATH.
spec/runtime/executable_spec.rb Uses config helper for BUNDLE_BIN.
spec/plugins/source/example_spec.rb Uses config helper for BUNDLE_PATH in plugin source specs.
spec/plugins/install_spec.rb Uses config helper for BUNDLE_DEPLOYMENT.
spec/other/major_deprecation_spec.rb Uses config helper for BUNDLE_PATH/BUNDLE_FROZEN in deprecation scenarios.
spec/install/yanked_spec.rb Uses config helper for BUNDLE_FORCE_RUBY_PLATFORM.
spec/install/path_spec.rb Uses config/global_config helpers for path-related settings.
spec/install/global_cache_spec.rb Uses config helper for path.system and local path settings.
spec/install/git_spec.rb Uses config helper for path/without/clean settings.
spec/install/gems/standalone_spec.rb Uses config helper for standalone install path/without settings.
spec/install/gems/post_install_spec.rb Uses config helper for ignore_messages settings.
spec/install/gems/native_extensions_spec.rb Uses config helper for build.* settings (BUNDLE_BUILD__...).
spec/install/gems/fund_spec.rb Uses config helper for ignore_funding_requests.
spec/install/gems/flex_spec.rb Uses config helper for force_ruby_platform.
spec/install/gems/dependency_api_spec.rb Uses config helper for BUNDLE_DEPLOYMENT.
spec/install/gems/dependency_api_fallback_spec.rb Uses config helper for BUNDLE_TIMEOUT.
spec/install/gems/compact_index_spec.rb Uses config helper for deployment/path.system/disable_checksum_validation settings.
spec/install/gemfile_spec.rb Uses config helper for BUNDLE_GEMFILE.
spec/install/gemfile/specific_platform_spec.rb Uses config helper for path/frozen/cache_all_platforms settings.
spec/install/gemfile/sources_spec.rb Uses config helper for deployment/path settings.
spec/install/gemfile/platform_spec.rb Uses config helper for frozen/path/force_ruby_platform settings.
spec/install/gemfile/path_spec.rb Uses config helper for frozen mode.
spec/install/gemfile/lockfile_spec.rb Uses config helper for BUNDLE_PLUGINS.
spec/install/gemfile/groups_spec.rb Uses config/global_config helpers for with/without settings.
spec/install/gemfile/git_spec.rb Uses config/global_config helpers for checksums/frozen/global cache/path/deployment settings.
spec/install/gemfile/gemspec_spec.rb Uses config helper for deployment/force_ruby_platform/without settings.
spec/install/gemfile/eval_gemfile_spec.rb Uses config helper for deployment mode.
spec/install/deploy_spec.rb Uses config helper for deployment/frozen/path/without settings.
spec/install/bundler_spec.rb Uses config helper for force_ruby_platform/path/system/path settings.
spec/install/allow_offline_install_spec.rb Uses config helper for BUNDLE_CLEAN.
spec/commands/version_spec.rb Uses config helper for BUNDLE_SIMULATE_VERSION.
spec/commands/update_spec.rb Uses config/global_config helpers for update/deployment/frozen/path.system/prefer_patch settings.
spec/commands/show_spec.rb Uses config helper for BUNDLE_AUTO_INSTALL.
spec/commands/post_bundle_message_spec.rb Uses config helper for path/path.system/without/force_ruby_platform settings.
spec/commands/outdated_spec.rb Uses config helper for clean/auto_install/deployment settings.
spec/commands/open_spec.rb Uses config helper for BUNDLE_AUTO_INSTALL.
spec/commands/newgem_spec.rb Uses config helper for multiple gem.* settings (test/ci/linter/init_gems_rb).
spec/commands/lock_spec.rb Uses config helper for without/path/force_ruby_platform/lockfile_checksums settings (includes an attempted unset conversion).
spec/commands/licenses_spec.rb Uses config helper for BUNDLE_AUTO_INSTALL.
spec/commands/install_spec.rb Uses config helper for force_ruby_platform/path/deployment/frozen/only settings.
spec/commands/init_spec.rb Uses config helper for BUNDLE_INIT_GEMS_RB.
spec/commands/info_spec.rb Uses config helper for path/without settings.
spec/commands/fund_spec.rb Uses config helper for BUNDLE_WITH.
spec/commands/exec_spec.rb Uses config/global_config helpers for path/path.system/clean/auto_install/disable_exec_load/gemfile settings.
spec/commands/console_spec.rb Uses config helper for console/auto_install settings.
spec/commands/clean_spec.rb Uses config helper for path/clean/without/dry_run/path.system settings.
spec/commands/check_spec.rb Uses config helper for path/without/deployment/path.system settings.
spec/commands/cache_spec.rb Uses config helper for cache_all/cache_all_platforms/without/frozen/path settings.
spec/commands/binstubs_spec.rb Uses config helper for bin/auto_install settings.
spec/commands/add_spec.rb Uses config helper for BUNDLE_FORCE_RUBY_PLATFORM.
spec/cache/path_spec.rb Uses config helper for BUNDLE_CACHE_ALL.
spec/cache/git_spec.rb Uses config helper for cache_all/path/deployment/frozen/global_gem_cache settings.
spec/cache/gems_spec.rb Uses config helper for path.system/path/cache_all_platforms settings.
spec/cache/cache_path_spec.rb Uses config helper for BUNDLE_CACHE_PATH.
spec/bundler/cli_spec.rb Uses config/global_config helpers for default_cli_command/verbose/simulate_version/disable_version_check settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

hsbt and others added 6 commits March 26, 2026 20:46
… specs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nfig helper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ocess config helper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rocess global_config helper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ess config helper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ess config helper

Handle interpolated values, inline calls, and old-style forms that were
missed in previous commits.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hsbt hsbt force-pushed the reduce-test-time branch from 1e9abf8 to 2dcd063 Compare March 26, 2026 12:10
…obal

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hsbt hsbt force-pushed the reduce-test-time branch from 2dcd063 to 982ad09 Compare March 26, 2026 12:15
@hsbt
Copy link
Member Author

hsbt commented Mar 26, 2026

This reduced test time about 2-3min each Windows runner. Now, our test time is up to 22min with macOS and Windows.

To make testing any faster, I think significant changes would be needed, such as switching from end-to-end (E2E) testing to unit testing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Collaborator

@Edouard-chin Edouard-chin left a comment

Choose a reason for hiding this comment

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

Good idea 👍

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.

3 participants