-
-
Notifications
You must be signed in to change notification settings - Fork 638
RBS: Narrow type signatures for props parameters #1966
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
|
Warning Rate limit exceeded@justin808 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 18 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
✨ 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 for PR #1966SummaryThis PR improves RBS type precision for props parameters by narrowing the type from ✅ Positives
🔍 Considerations & Questions
🧪 Testing AssessmentCoverage: ✅ Excellent Existing test coverage validates the type changes:
Recommendation: No new tests needed - existing coverage is comprehensive. 🔒 Security✅ No security concerns. The change only affects type checking, not runtime behavior. ⚡ Performance✅ Zero performance impact - RBS signatures are for static analysis only. 📝 DocumentationSuggestion: Consider adding a brief comment in the RBS files explaining the dual Hash/String acceptance: # Props can be a Hash (converted to JSON) or pre-serialized JSON String
def sanitized_props_string: (Hash[Symbol, untyped] | String props) -> StringThough this is optional, as the implementation is self-documenting. ✅ Final VerdictLGTM with one minor question about the Hash key type. This is a solid improvement that makes the type signatures more precise while accurately reflecting the runtime behavior. Recommendation: ✅ Approve after clarifying the Hash key type question (Symbol vs Symbol | String) Great work on improving type safety! 🎉 |
Code Review - PR #1966: RBS Type Signature ImprovementsSummaryThis PR successfully narrows the type signatures for ✅ Strengths1. Accurate Type Signatures
2. Improved Developer Experience
3. Clean Implementation
🔍 Technical AnalysisType Accuracy:
Potential Edge Case:
📋 Best Practices CompliancePer CLAUDE.md requirements:
💡 Suggestions (Optional)1. Consider Adding RBS Comment Documentation # Props can be either:
# - A Hash with Symbol keys (common case)
# - A JSON string representation (for pre-serialized data)
def sanitized_props_string: (Hash[Symbol, untyped] | String props) -> String2. Future Enhancement: Union Type for Controller Props 🎯 VerdictRecommendation: ✅ APPROVE This is a high-quality, low-risk improvement that:
No changes required. Ready to merge. 📚 References
|
Code Review: RBS Type Signature ImprovementsSummaryThis PR narrows the type signatures for props parameters from ✅ Strengths
🔍 Observations
📝 RecommendationsMinor Issue: Consider updating def redux_store: (
String store_name,
?props: Hash[Symbol, untyped] | String,
?defer: bool,
?immediate_hydration: bool
) -> safe_bufferCurrently it's still typed as just ✅ VerdictApproved with minor suggestion. The changes are correct and improve type safety. The only improvement would be ensuring consistency across all Test Coverage: ✅ Existing tests verify both Hash and String inputs |
Improve type precision for props parameters in RBS signatures by changing from `untyped` to `Hash[Symbol, untyped] | String`. This change: - Provides better type checking for props parameters - Accepts both common formats (Hash or JSON string) - Improves IDE support and autocomplete - Helps catch type errors earlier Updated signatures: - helper.rbs: sanitized_props_string props parameter - controller.rbs: redux_store props parameter Fixes #1951 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
df453d6 to
610fdd3
Compare
PR Review: RBS Type Signature Improvements for Props ParametersSummaryThis PR successfully narrows the type signatures for props parameters from ✅ Strengths
🔍 Observations
🎯 RecommendationsNone - this PR is ready to merge! The changes are:
📋 Testing NotesPer the PR description, the mandatory checks have passed:
🎉 ConclusionThis is a clean, straightforward improvement that enhances type safety without breaking existing functionality. The type signatures now accurately document the API contract and will provide better IDE support and earlier error detection for users of the gem. Recommendation: Approve and merge ✅ Review generated with Claude Code |
Summary
Improves type precision for props parameters in RBS signatures by changing from
untypedtoHash[Symbol, untyped] | String.Changes
sanitized_props_stringprops parameter typeredux_storeprops parameter typeBenefits
Testing
bundle exec rubocoppasses with no violationsFixes #1951
🤖 Generated with Claude Code
This change is