Commit 37dd255
authored
Clarify RSC client references rewrite flow (#3458)
## Summary
- Split RSC client-reference setup preparation from the read-only
rewrite-needed predicate.
- Make `rsc_plugin_sections_safe_to_rewrite?` explicitly file-wide by
removing the misleading `is_server:` keyword.
- Add generator specs for both no-file-write predicate branches and the
target-independent safety check.
Fixes #3434.
## Test plan
- `bundle exec rspec
react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb:2051
react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb:2116
react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb:2148`
- `bundle exec rspec
react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb`
- `(cd react_on_rails && bundle exec rubocop)`
## Notes
- No changelog entry: this is an internal generator maintainability
cleanup with behavior intended to stay unchanged.
- Addressed all Claude optional review comments in follow-up commit
`2c6074c6a`.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Refactored RSC setup logic to separate preparation/ensuring from the
rewrite-decision step and simplified the safety-check behavior.
* **Tests**
* Added coverage verifying the new predicate does not modify files and
validates both rewrite-needed outcomes.
Note: Internal changes only; no user-facing impact.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/shakacode/react_on_rails/pull/3458?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent a2c74f6 commit 37dd255
2 files changed
Lines changed: 68 additions & 12 deletions
File tree
- react_on_rails
- lib/generators/react_on_rails/rsc_setup
- spec/react_on_rails/generators
Lines changed: 16 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 139 | + | |
142 | 140 | | |
143 | 141 | | |
144 | 142 | | |
145 | 143 | | |
146 | 144 | | |
147 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
152 | | - | |
153 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
154 | 159 | | |
155 | 160 | | |
156 | 161 | | |
| |||
Lines changed: 52 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2069 | 2069 | | |
2070 | 2070 | | |
2071 | 2071 | | |
2072 | | - | |
| 2072 | + | |
2073 | 2073 | | |
2074 | 2074 | | |
2075 | 2075 | | |
| |||
2113 | 2113 | | |
2114 | 2114 | | |
2115 | 2115 | | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
2116 | 2167 | | |
2117 | 2168 | | |
2118 | 2169 | | |
| |||
0 commit comments