Commit becae3b
authored
RPC: gate BatchVisit by remote getLanguages (#7553)
Without this, every SourceFile in a repository was being shipped to the
remote during a batched RPC recipe run, even types the remote has no
codec for. The remote then crashed deserializing them, and the resulting
exception was attached to the source as a `Markup.Error` marker — falsely
reporting the file as `MODIFY` and causing the Python migration recipes
to "touch" every yaml/Dockerfile/license/README in the workspace.
Three fixes that ship together:
* `RecipeRunCycle.editSource` now consults `currentRpc.getLanguages()`
before adding a recipe to the batch, mirroring the `isAcceptable` gate
the non-batched path already had.
* `rewrite/rpc/server.py` validates with `_require_tree(...)` after every
`get_object_from_java(...)` in `handle_visit` / `handle_batch_visit`.
When the receiver has no codec for a top-level type it falls back to
a `{"kind": value_type, ...}` dict; that dict was leaking into the
visitor framework and crashing with `AttributeError: 'dict' object
has no attribute 'is_acceptable'`. The guard now raises the same
canonical "No RPC codec registered" error the ADD path raises, so the
failure mode is consistent regardless of which RPC message shape the
remote used.
* `RewriteRpc`'s `GetLanguages` handler used to advertise only
`PlainText`, `Json$Document`, `J$CompilationUnit`, and
`JS$CompilationUnit`. Java actually has receivers for every standard
format (Yaml, Xml, Hcl, Properties, Toml, Protobuf, Docker) and every
language compilation unit (J, JS, K, G, Cs, Py, Go, S). The handler
now lists all of them, each gated by `ifOnClasspath` so the advertised
set still narrows to whichever rewrite-* modules are actually loaded.1 parent a731874 commit becae3b
5 files changed
Lines changed: 109 additions & 8 deletions
File tree
- rewrite-core/src
- main/java/org/openrewrite
- rpc
- scheduling
- test/java/org/openrewrite/rpc
- rewrite-python/rewrite
- src/rewrite/rpc
- tests/rpc
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
182 | 194 | | |
183 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
184 | 202 | | |
185 | 203 | | |
186 | 204 | | |
| |||
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
336 | 343 | | |
337 | | - | |
338 | 344 | | |
339 | 345 | | |
340 | 346 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
454 | 483 | | |
455 | 484 | | |
456 | 485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
140 | 163 | | |
141 | 164 | | |
142 | 165 | | |
| |||
1199 | 1222 | | |
1200 | 1223 | | |
1201 | 1224 | | |
| 1225 | + | |
| 1226 | + | |
1202 | 1227 | | |
1203 | 1228 | | |
1204 | 1229 | | |
| |||
1272 | 1297 | | |
1273 | 1298 | | |
1274 | 1299 | | |
| 1300 | + | |
| 1301 | + | |
1275 | 1302 | | |
1276 | 1303 | | |
1277 | 1304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
1 | 22 | | |
2 | 23 | | |
3 | 24 | | |
| |||
0 commit comments