Shopify / Shopify/spoom

Spoom fails when a BUNDLE_PATH is set

Open
#488 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
272
Forks
29
Avg merge
11h 35m
Merged PRs (30d)
4

Description

Describe the bug
Spoom ignores the BUNDLE_PATH when trying to bundle exec srb.

To Reproduce
Spoom version: 1.2.4

Steps to reproduce the behavior:

  1. Set a BUNDLE_PATH
  2. Run bundle exec spoom tc
  3. You'll get an error along the lines of:
bundler: failed to load command: srb (/app/bundle/bin/srb)
/usr/local/lib/ruby/3.1.0/bundler/source/git.rb:214:in rescue in load_spec_files': https://github.com/crafterm/apnotic.git (at e0a84c9@e0a84c9) is not yet checked out. Run bundle install first. (Bundler::GitError)

The above error is from a Docker instance in our CI environment, with BUNDLE_PATH set to /app/bundle and spoom being executed in /app/api. The particular error will depend on your bundle path and gems, but it'll always tell you it can't find your gems and that you need to bundle install.

Expected behavior
Spoom should respect the BUNDLE_PATH and successfully execute srb.

The code
This code is what causes the problem. Spoom removes the entire bundler environment and then re-runs bundle exec.

I would expect Spoom and Sorbet to always be in the same bundle, so you shouldn't need to re-run bundle exec. Maybe there's a use case I'm not thinking of though?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/spoom/context/exec.rb around line 36, where Spoom clears the Bundler environment and invokes bundle exec. Reproduce the problem with BUNDLE_PATH set and bundle exec spoom tc, then verify that the command can execute srb using the configured bundle without the missing-gems error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.