-
-
Notifications
You must be signed in to change notification settings - Fork 638
Add RBS type signatures for improved type safety #1945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit adds comprehensive RBS (Ruby Signature) type definitions for the React on Rails gem to improve type safety and IDE support. Changes: - Add RBS gem to development dependencies - Create sig/ directory with type signatures for core modules: - ReactOnRails module and main classes - Configuration class with all attributes and methods - Helper module with view helper methods - ServerRenderingPool module - Utils, PackerUtils, TestHelper modules - Controller, GitUtils, VersionChecker modules - Add rake tasks for RBS validation (rbs:validate, rbs:check, rbs:list) - Include README documentation for RBS usage Benefits: - Better IDE autocomplete and IntelliSense support - Static type checking with tools like Steep - Improved API documentation - Early detection of type-related bugs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
WalkthroughAdds RBS type signatures, docs, and Rake tasks for validating/listing signatures; introduces many Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer
participant Rake as Rake task
participant Bundler as Bundler
participant RBS as rbs CLI
Dev->>Rake: rake rbs:validate
Rake->>Bundler: run "bundle exec rbs -I sig validate"
Bundler->>RBS: invoke rbs validate (reads sig/**/*.rbs)
alt validation succeeds
RBS-->>Rake: success
Rake-->>Dev: prints success
else validation fails
RBS-->>Rake: errors
Rake-->>Dev: prints failure and exits 1
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review: RBS Type Signatures ImplementationI've completed a thorough review of this PR adding RBS type signatures to the React on Rails gem. Overall, this is a well-executed addition that will provide significant value to developers. Below is my detailed feedback: ✅ Strengths1. Excellent CoverageThe PR covers all major public APIs comprehensively:
2. Well-Structured Organization
3. Conservative Type ApproachUsing 4. Infrastructure Done Right
5. Documentation QualityThe
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (2)
Gemfile.development_dependencies (1)
36-36: Consider pinning the RBS gem version.While using the latest RBS version provides access to new features, pinning a specific version ensures consistent type-checking behavior across different development environments and CI/CD pipelines.
Apply this diff to pin a specific version:
- gem "rbs", require: false + gem "rbs", "~> 3.0", require: falserakelib/rbs.rake (1)
5-20: Consider removing unnecessary require statements.The
requirestatements on lines 6-7 are not needed since the validation runs via a shell command that loads RBS independently. Removing them simplifies the task.task :validate do - require "rbs" - require "rbs/cli" - puts "Validating RBS type signatures..."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Gemfile.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
Gemfile.development_dependencies(1 hunks)rakelib/rbs.rake(1 hunks)sig/README.md(1 hunks)sig/react_on_rails.rbs(1 hunks)sig/react_on_rails/configuration.rbs(1 hunks)sig/react_on_rails/controller.rbs(1 hunks)sig/react_on_rails/git_utils.rbs(1 hunks)sig/react_on_rails/helper.rbs(1 hunks)sig/react_on_rails/packer_utils.rbs(1 hunks)sig/react_on_rails/server_rendering_pool.rbs(1 hunks)sig/react_on_rails/test_helper.rbs(1 hunks)sig/react_on_rails/utils.rbs(1 hunks)sig/react_on_rails/version_checker.rbs(1 hunks)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
1. Pro version check in `run_stream_inside_fiber`
2. RSC support check during pack generation via `ReactOnRailsPro.configuration.enable_rsc_support`
3. RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1745
File: node_package/src/RSCRequestTracker.ts:8-14
Timestamp: 2025-07-08T05:57:29.630Z
Learning: The global `generateRSCPayload` function in React on Rails Pro (RORP) is provided by the framework during rendering requests, not implemented in application code. The `declare global` statements are used to document the expected interface that RORP will inject at runtime.
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation is handled in deeper level calls of the React on Rails Pro codebase, so it doesn't need to be validated again in the `rsc_payload_react_component` helper method.
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.
Applied to files:
sig/react_on_rails/test_helper.rbssig/README.mdsig/react_on_rails/controller.rbssig/react_on_rails/utils.rbssig/react_on_rails/version_checker.rbssig/react_on_rails/git_utils.rbssig/react_on_rails/server_rendering_pool.rbssig/react_on_rails.rbssig/react_on_rails/configuration.rbssig/react_on_rails/helper.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.
Applied to files:
sig/react_on_rails/test_helper.rbssig/react_on_rails/controller.rbssig/react_on_rails/git_utils.rbssig/react_on_rails.rbssig/react_on_rails/configuration.rbssig/react_on_rails/helper.rbs
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
1. Pro version check in `run_stream_inside_fiber`
2. RSC support check during pack generation via `ReactOnRailsPro.configuration.enable_rsc_support`
3. RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.
Applied to files:
sig/react_on_rails/test_helper.rbssig/README.mdsig/react_on_rails/utils.rbssig/react_on_rails/version_checker.rbssig/react_on_rails/git_utils.rbssig/react_on_rails.rbssig/react_on_rails/configuration.rbssig/react_on_rails/helper.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2025-07-08T05:57:29.630Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1745
File: node_package/src/RSCRequestTracker.ts:8-14
Timestamp: 2025-07-08T05:57:29.630Z
Learning: The global `generateRSCPayload` function in React on Rails Pro (RORP) is provided by the framework during rendering requests, not implemented in application code. The `declare global` statements are used to document the expected interface that RORP will inject at runtime.
Applied to files:
sig/react_on_rails/test_helper.rbssig/README.mdsig/react_on_rails/controller.rbssig/react_on_rails/server_rendering_pool.rbssig/react_on_rails.rbssig/react_on_rails/configuration.rbssig/react_on_rails/helper.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2025-02-13T16:50:26.861Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/turbolinksUtils.ts:34-36
Timestamp: 2025-02-13T16:50:26.861Z
Learning: In React on Rails, when checking for Turbolinks version 5 using `turbolinksVersion5()`, always ensure `Turbolinks` exists first by checking `turbolinksInstalled()` to prevent TypeError when accessing properties.
Applied to files:
sig/react_on_rails/test_helper.rbssig/react_on_rails/utils.rbssig/react_on_rails/version_checker.rbssig/react_on_rails/git_utils.rbssig/react_on_rails.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.
Applied to files:
sig/react_on_rails/test_helper.rbssig/react_on_rails/utils.rbssig/react_on_rails/version_checker.rbssig/react_on_rails/git_utils.rbssig/react_on_rails/server_rendering_pool.rbssig/react_on_rails.rbssig/react_on_rails/configuration.rbssig/react_on_rails/helper.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2025-09-15T21:24:48.207Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1781
File: node_package/src/ClientSideRenderer.ts:82-95
Timestamp: 2025-09-15T21:24:48.207Z
Learning: In React on Rails, the force_load feature includes both explicit `data-force-load="true"` usage and the ability to hydrate components during the page loading state (`document.readyState === 'loading'`). Both capabilities require a Pro license, so the condition `!railsContext.rorPro && (isComponentForceLoaded || document.readyState === 'loading')` correctly gates both scenarios.
Applied to files:
sig/react_on_rails/test_helper.rbssig/react_on_rails/controller.rbssig/react_on_rails/utils.rbssig/react_on_rails/git_utils.rbssig/react_on_rails/configuration.rbssig/react_on_rails/helper.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2025-02-13T16:50:47.848Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/clientStartup.ts:18-21
Timestamp: 2025-02-13T16:50:47.848Z
Learning: In the react_on_rails module, the `reactOnRailsPageUnloaded` function in clientStartup.ts is intentionally kept private as it's only used internally as a callback for `onPageUnloaded`.
Applied to files:
sig/react_on_rails/test_helper.rbssig/react_on_rails/controller.rbssig/react_on_rails/utils.rbssig/react_on_rails/version_checker.rbssig/react_on_rails/git_utils.rbssig/react_on_rails/server_rendering_pool.rbssig/react_on_rails.rbssig/react_on_rails/configuration.rbssig/react_on_rails/helper.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation is handled in deeper level calls of the React on Rails Pro codebase, so it doesn't need to be validated again in the `rsc_payload_react_component` helper method.
Applied to files:
sig/react_on_rails/test_helper.rbssig/README.mdsig/react_on_rails/helper.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2025-10-23T17:22:01.074Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. The `react_on_rails_pro?` method validates licenses and should raise errors early (including during path resolution in methods like `server_bundle?`) to enforce licensing requirements rather than failing later with obscure errors.
Applied to files:
sig/react_on_rails/test_helper.rbssig/react_on_rails/utils.rbssig/react_on_rails/version_checker.rbssig/react_on_rails/git_utils.rbssig/react_on_rails/server_rendering_pool.rbssig/react_on_rails.rbssig/react_on_rails/configuration.rbssig/react_on_rails/packer_utils.rbs
📚 Learning: 2024-10-08T20:53:47.076Z
Learnt from: theforestvn88
Repo: shakacode/react_on_rails PR: 1620
File: spec/dummy/client/app/startup/HelloTurboStream.jsx:3-3
Timestamp: 2024-10-08T20:53:47.076Z
Learning: The `RailsContext` import in `spec/dummy/client/app/startup/HelloTurboStream.jsx` is used later in the project, as clarified by the user theforestvn88.
Applied to files:
sig/react_on_rails/test_helper.rbssig/react_on_rails/utils.rbssig/react_on_rails/helper.rbs
📚 Learning: 2025-04-09T12:56:10.756Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1696
File: node_package/src/RSCPayloadContainer.ts:0-0
Timestamp: 2025-04-09T12:56:10.756Z
Learning: In the react_on_rails codebase, RSC payloads are already stringified using `JSON.stringify()` before being processed by the `escapeScript` function, which handles escaping of special characters. The function only needs to handle specific HTML markers like comments and closing script tags.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/server_rendering_pool.rbssig/react_on_rails.rbssig/react_on_rails/helper.rbs
📚 Learning: 2024-12-12T13:07:09.929Z
Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/ReactOnRailsRSC.ts:87-87
Timestamp: 2024-12-12T13:07:09.929Z
Learning: When handling errors in 'node_package/src/ReactOnRailsRSC.ts', include the error stack in error messages in development and test environments to aid debugging.
Applied to files:
sig/react_on_rails/version_checker.rbssig/react_on_rails.rbs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: build
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: rspec-package-tests (3.2, minimum)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.2, 20, minimum)
- GitHub Check: claude-review
- GitHub Check: markdown-link-check
🔇 Additional comments (8)
sig/react_on_rails/git_utils.rbs (1)
1-8: LGTM!The RBS signatures for GitUtils are well-defined with appropriate types. The method names follow Ruby conventions, and the return types (bool, String?, Array[String]) accurately represent the expected outputs.
sig/README.md (1)
1-52: LGTM!The documentation is well-structured and provides clear guidance on RBS usage, validation, and development workflows. The inclusion of practical commands and external references makes it easy for developers to get started with type signatures.
rakelib/rbs.rake (1)
25-31: LGTM!The list task is straightforward and useful for discovering available RBS signature files.
sig/react_on_rails/test_helper.rbs (1)
1-11: LGTM!The TestHelper signatures are well-defined. The conservative typing with
untyped configis appropriate for configuration objects, and the optionalforce_compileparameter is correctly typed.sig/react_on_rails/server_rendering_pool.rbs (1)
1-12: LGTM!The ServerRenderingPool signatures appropriately use conservative typing (
untypedfor the pool object and hash values) while maintaining type safety for the structural contracts (Hash keys, string parameters, void returns).sig/react_on_rails/utils.rbs (1)
1-22: LGTM!The Utils signatures comprehensively cover utility methods with appropriate types. The conservative use of
untypedfor methods liketruthy_presenceis reasonable given their dynamic nature. The nestedRequiredmodule correctly defines an instance method for mixin usage.sig/react_on_rails/version_checker.rbs (1)
3-10: Version checker surface looks solidThe exposed class method plus supporting privates mirror the Ruby module, so this signature set looks good to me.
sig/react_on_rails/packer_utils.rbs (1)
3-13: Nice coverage of packer utility helpersThanks for capturing the boolean capability checks and the raise_* helpers — this matches the Ruby API and should type-check well.
| attr_accessor defer_generated_component_packs: bool | ||
| attr_accessor server_render_method: String? | ||
| attr_accessor random_dom_id: bool | ||
| attr_accessor auto_load_bundle: bool | ||
| attr_accessor same_bundle_for_client_and_server: bool | ||
| attr_accessor rendering_props_extension: String? | ||
| attr_accessor make_generated_server_bundle_the_entrypoint: bool | ||
| attr_accessor generated_component_packs_loading_strategy: Symbol? | ||
| attr_accessor immediate_hydration: bool | ||
| attr_accessor component_registry_timeout: Integer | ||
| attr_accessor server_bundle_output_path: String? | ||
| attr_accessor enforce_private_server_bundles: bool | ||
|
|
||
| def initialize: ( | ||
| ?node_modules_location: String?, | ||
| ?server_bundle_js_file: String?, | ||
| ?prerender: bool?, | ||
| ?replay_console: bool?, | ||
| ?make_generated_server_bundle_the_entrypoint: bool?, | ||
| ?trace: bool?, | ||
| ?development_mode: bool?, | ||
| ?defer_generated_component_packs: bool?, | ||
| ?logging_on_server: bool?, | ||
| ?server_renderer_pool_size: Integer?, | ||
| ?server_renderer_timeout: Integer?, | ||
| ?raise_on_prerender_error: bool, | ||
| ?skip_display_none: bool?, | ||
| ?generated_assets_dirs: Array[String]?, | ||
| ?generated_assets_dir: String?, | ||
| ?webpack_generated_files: Array[String]?, | ||
| ?rendering_extension: String?, | ||
| ?build_test_command: String?, | ||
| ?build_production_command: String?, | ||
| ?generated_component_packs_loading_strategy: Symbol?, | ||
| ?same_bundle_for_client_and_server: bool?, | ||
| ?i18n_dir: String?, | ||
| ?i18n_yml_dir: String?, | ||
| ?i18n_output_format: Symbol?, | ||
| ?i18n_yml_safe_load_options: Hash[Symbol, untyped]?, | ||
| ?random_dom_id: bool?, | ||
| ?server_render_method: String?, | ||
| ?rendering_props_extension: String?, | ||
| ?components_subdirectory: String?, | ||
| ?auto_load_bundle: bool?, | ||
| ?immediate_hydration: bool?, | ||
| ?component_registry_timeout: Integer?, | ||
| ?server_bundle_output_path: String?, | ||
| ?enforce_private_server_bundles: bool? | ||
| ) -> void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the missing force_load configuration accessor
ReactOnRails::Configuration exposes a force_load accessor (used to gate hydration in the helper), and recent releases default it to true. Because the accessor and initializer keyword are missing here, typed code can’t call configuration.force_load or set it via configure. Please add the accessor plus the keyword arg:
- attr_accessor auto_load_bundle: bool
+ attr_accessor auto_load_bundle: bool
+ attr_accessor force_load: bool
@@
- ?auto_load_bundle: bool?,
+ ?auto_load_bundle: bool?,
+ ?force_load: bool?,(Place the new keyword next to the related bundle toggles.) This keeps the signature in sync with the Ruby configuration API.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| attr_accessor defer_generated_component_packs: bool | |
| attr_accessor server_render_method: String? | |
| attr_accessor random_dom_id: bool | |
| attr_accessor auto_load_bundle: bool | |
| attr_accessor same_bundle_for_client_and_server: bool | |
| attr_accessor rendering_props_extension: String? | |
| attr_accessor make_generated_server_bundle_the_entrypoint: bool | |
| attr_accessor generated_component_packs_loading_strategy: Symbol? | |
| attr_accessor immediate_hydration: bool | |
| attr_accessor component_registry_timeout: Integer | |
| attr_accessor server_bundle_output_path: String? | |
| attr_accessor enforce_private_server_bundles: bool | |
| def initialize: ( | |
| ?node_modules_location: String?, | |
| ?server_bundle_js_file: String?, | |
| ?prerender: bool?, | |
| ?replay_console: bool?, | |
| ?make_generated_server_bundle_the_entrypoint: bool?, | |
| ?trace: bool?, | |
| ?development_mode: bool?, | |
| ?defer_generated_component_packs: bool?, | |
| ?logging_on_server: bool?, | |
| ?server_renderer_pool_size: Integer?, | |
| ?server_renderer_timeout: Integer?, | |
| ?raise_on_prerender_error: bool, | |
| ?skip_display_none: bool?, | |
| ?generated_assets_dirs: Array[String]?, | |
| ?generated_assets_dir: String?, | |
| ?webpack_generated_files: Array[String]?, | |
| ?rendering_extension: String?, | |
| ?build_test_command: String?, | |
| ?build_production_command: String?, | |
| ?generated_component_packs_loading_strategy: Symbol?, | |
| ?same_bundle_for_client_and_server: bool?, | |
| ?i18n_dir: String?, | |
| ?i18n_yml_dir: String?, | |
| ?i18n_output_format: Symbol?, | |
| ?i18n_yml_safe_load_options: Hash[Symbol, untyped]?, | |
| ?random_dom_id: bool?, | |
| ?server_render_method: String?, | |
| ?rendering_props_extension: String?, | |
| ?components_subdirectory: String?, | |
| ?auto_load_bundle: bool?, | |
| ?immediate_hydration: bool?, | |
| ?component_registry_timeout: Integer?, | |
| ?server_bundle_output_path: String?, | |
| ?enforce_private_server_bundles: bool? | |
| ) -> void | |
| attr_accessor defer_generated_component_packs: bool | |
| attr_accessor server_render_method: String? | |
| attr_accessor random_dom_id: bool | |
| attr_accessor auto_load_bundle: bool | |
| attr_accessor force_load: bool | |
| attr_accessor same_bundle_for_client_and_server: bool | |
| attr_accessor rendering_props_extension: String? | |
| attr_accessor make_generated_server_bundle_the_entrypoint: bool | |
| attr_accessor generated_component_packs_loading_strategy: Symbol? | |
| attr_accessor immediate_hydration: bool | |
| attr_accessor component_registry_timeout: Integer | |
| attr_accessor server_bundle_output_path: String? | |
| attr_accessor enforce_private_server_bundles: bool | |
| def initialize: ( | |
| ?node_modules_location: String?, | |
| ?server_bundle_js_file: String?, | |
| ?prerender: bool?, | |
| ?replay_console: bool?, | |
| ?make_generated_server_bundle_the_entrypoint: bool?, | |
| ?trace: bool?, | |
| ?development_mode: bool?, | |
| ?defer_generated_component_packs: bool?, | |
| ?logging_on_server: bool?, | |
| ?server_renderer_pool_size: Integer?, | |
| ?server_renderer_timeout: Integer?, | |
| ?raise_on_prerender_error: bool, | |
| ?skip_display_none: bool?, | |
| ?generated_assets_dirs: Array[String]?, | |
| ?generated_assets_dir: String?, | |
| ?webpack_generated_files: Array[String]?, | |
| ?rendering_extension: String?, | |
| ?build_test_command: String?, | |
| ?build_production_command: String?, | |
| ?generated_component_packs_loading_strategy: Symbol?, | |
| ?same_bundle_for_client_and_server: bool?, | |
| ?i18n_dir: String?, | |
| ?i18n_yml_dir: String?, | |
| ?i18n_output_format: Symbol?, | |
| ?i18n_yml_safe_load_options: Hash[Symbol, untyped]?, | |
| ?random_dom_id: bool?, | |
| ?server_render_method: String?, | |
| ?rendering_props_extension: String?, | |
| ?components_subdirectory: String?, | |
| ?auto_load_bundle: bool?, | |
| ?force_load: bool?, | |
| ?immediate_hydration: bool?, | |
| ?component_registry_timeout: Integer?, | |
| ?server_bundle_output_path: String?, | |
| ?enforce_private_server_bundles: bool? | |
| ) -> void |
🤖 Prompt for AI Agents
In sig/react_on_rails/configuration.rbs around lines 25 to 73, the `force_load`
configuration accessor and initializer keyword are missing; add an
`attr_accessor force_load: bool` and add the `?force_load: bool?` keyword
argument to the initialize signature placed next to the related bundle toggles
(e.g., alongside `auto_load_bundle` / `same_bundle_for_client_and_server`) so
the RBS matches the Ruby API and callers can read/set configuration.force_load.
- Add optional block parameters to react_component, react_component_hash, and internal_react_component helper methods to support yielding in view code - Change Controller#redux_store immediate_hydration parameter from bool? to bool to disallow explicit nil (nil is handled via parameter omission) - Fix PrerenderError to use attr_reader instead of attr_accessor - Mark PrerenderError attributes as optional types (String?, Hash?, Array?) - Add missing attr_readers (component_name, props, console_messages) - Add missing public methods (to_honeybadger_context, raven_context, to_error_context) All changes improve type accuracy and match actual Ruby implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Code Review: RBS Type SignaturesI've reviewed this PR thoroughly and it's a solid addition to the React on Rails gem. Here's my detailed feedback: ✅ Strengths
🐛 Issues Found1. Method Name Inconsistency in utils.rbsLocation: The RBS signature shows: def self.rails_version_less_than?: (String version) -> boolBut the actual implementation in def self.rails_version_less_than(version)Fix: Change line 15 in def self.rails_version_less_than?: (String version) -> boolto: def self.rails_version_less_than: (String version) -> bool(Remove the 2. Missing Public Method in utils.rbsThe file Recommendation: Add to def self.react_on_rails_pro?: () -> bool💡 Suggestions
🧪 Testing
🔒 SecurityNo security concerns - this is a development-time only feature with no runtime impact. 📊 PerformanceNo performance impact - RBS files are not loaded at runtime. 📝 DocumentationThe ✅ SummaryThis is a valuable addition that will improve developer experience for users with RBS-aware IDEs. The implementation is solid and follows RBS best practices. Just need to fix the method name inconsistency in utils.rbs before merging. Recommendation: Approve with minor changes requested (fix the method name issue). Reviewed using Claude Code 🤖 |
- Fix Utils module method signatures:
- Remove question mark from rails_version_less_than (matches actual implementation)
- Add missing public utility methods:
- react_on_rails_pro_version
- rsc_support_enabled?
- full_text_errors_enabled?
- smart_trim
- find_most_recent_mtime
- prepend_to_file_if_text_not_present
- detect_package_manager
- default_troubleshooting_section
- server_bundle_js_file_path
- source_path
- public_bundles_full_path
- generated_assets_full_path
- gem_available?
- Add missing Configuration private methods:
- rsc_bundle_js_file
- react_client_manifest_file
- react_server_client_manifest_file
These methods are used in ensure_webpack_generated_files_exists and other
parts of the codebase, so including them improves type coverage.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Code Review: RBS Type Signatures PR #1945Great work on adding comprehensive RBS type signatures! This is a valuable addition that will improve developer experience and enable static type checking. Here's my detailed review: ✅ Strengths
🔍 Issues Found1. Type Mismatch in
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
sig/react_on_rails.rbs(1 hunks)sig/react_on_rails/controller.rbs(1 hunks)sig/react_on_rails/helper.rbs(1 hunks)
🧰 Additional context used
🧠 Learnings (13)
📚 Learning: 2025-09-15T21:24:48.207Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1781
File: node_package/src/ClientSideRenderer.ts:82-95
Timestamp: 2025-09-15T21:24:48.207Z
Learning: In React on Rails, the force_load feature includes both explicit `data-force-load="true"` usage and the ability to hydrate components during the page loading state (`document.readyState === 'loading'`). Both capabilities require a Pro license, so the condition `!railsContext.rorPro && (isComponentForceLoaded || document.readyState === 'loading')` correctly gates both scenarios.
Applied to files:
sig/react_on_rails/controller.rbssig/react_on_rails/helper.rbs
📚 Learning: 2025-02-13T16:50:47.848Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/clientStartup.ts:18-21
Timestamp: 2025-02-13T16:50:47.848Z
Learning: In the react_on_rails module, the `reactOnRailsPageUnloaded` function in clientStartup.ts is intentionally kept private as it's only used internally as a callback for `onPageUnloaded`.
Applied to files:
sig/react_on_rails/controller.rbssig/react_on_rails/helper.rbssig/react_on_rails.rbs
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.
Applied to files:
sig/react_on_rails/controller.rbssig/react_on_rails/helper.rbssig/react_on_rails.rbs
📚 Learning: 2025-07-08T05:57:29.630Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1745
File: node_package/src/RSCRequestTracker.ts:8-14
Timestamp: 2025-07-08T05:57:29.630Z
Learning: The global `generateRSCPayload` function in React on Rails Pro (RORP) is provided by the framework during rendering requests, not implemented in application code. The `declare global` statements are used to document the expected interface that RORP will inject at runtime.
Applied to files:
sig/react_on_rails/controller.rbssig/react_on_rails/helper.rbssig/react_on_rails.rbs
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation is handled in deeper level calls of the React on Rails Pro codebase, so it doesn't need to be validated again in the `rsc_payload_react_component` helper method.
Applied to files:
sig/react_on_rails/helper.rbs
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
1. Pro version check in `run_stream_inside_fiber`
2. RSC support check during pack generation via `ReactOnRailsPro.configuration.enable_rsc_support`
3. RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.
Applied to files:
sig/react_on_rails/helper.rbssig/react_on_rails.rbs
📚 Learning: 2025-10-23T17:22:01.074Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. The `react_on_rails_pro?` method validates licenses and should raise errors early (including during path resolution in methods like `server_bundle?`) to enforce licensing requirements rather than failing later with obscure errors.
Applied to files:
sig/react_on_rails/helper.rbssig/react_on_rails.rbs
📚 Learning: 2025-04-09T12:56:10.756Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1696
File: node_package/src/RSCPayloadContainer.ts:0-0
Timestamp: 2025-04-09T12:56:10.756Z
Learning: In the react_on_rails codebase, RSC payloads are already stringified using `JSON.stringify()` before being processed by the `escapeScript` function, which handles escaping of special characters. The function only needs to handle specific HTML markers like comments and closing script tags.
Applied to files:
sig/react_on_rails/helper.rbssig/react_on_rails.rbs
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.
Applied to files:
sig/react_on_rails/helper.rbssig/react_on_rails.rbs
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.
Applied to files:
sig/react_on_rails/helper.rbssig/react_on_rails.rbs
📚 Learning: 2024-10-08T20:53:47.076Z
Learnt from: theforestvn88
Repo: shakacode/react_on_rails PR: 1620
File: spec/dummy/client/app/startup/HelloTurboStream.jsx:3-3
Timestamp: 2024-10-08T20:53:47.076Z
Learning: The `RailsContext` import in `spec/dummy/client/app/startup/HelloTurboStream.jsx` is used later in the project, as clarified by the user theforestvn88.
Applied to files:
sig/react_on_rails/helper.rbs
📚 Learning: 2024-12-12T13:07:09.929Z
Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/ReactOnRailsRSC.ts:87-87
Timestamp: 2024-12-12T13:07:09.929Z
Learning: When handling errors in 'node_package/src/ReactOnRailsRSC.ts', include the error stack in error messages in development and test environments to aid debugging.
Applied to files:
sig/react_on_rails.rbs
📚 Learning: 2025-02-13T16:50:26.861Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/turbolinksUtils.ts:34-36
Timestamp: 2025-02-13T16:50:26.861Z
Learning: In React on Rails, when checking for Turbolinks version 5 using `turbolinksVersion5()`, always ensure `Turbolinks` exists first by checking `turbolinksInstalled()` to prevent TypeError when accessing properties.
Applied to files:
sig/react_on_rails.rbs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.2, 20, minimum)
- GitHub Check: build
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: rspec-package-tests (3.2, minimum)
- GitHub Check: claude-review
- GitHub Check: markdown-link-check
🔇 Additional comments (12)
sig/react_on_rails/controller.rbs (1)
9-9: LGTM!The signature is straightforward and consistent with the corresponding method in
sig/react_on_rails/helper.rbs(line 21).sig/react_on_rails/helper.rbs (7)
6-14: Past issue resolved: optional blocks added.Both
react_componentandreact_component_hashnow correctly include the optional block parameter?{ () -> untyped }, matching the Ruby implementation that accepts blocks for rendering inner HTML or cached props.
16-21: LGTM!The
redux_storeandredux_store_hydration_datasignatures are clean and type-safe for the Helper module.
23-26: LGTM!The signature correctly captures the server-side JavaScript rendering method with appropriate parameter types.
28-28: LGTM!Using
untypedfor props is appropriate here, as this method handles sanitization of various prop types.
30-32: LGTM!The optional
server_sideparameter is correctly typed and the return type appropriately usesuntypedfor the hash values.
36-39: Past issue resolved: optional block added.The
internal_react_componentprivate method now correctly includes the optional block parameter, consistent with the fix applied to the public helper methods.
41-55: LGTM!The private helper methods have well-defined signatures with appropriate keyword arguments. The distinction between handling string vs. hash server-rendered results is clear in the type signatures.
sig/react_on_rails.rbs (4)
4-10: LGTM!The module constants and configuration methods follow standard Ruby gem conventions. The
configuremethod correctly accepts a block that yields theConfigurationobject.
12-13: LGTM!Standard error base class definition.
15-33: Past issues resolved: attr_reader with optional types.The
PrerenderErrorclass now correctly usesattr_reader(instead ofattr_accessor) and all attributes are properly typed as optional (with?), matching the implementation where the initializer can set them tonil. The context helper methods (to_honeybadger_context,raven_context,to_error_context) have appropriate signatures.
35-37: LGTM!The
JsonParseErrorclass has a straightforward signature with a requirederrparameter.
| def redux_store: ( | ||
| String store_name, | ||
| ?props: untyped, | ||
| ?immediate_hydration: bool | ||
| ) -> void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Past issue resolved; verify props type consistency with Helper.
The immediate_hydration parameter is now correctly typed as bool (matching the past review recommendation). However, the props parameter is typed as untyped here, while the corresponding redux_store method in sig/react_on_rails/helper.rbs (lines 16-19) types it as Hash[Symbol, untyped]. Consider using the same type in both signatures to maintain consistency across the API surface.
🏁 Script executed:
#!/bin/bash
# Verify the actual implementation of redux_store in Controller to determine the correct props type
rg -nP "def redux_store" --type ruby -A 10 -g 'lib/react_on_rails/controller.rb'Length of output: 814
I need to verify the actual Helper RBS signature that the review mentions. Let me search for it in the codebase.
I need to verify the actual RBS signatures in the repository since I can't do more web searches. Let me check the codebase directly.
🏁 Script executed:
#!/bin/bash
# Find and display helper.rbs file and its redux_store method if it exists
fd helper.rbs --type f -x cat {}Length of output: 1834
🏁 Script executed:
#!/bin/bash
# Also find the controller.rbs to verify the full context
fd controller.rbs --type f -x cat {}Length of output: 217
Correct props type in Controller RBS to match Helper and implementation.
The immediate_hydration parameter is correctly typed as bool. However, the props parameter in Controller RBS is typed as untyped, while both the Helper RBS (lines 12-14) and the actual Controller implementation (which defaults props to {}) indicate it should be Hash[Symbol, untyped]. Update sig/react_on_rails/controller.rbs line 5 to use ?props: Hash[Symbol, untyped] for consistency.
🤖 Prompt for AI Agents
In sig/react_on_rails/controller.rbs around lines 3 to 7, the props parameter is
currently typed as untyped but should match the Helper RBS and implementation;
change the signature so that line 5 uses ?props: Hash[Symbol, untyped] (keeping
immediate_hydration: bool) so the method reads with props optional and typed as
a symbol-keyed hash.
PR Review: Add RBS Type Signatures for Improved Type SafetySummaryThis PR adds comprehensive RBS type signatures to the React on Rails gem. Overall, this is a valuable addition that will improve developer experience, IDE support, and type safety. The implementation is well-structured and follows RBS best practices. Positive Aspects1. Excellent Structure and Organization
2. Smart Type Modeling
3. Good Testing Infrastructure
Issues and Recommendations1. Critical: Missing Version Constraint for RBS GemIssue: The Gemfile.development_dependencies adds RBS without a version constraint: gem "rbs", require: falseRisk: Future breaking changes in RBS could cause CI failures. Recommendation: Add a version constraint based on what's been tested: gem "rbs", "~> 3.9", require: false2. Type Signature Accuracy Issues2a. Configuration Initialization ParametersIssue: Several attr_accessor declarations should be nullable. In configuration.rbs line 4, server_bundle_js_file is typed as String but the implementation accepts nil. Recommendation: Review all attr_accessor declarations to ensure nullable types are marked with ? where the implementation allows nil values. 2b. Helper Module Method SignaturesThe sanitized_props_string signature uses untyped which is appropriate, but could be more specific as (String | Hash[Symbol, untyped]) if desired. 3. Documentation SuggestionsMissing CHANGELOG Entry: According to CLAUDE.md, this change should have a CHANGELOG entry since it's a new feature that's user-visible (better IDE support). Recommendation: Add an entry like: #### [PR 1945](https://github.com/shakacode/react_on_rails/pull/1945) by [justin808](https://github.com/justin808)
Added RBS (Ruby Signature) type definitions for improved IDE support, autocomplete, and optional static type checking.4. Testing RecommendationsRecommendation: Add a CI job to prevent regressions: - name: Validate RBS signatures
run: bundle exec rake rbs:validateThis ensures signatures stay valid as code evolves. Security ConsiderationsNo security concerns. RBS files are only used at development/type-checking time, not loaded at runtime, and cannot introduce vulnerabilities. Performance ConsiderationsNo performance impact - RBS files are not loaded in production and have no runtime overhead. Summary of RecommendationsMust Fix (Before Merge)
Should Fix
Nice to Have
ConclusionThis is a well-executed PR that adds real value to the React on Rails ecosystem. The RBS signatures are comprehensive, well-organized, and follow best practices. With the recommended fixes (especially the version constraint and nullable types), this will be production-ready. Great work on improving the developer experience! |
|
Maybe this is all planned for follow-ups, but:
|
Code Review: RBS Type Signatures PR #1945Great work adding RBS type signatures to React on Rails! This is a valuable addition that will improve developer experience and type safety. Here's my comprehensive review: ✅ Strengths
🔍 Observations & Minor Issues1. Block Parameters Not CapturedThe # In sig/react_on_rails/helper.rbs
def react_component: (
String component_name,
?Hash[Symbol, untyped] options
) ?{ () -> untyped } -> StringAnalysis: After reviewing the implementation, these methods don't currently use blocks. The block parameter was likely added proactively, which is fine but may cause confusion. Recommendation: Consider removing the block parameters unless there's a future plan to support them, or add a comment explaining the intent. 2. Rake Task ValidationThe Status: Assuming it exists based on the PR description confirming validation passes. 3. Controller#redux_store immediate_hydration ParameterIn def redux_store: (
String store_name,
?props: untyped,
?immediate_hydration: bool
) -> voidThe implementation shows: def redux_store(store_name, props: {}, immediate_hydration: nil)
immediate_hydration = ReactOnRails.configuration.immediate_hydration if immediate_hydration.nil?Issue: The signature uses Current Fix: According to commit 4. Configuration#initialize Default ParameterThe
The implementation defaults to Impact: Low - RBS will still validate correctly, but the signature could be more precise. 5. Missing Type SignaturesSome classes aren't covered yet (intentionally, per PR description):
Status: Acceptable given this PR focuses on public API coverage. 🎯 Suggestions
🔐 Security Considerations✅ No security concerns - RBS signatures are compile-time type definitions and don't affect runtime behavior. 🧪 Testing & QualityValidation: According to the PR description, all signatures validate with Rubocop: PR mentions all checks pass ✅ Breaking Changes: None - RBS is completely optional and backward compatible ✅ 📊 Overall AssessmentThis is a high-quality PR that adds significant value to the gem:
✅ RecommendationAPPROVE - This PR is ready to merge with the following optional improvements for future consideration:
The minor observations above are mostly documentation/precision improvements and don't block merging. The type signatures accurately reflect the public API and will provide immediate value to developers using modern Ruby tooling. Great contribution! 🎉 |
Pull Request Review: Add RBS Type SignaturesI've reviewed this PR and have the following feedback: Overall AssessmentThis is an excellent addition to the React on Rails gem! Adding RBS type signatures is a forward-thinking enhancement that will benefit the Ruby community as type systems continue to evolve. The implementation is well-structured and thoughtful. Strengths
Issues Found1. Type Accuracy Issue in ConfigurationCritical Issue: In sig/react_on_rails/configuration.rbs line 50, the parameter raise_on_prerender_error: bool should be optional ?raise_on_prerender_error: bool because the implementation in lib/react_on_rails/configuration.rb:79 shows it has a default value of true. 2. Missing Helper Method SignatureThe json_safe_and_pretty method (line 253 of helper.rb) is missing from sig/react_on_rails/helper.rbs. 3. Verify Private Method SignaturesThe private methods rsc_bundle_js_file, react_client_manifest_file, and react_server_client_manifest_file are listed in configuration.rbs but I could not verify they exist in the Configuration class. Please confirm these methods exist or remove the signatures. Recommendations
Performance & Security
Final VerdictApprove with minor fixes required. Please fix issue #1 (the optional parameter) before merging. The other issues are suggestions for improvement. Great work positioning React on Rails for the future of Ruby's type system! |
Code Review - PR #1945: Add RBS type signaturesThank you for adding RBS type signatures to improve type safety! This is a valuable addition to the gem. I've conducted a thorough review and have the following feedback: ✅ Strengths
🔍 Issues Found1. Missing
|
Code Review - PR #1945: Add RBS Type SignaturesOverall AssessmentThis is an excellent addition to the React on Rails gem. The RBS type signatures are comprehensive, well-structured, and provide significant value to users. The implementation follows best practices and integrates smoothly with the existing codebase. ✅ Strengths1. Comprehensive Coverage
2. Well-Structured Organization
3. Conservative Type Choices
4. Excellent Infrastructure
5. Documentation Value
🔍 Issues Found1. Configuration Initialize Method - Type InconsistencyFile: Issue: The # RBS signature says:
?raise_on_prerender_error: bool
# But the implementation has:
raise_on_prerender_error: true # default value is true, not nilFix needed in def initialize: (
# ... other params ...
?raise_on_prerender_error: bool?, # Add ? to make it nilable
# ... rest of params ...
) -> voidThe actual implementation in 2. Missing Return Types in ConfigurationFile: Issue: Three private methods at the bottom lack proper return type signatures: def rsc_bundle_js_file: () -> String?
def react_client_manifest_file: () -> String?
def react_server_client_manifest_file: () -> String?These look correct, but should be verified against the actual implementation to ensure they can indeed return nil. 3. Helper Module - Block Parameter TypeFile: Issue: The block parameter for ?{ () -> untyped }Question: Can this block accept parameters? Based on the implementation in 4. Rake Task Error HandlingFile: Minor issue: The validation task uses if result
puts "✓ RBS validation passed"
else
abort "✗ RBS validation failed"
endThis is a minor point, but 💡 Suggestions for Improvement1. Add RBS Validation to CIConsider adding the RBS validation task to your CI pipeline. You could add this to your GitHub Actions workflow or to the default Rake task: # In Rakefile or appropriate rake task
task default: [:lint, :rbs:validate, :spec]This ensures type signatures stay in sync with the code as it evolves. 2. Document Type Signature MaintenanceAdd a section to ## RBS Type Signatures
When modifying public APIs:
1. Update corresponding .rbs files in `sig/`
2. Run `bundle exec rake rbs:validate` to verify
3. Signatures should be conservative (prefer `untyped` for complex dynamic values)3. Consider Adding Steep ConfigurationFor developers who want static type checking, consider adding a # Steepfile (optional)
target :lib do
signature "sig"
check "lib"
end4. Utils Module - Missing Nested ModuleThe module Utils
# Module for requiring values to be present
module Required
# Raises an error if the named value is nil or blank
def required: (String name) -> untyped
end
end🔒 Security ConsiderationsNo security concerns identified. The RBS signatures are metadata only and don't affect runtime behavior. 🧪 Test CoverageThe PR description mentions:
Recommendation: Consider adding a CI check to ensure RBS validation passes on every PR. 📊 Performance ConsiderationsNo performance impact - RBS files are not loaded at runtime unless explicitly used with tools like Steep or for IDE integration. 🎯 ConclusionThis is a high-quality contribution that adds significant value to the React on Rails gem. The type signatures are well-crafted and follow Ruby/RBS best practices. Recommended Actions:
Overall Rating: ⭐⭐⭐⭐⭐ (5/5) Great work on this addition! The React on Rails community will definitely benefit from these type signatures. Review conducted following guidelines from CLAUDE.md and React on Rails best practices. |
Code Review: RBS Type Signatures ImplementationI've completed a thorough review of this PR adding RBS type signatures to the React on Rails gem. Overall, this is a well-executed addition that will provide significant value to developers. Below is my detailed feedback: ✅ Strengths1. Excellent CoverageThe PR covers all major public APIs comprehensively:
2. Well-Structured Organization
3. Conservative Type ApproachUsing 4. Infrastructure Done Right
5. Documentation QualityThe
|
Code Review: Add RBS Type Signatures for Improved Type SafetyOverall, this is a well-structured PR that adds valuable type safety infrastructure to the gem. The RBS signatures are comprehensive and follow best practices. Here's my detailed feedback: ✅ Strengths
🔍 Issues & Recommendations1. Type Accuracy IssuesConfiguration#initialize parameter types: In # Current (line 49 in signature):
?raise_on_prerender_error: bool,
# Should be:
?raise_on_prerender_error: bool?,Reason: Looking at Helper#react_component return type: The signature shows it returns # Current:
def react_component: (...) -> String
# Should be:
def react_component: (...) -> ActiveSupport::SafeBufferSame applies to:
2. Missing Method SignaturesConfiguration private methods: The private methods section in # Add return types:
def rsc_bundle_js_file: () -> String?
def react_client_manifest_file: () -> String?
def react_server_client_manifest_file: () -> String?These are referenced in the configuration but not fully typed. Utils module coverage: Several public utility methods are missing from
3. Rake Task Improvements
# Current:
result = system("bundle exec rbs -I sig validate")
if result
puts "✓ RBS validation passed"
else
puts "✗ RBS validation failed"
exit 1
endRecommendation: Handle result = system("bundle exec rbs -I sig validate")
case result
when true
puts "✓ RBS validation passed"
when false
puts "✗ RBS validation failed"
exit 1
when nil
puts "✗ RBS command not found or could not be executed"
exit 1
end4. Documentation Enhancementssig/README.md could benefit from:
🔒 Security ConsiderationsNo security concerns identified. The RBS signatures are read-only metadata and don't affect runtime behavior. 🧪 Test CoverageThe PR mentions validation passes, which is good. Additional recommendations:
🎯 Performance ConsiderationsRBS files are only loaded by type-checking tools, not at runtime, so there's zero performance impact. The 📝 Minor Issues
✨ Suggested Next Steps
🎉 ConclusionThis is a solid addition to the gem that will significantly improve the developer experience. The issues mentioned are minor and easily fixable. Once the type accuracy issues are resolved, this PR will be ready to merge. Great work on improving type safety! 🚀 Approval Status: ✅ Approve with minor changes requested cc: @justin808 |
Type Accuracy Fixes:
- Change Configuration#initialize raise_on_prerender_error from bool to bool?
to allow nil values (matches actual implementation)
- Replace String return types with safe_buffer type alias for methods that
return html_safe strings (ActiveSupport::SafeBuffer):
- Helper: react_component, react_component_hash, redux_store,
redux_store_hydration_data, server_render_js
- Controller: redux_store_hydration_data
- Private helpers: build_react_component_result_for_server_rendered_string,
build_react_component_result_for_server_rendered_hash,
prepend_render_rails_context
Infrastructure Improvements:
- Improve rake task error handling with explicit case statement for nil
(handles cases where RBS command is not found)
- Add rubocop disable directive for Metrics/BlockLength in rbs.rake
The safe_buffer type alias (= String) documents that these methods return
html_safe strings while maintaining RBS compatibility without requiring
ActiveSupport type definitions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Code Review: RBS Type SignaturesThank you for this excellent contribution! Adding RBS type signatures is a valuable improvement that will benefit developers using the gem. Here's my detailed review: ✅ Strengths1. Excellent Type CoverageThe PR provides comprehensive type signatures for the most important public APIs:
The coverage is well-balanced between being comprehensive and maintainable. 2. Accurate Type SignaturesAfter reviewing the actual Ruby implementations, the RBS signatures accurately reflect the code:
3. Smart Use of Type AliasesThe
4. Good Infrastructure
5. Conservative Typing ApproachUsing 🔍 Observations & Suggestions1. Block Parameters (✅ Already Fixed)I noticed the PR correctly added block parameters to helper methods: def react_component: (
String component_name,
?Hash[Symbol, untyped] options
) ?{ () -> untyped } -> safe_bufferThis matches the actual implementation which yields in view code. Good catch! 2. Optional vs Required ParametersThe Configuration initialize method signatures correctly handle Ruby's keyword argument defaults:
3. Private Method CoverageThe inclusion of some private Configuration methods ( 📋 Testing & Quality ChecksVerification NeededPlease confirm that the following checks pass: # RBS validation
bundle exec rake rbs:validate
# RuboCop (as per CLAUDE.md requirements)
bundle exec rubocop
# Existing test suite
rake run_rspecAccording to the PR description, all these checks pass ✅ 🎯 Code Quality ComplianceCLAUDE.md Requirements
💡 Future Enhancements (Optional)These are not blockers for this PR, but could be considered for future work:
🔒 Security ConsiderationsNo security concerns - this is purely additive metadata that doesn't affect runtime behavior. 📊 Performance ConsiderationsZero performance impact:
🎉 Final VerdictLGTM with minor verification needed! This is a high-quality contribution that:
Before Merge Checklist
Great work on this enhancement! RBS adoption is growing in the Ruby community and this positions React on Rails well for teams that want type safety. Review generated following repository standards from CLAUDE.md 🤖 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
rakelib/rbs.rake (2)
7-8: Consider removing unnecessary requires.Since line 13 executes RBS validation in a subprocess via
bundle exec, the requires here aren't used. You can safely remove them to simplify the task.- require "rbs" - require "rbs/cli" - puts "Validating RBS type signatures..."
4-36: Excellent foundation for RBS validation.The tasks are well-structured with proper error handling and clear descriptions. The validate task directly supports the CI integration mentioned in the PR objectives.
Consider adding
rake rbs:validateto your CI pipeline as suggested in the PR comments. You might also explore runtime type checking in your test suite:#!/bin/bash # Add to CI configuration to validate RBS signatures bundle exec rake rbs:validate
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
rakelib/rbs.rake(1 hunks)sig/react_on_rails/configuration.rbs(1 hunks)sig/react_on_rails/controller.rbs(1 hunks)sig/react_on_rails/helper.rbs(1 hunks)sig/react_on_rails/utils.rbs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- sig/react_on_rails/controller.rbs
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
1. Pro version check in `run_stream_inside_fiber`
2. RSC support check during pack generation via `ReactOnRailsPro.configuration.enable_rsc_support`
3. RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. The `react_on_rails_pro?` method validates licenses and should raise errors early (including during path resolution in methods like `server_bundle?`) to enforce licensing requirements rather than failing later with obscure errors.
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1745
File: node_package/src/RSCRequestTracker.ts:8-14
Timestamp: 2025-07-08T05:57:29.630Z
Learning: The global `generateRSCPayload` function in React on Rails Pro (RORP) is provided by the framework during rendering requests, not implemented in application code. The `declare global` statements are used to document the expected interface that RORP will inject at runtime.
📚 Learning: 2025-02-13T16:50:26.861Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/turbolinksUtils.ts:34-36
Timestamp: 2025-02-13T16:50:26.861Z
Learning: In React on Rails, when checking for Turbolinks version 5 using `turbolinksVersion5()`, always ensure `Turbolinks` exists first by checking `turbolinksInstalled()` to prevent TypeError when accessing properties.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/helper.rbs
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
1. Pro version check in `run_stream_inside_fiber`
2. RSC support check during pack generation via `ReactOnRailsPro.configuration.enable_rsc_support`
3. RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/helper.rbssig/react_on_rails/configuration.rbs
📚 Learning: 2025-10-23T17:22:01.074Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. The `react_on_rails_pro?` method validates licenses and should raise errors early (including during path resolution in methods like `server_bundle?`) to enforce licensing requirements rather than failing later with obscure errors.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/helper.rbssig/react_on_rails/configuration.rbs
📚 Learning: 2025-09-15T21:24:48.207Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1781
File: node_package/src/ClientSideRenderer.ts:82-95
Timestamp: 2025-09-15T21:24:48.207Z
Learning: In React on Rails, the force_load feature includes both explicit `data-force-load="true"` usage and the ability to hydrate components during the page loading state (`document.readyState === 'loading'`). Both capabilities require a Pro license, so the condition `!railsContext.rorPro && (isComponentForceLoaded || document.readyState === 'loading')` correctly gates both scenarios.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/helper.rbssig/react_on_rails/configuration.rbs
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/helper.rbssig/react_on_rails/configuration.rbs
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/helper.rbssig/react_on_rails/configuration.rbs
📚 Learning: 2025-02-13T16:50:47.848Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/clientStartup.ts:18-21
Timestamp: 2025-02-13T16:50:47.848Z
Learning: In the react_on_rails module, the `reactOnRailsPageUnloaded` function in clientStartup.ts is intentionally kept private as it's only used internally as a callback for `onPageUnloaded`.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/helper.rbssig/react_on_rails/configuration.rbs
📚 Learning: 2024-10-08T20:53:47.076Z
Learnt from: theforestvn88
Repo: shakacode/react_on_rails PR: 1620
File: spec/dummy/client/app/startup/HelloTurboStream.jsx:3-3
Timestamp: 2024-10-08T20:53:47.076Z
Learning: The `RailsContext` import in `spec/dummy/client/app/startup/HelloTurboStream.jsx` is used later in the project, as clarified by the user theforestvn88.
Applied to files:
sig/react_on_rails/utils.rbs
📚 Learning: 2025-07-08T05:57:29.630Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1745
File: node_package/src/RSCRequestTracker.ts:8-14
Timestamp: 2025-07-08T05:57:29.630Z
Learning: The global `generateRSCPayload` function in React on Rails Pro (RORP) is provided by the framework during rendering requests, not implemented in application code. The `declare global` statements are used to document the expected interface that RORP will inject at runtime.
Applied to files:
sig/react_on_rails/utils.rbssig/react_on_rails/helper.rbssig/react_on_rails/configuration.rbs
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation is handled in deeper level calls of the React on Rails Pro codebase, so it doesn't need to be validated again in the `rsc_payload_react_component` helper method.
Applied to files:
sig/react_on_rails/helper.rbs
📚 Learning: 2025-04-09T12:56:10.756Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1696
File: node_package/src/RSCPayloadContainer.ts:0-0
Timestamp: 2025-04-09T12:56:10.756Z
Learning: In the react_on_rails codebase, RSC payloads are already stringified using `JSON.stringify()` before being processed by the `escapeScript` function, which handles escaping of special characters. The function only needs to handle specific HTML markers like comments and closing script tags.
Applied to files:
sig/react_on_rails/helper.rbs
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.
Applied to files:
sig/react_on_rails/helper.rbssig/react_on_rails/configuration.rbs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: build
- GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.2, 20, minimum)
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: rspec-package-tests (3.2, minimum)
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: lint-js-and-ruby
- GitHub Check: claude-review
- GitHub Check: markdown-link-check
🔇 Additional comments (3)
sig/react_on_rails/utils.rbs (1)
1-34: Well-designed utility signatures with appropriate conservatism.The signatures provide comprehensive coverage of the Utils module while using
untypedjudiciously for complex/dynamic values. This approach balances type safety with maintainability, exactly as outlined in the PR objectives.sig/react_on_rails/helper.rbs (1)
1-65: Clean helper signatures with proper block support.The type alias for
safe_bufferclearly documents the ActiveSupport::SafeBuffer contract, and the optional block parameters correctly reflect the helpers' ability to yield for cached props and inner HTML. The conservative typing of block returns asuntypedis appropriate given the dynamic nature of view helpers.sig/react_on_rails/configuration.rbs (1)
1-96: Comprehensive configuration signatures.The signatures thoroughly document the Configuration class's extensive API surface, including all accessors, initialization parameters, and validation methods. The nullable types and optional parameters appropriately reflect the configuration's flexibility.
## Summary Adds RBS type signatures for all error-related classes to complete type coverage for the gem. ## Changes Added RBS signatures for: - `ReactOnRails::Error` - Base error class - `ReactOnRails::JsonParseError` - JSON parsing error with context - `ReactOnRails::PrerenderError` - Server rendering error with detailed info - `ReactOnRails::SmartError` - Enhanced error with actionable suggestions ## Files Added - `sig/react_on_rails/error.rbs` - `sig/react_on_rails/json_parse_error.rbs` - `sig/react_on_rails/prerender_error.rbs` - `sig/react_on_rails/smart_error.rbs` ## Testing - RuboCop passes - RBS files follow existing patterns in the codebase - Type signatures match the actual implementations ## Related Fixes #1954 (follow-up to PR #1945) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/2004) <!-- Reviewable:end --> Co-authored-by: Claude <[email protected]>
## Summary Adds RBS type signatures for all error-related classes to complete type coverage for the gem. ## Changes Added RBS signatures for: - `ReactOnRails::Error` - Base error class - `ReactOnRails::JsonParseError` - JSON parsing error with context - `ReactOnRails::PrerenderError` - Server rendering error with detailed info - `ReactOnRails::SmartError` - Enhanced error with actionable suggestions ## Files Added - `sig/react_on_rails/error.rbs` - `sig/react_on_rails/json_parse_error.rbs` - `sig/react_on_rails/prerender_error.rbs` - `sig/react_on_rails/smart_error.rbs` ## Testing - RuboCop passes - RBS files follow existing patterns in the codebase - Type signatures match the actual implementations ## Related Fixes #1954 (follow-up to PR #1945) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/2004) <!-- Reviewable:end --> Co-authored-by: Claude <[email protected]>
## Summary Add comprehensive documentation about RBS type signatures to help contributors understand and use type checking. ## Changes - Created `docs/contributor-info/rbs-type-signatures.md` with detailed RBS documentation - Added reference to RBS docs in CONTRIBUTING.md - Removed previous top-level README section (per PR feedback) ## Documentation Includes - Benefits of RBS type signatures (better autocomplete, early error detection, improved documentation, refactoring safety) - IDE support information (Steep, Solargraph, RubyMine, VS Code) - Usage instructions for validation and listing type files - File structure and location information - Contributing guidelines for adding new signatures - Compatibility requirements and resources ## Context React on Rails includes comprehensive RBS type signatures (added in PR #1945), but this feature wasn't documented for contributors. This documentation is now properly positioned in the contributor-info directory. ## Testing - Verified formatting with Prettier (all checks pass) - Confirmed all pre-commit hooks pass - Verified sig/README.md exists and contains detailed RBS documentation - Confirmed rake tasks exist (rbs:validate, rbs:list) Fixes #1953 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1998) <!-- Reviewable:end --> --------- Co-authored-by: Claude <[email protected]>
## Summary This PR implements comprehensive RBS type checking for both the main gem and Pro package as a follow-up to #1945. ### Changes 1. **CI Integration** - Added `rake rbs:validate` to main lint workflow - Added RBS validation to Pro gem lint workflow - Added Steep static type checker to CI pipeline 2. **Runtime Type Checking** - Configured RSpec to run with RBS runtime checking for gem tests - Tests now run with `RBS_TEST_TARGET='ReactOnRails::*' RUBYOPT='-rrbs/test/setup'` - Provides runtime validation of type signatures during test execution 3. **Steep Static Type Checker** - Added steep gem to development dependencies - Created Steepfile configuration for static type analysis - Added `rake rbs:steep` task for running static type checks - Added `rake rbs:all` task to run both validation and steep checks 4. **Pro Gem RBS Types** - Created sig/ directory structure for Pro gem - Added type signatures for: - ReactOnRailsPro module - Configuration class with all attributes - Error, Cache, and Utils modules - Foundation for expanding type coverage in Pro package ### Implementation Details This PR follows best practices from Evil Martians' ["Climbing Steep Hills"](https://evilmartians.com/chronicles/climbing-steep-hills-or-adopting-ruby-types) article: - Static validation with `rbs validate` - Runtime checking with `rbs/test/setup` - Static analysis with Steep The combination of these three approaches provides comprehensive type safety: - **Validation**: Ensures RBS signatures are syntactically correct and internally consistent - **Runtime checking**: Verifies actual method calls match their signatures during tests - **Static analysis**: Catches type errors in Ruby code without running it ### Test Plan - [x] RBS validation passes locally - [x] RuboCop passes - [x] All files properly formatted - [ ] CI validates RBS signatures - [ ] CI runs Steep checks 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1950) <!-- Reviewable:end --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * CI now validates RBS type signatures during linting; an optional Steep check is present but disabled by default. * Development/test dependencies added to support RBS/type-checking tooling. * Rake tasks added to run/validate/list RBS checks and to run Steep; test tasks can enable runtime RBS checks when available. * Lint config updated to exclude the type-checker config file from filename checks. * **Documentation** * Added comprehensive guidance on RBS/Steep usage, runtime type-checking, and reproducing CI checks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <[email protected]>
Summary
This PR adds comprehensive RBS (Ruby Signature) type definitions for the React on Rails gem to improve type safety, IDE support, and developer experience.
What is RBS?
RBS is Ruby's official type signature language that provides type information for Ruby code. It enables:
Changes
Type Signatures Added
Infrastructure
sig/directory with organized type signaturesrake rbs:validate- Validate type signaturesrake rbs:check- Alias for validaterake rbs:list- List all RBS filessig/directoryBenefits
Testing
bundle exec rbs -I sig validateAdditional Notes
The RBS signatures cover the main public API of the gem. Internal methods and private APIs have minimal signatures to reduce maintenance burden while still providing value to gem users.
Type signatures use conservative types (
untypedfor complex hashes) where the actual types are highly dynamic to avoid over-constraining the API.🤖 Generated with Claude Code
This change is
Summary by CodeRabbit