You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the backtraces on the missing-file paths of rbs collection
Running `rbs collection install` before the files it needs exist ended in
an uncaught exception with a full backtrace, because `exe/rbs` has no
rescue. Someone -- or a coding agent -- who sees that concludes that
`rbs collection` is broken and goes back to listing gems with `library`.
`rbs collection init` now points at `rbs collection install`, so these
paths are easier to reach than they were.
Four of them:
- No `rbs_collection.yaml`: `Errno::ENOENT` from `Config.from_path`, for
both `install` and `update`. Now a message naming `rbs collection init`.
- No `rbs_collection.lock.yaml` under `--frozen`: `Errno::ENOENT` from
`Installer#initialize`. The message says to run without `--frozen`, or,
when the config is missing too, to run `rbs collection init` first, so
that one message is enough to get unstuck.
- No `Gemfile`: `Bundler::GemfileNotFound` from `Bundler.definition`.
- A `Gemfile` but no `Gemfile.lock`: `Bundler.definition` returns, and
`LockfileGenerator#initialize` dies with `undefined method 'specs' for
nil` on `definition.locked_gems.specs`. Now a message naming
`bundle install`.
Raising `RBS::Collection::Config::CollectionNotAvailable`, as the issue
suggested, would keep the backtrace for exactly the same reason, so these
write to `stderr` and return 1 like the rest of `run_collection`.
`already exists` and `should exist to clean` used `Kernel#puts`, which
writes to the real `$stdout` and ignores the injected IO. Both are failures
that return 1, so they go to `stderr` now; this changes which stream they
appear on.
Tests cover each of the four paths, `--frozen` with neither file, and
`--frozen` with a lock file and no config, which keeps working.
Ref: #3093
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXtMkmp27LieHgSjNyEWZ8
0 commit comments