Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances SupportTableData’s generated developer tooling artifacts by (1) making YARD output more scalable/readable via macros, (2) improving documentation/RBS type accuracy via ActiveRecord column type inference with a clearer failure mode, and (3) adding opt-in per-model RBS signature generation and tasks, alongside an autoload-based loading strategy.
Changes:
- Generate compact
@!macro-based YARD docs above a configurable named-instance threshold; infer attribute helper return types from AR column types. - Add RBS signature generation (
sig/.../*.rbs) via new documentation classes and rake tasks (add/verify/remove), plus supporting utilities. - Refactor loading to use
autoload; update tests, README/CHANGELOG, and bump version to 1.6.0.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| VERSION | Bumps gem version to 1.6.0. |
| test_app/app/models/status.rb | Updates generated YARD return types from Object to String. |
| support_table_data.gemspec | Excludes test_app/ from packaged gem files. |
| spec/tasks_spec.rb | Updates task specs and adds coverage for new RBS tasks. |
| spec/support_table_data/documentation/yard_doc_spec.rb | Adds tests for type inference and compact macro YARD output. |
| spec/support_table_data/documentation/type_inference_spec.rb | Adds unit tests for column type inference and mappings. |
| spec/support_table_data/documentation/rbs_file_spec.rb | Adds tests for writing/removing/up-to-date checks for RBS files. |
| spec/support_table_data/documentation/rbs_doc_spec.rb | Adds tests for generated per-model RBS signature content. |
| spec/support_table_data_spec.rb | Switches to require "spec_helper". |
| spec/spec_helper.rb | Relies on autoload (removes explicit documentation require). |
| README.md | Documents compact YARD output, type inference behavior, and RBS generation tasks. |
| lib/tasks/support_table_data.rake | Removes explicit requires; adds RBS rake tasks and task alias. |
| lib/support_table_data/tasks/utils.rb | Adds helper to enumerate per-model RBS file handlers. |
| lib/support_table_data/tasks.rb | Introduces SupportTableData::Tasks autoload shim. |
| lib/support_table_data/documentation/yard_doc.rb | Implements compact macro YARD generation + typed attribute helper docs. |
| lib/support_table_data/documentation/type_inference.rb | Adds type inference and YARD/RBS type mapping utilities. |
| lib/support_table_data/documentation/rbs_file.rb | Adds per-model RBS file pathing and read/write/remove logic. |
| lib/support_table_data/documentation/rbs_doc.rb | Generates RBS signatures for named instance helpers. |
| lib/support_table_data/documentation.rb | Switches documentation components to autoload. |
| lib/support_table_data/documentation_connection_error.rb | Adds a clearer error for type-inference DB failures. |
| lib/support_table_data.rb | Adds config accessors/defaults + autoload for new components. |
| CHANGELOG.md | Documents the 1.6.0 changes. |
Comments suppressed due to low confidence (1)
lib/support_table_data/tasks/utils.rb:62
support_table_rbs_filesforwardsfile_pathtosupport_table_sources, which currently doesrequire_relative file_pathwhen a path is provided. If callers pass a project-relative path likeapp/models/feature.rb(as shown in the README),require_relativewill resolve it relative tolib/support_table_data/tasks/utils.rband likely raiseLoadError. Consider changingsupport_table_sourcesto require the expanded path (or skip requiring entirely sinceeager_load!should already load models).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each model can now choose how its YARD docs are generated by setting
self.support_table_yard_docsto:full(the default — verbose comment block per method),:compact(shared@!macrodefinitions plus a short@!method/@!macropair per method, dramatically reducing comment-block size on tables with many named instances), or:none(skip generation entirely; previously generated docs are stripped on the next run). IDEs andyard docresolve the compact form into the same per-method documentation as the verbose form.Attribute helper return types in the generated YARD and RBS docs are now inferred per method by inspecting the value the helper actually returns (
String,Integer,Boolean, etc.) instead of the genericObject/untyped. Because the helpers return frozen literals from the parsed data file, the documentation tasks no longer require a database connection.Added opt-in RBS signature generation. The new tasks
support_table_data:rbs,support_table_data:rbs:verify, andsupport_table_data:rbs:removewrite/check/deletesig/<model_path>.rbsfiles so the named instance helpers are visible to Ruby LSP, Steep, RubyMine, and other RBS-aware tools without polluting the model source files. The output directory can be overridden withSupportTableData.rbs_signatures_path.