Skip to content

Conversation

@elfassy
Copy link
Contributor

@elfassy elfassy commented Oct 29, 2025

Only adds .rbs files to prevent editing source code. This is the best practice for gems

Screenshot 2025-10-29 at 5 16 57 PM
  • rake rbs:validate
  • rake rbs:list
  • rbs collection install (when a new gem is installed)

This PR adds automatic RBS checks when running either dev test or CI

@elfassy elfassy force-pushed the rbs branch 2 times, most recently from f584d28 to b8baf4c Compare October 29, 2025 21:41
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
bundler-cache: true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this line will do the following, so the lines below were removed

  1. Installs bundler
  2. Runs bundle install
  3. Caches the gems in vendor/bundle

@elfassy elfassy added the v4 label Oct 29, 2025
@elfassy elfassy requested a review from eargollo November 10, 2025 14:59
@robinbrandt
Copy link
Contributor

I ran into some issues that might be related to switching to the nix based dev environment:

  1. W, [2025-12-23T09:42:05.908801 #54049] WARN -- rbs: Cannot find forwardable gem. Using incorrect Bundler context? (/Users/robinbrandt/src/github.com/Shopify/money/Gemfile.lock) rbs -I sig validate

-> I temporarily added this to the gemspec which fixed the warning

  1. W, [2025-12-23T09:48:04.665265 #62128] WARN -- rbs: /Users/robinbrandt/.dev/gem/3m3q9vb6449qd7i0b20pmavc5bx1siny-nix-shell/gems/ffi-1.17.2-arm64-darwin/sig/ffi/struct.rbs:5:15...8:5: instance or class type is not allowed in this context (RBS::WillSyntaxError)

-> I couldn't get this to work. I tried bumping the version of rbs and updated the collection files but am still seeing the issue.

I'd love for this to work with the modernized dev env - let's pair on this after the break,

@elfassy
Copy link
Contributor Author

elfassy commented Jan 6, 2026

Warning 2: FFI instance or class type error

This is a bug in the ffi gem's bundled RBS files, not your project. Looking at your lock file, ffi is sourced directly from rubygems (type: rubygems), meaning RBS reads the .rbs files shipped with the gem itself. The ffi gem version 1.17.2 has invalid RBS syntax in its sig/ffi/struct.rbs file.

Options to fix:

  1. Ignore it - it's just a warning and won't break type checking
  2. Exclude ffi from RBS - add to rbs_collection.yaml:
    gems:
    - name: bigdecimal
    - name: ffi
    ignore: true
  3. Report upstream - file an issue with the https://github.com/ffi/ffi about the malformed RBS signatures

updating the gem fixed the issue

elfassy and others added 4 commits January 6, 2026 14:09
The .gem_rbs_collection directory contains auto-generated RBS type
signatures installed via `rbs collection install`. These files should
not be committed as they are environment-specific and can be regenerated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
  In your rbs_collection.yaml, you've listed forwardable as a gem:
  gems:
    - name: forwardable

  But forwardable is a Ruby standard library, not a gem. RBS correctly resolves it as type: stdlib in the lock file (line 176-179), but the warning occurs because RBS first tries to find it in Gemfile.lock as a gem before falling back to stdlib.

  Fix: Remove forwardable from the gems list - it's automatically available as part of stdlib:

  gems:
    - name: bigdecimal
    # Remove forwardable - it's stdlib, not a gem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants