Commit ac550eb
committed
Address Copilot review on #16
Five fixes from the Copilot reviewer pass:
1. build_layout: validate loaded resource is a Theme before assigning to
node.theme. A non-Theme resource path (e.g. a .tres StandardMaterial3D)
now errors with INVALID_PARAMS instead of silently failing at runtime.
2. build_layout _apply_property: when Color/Vector2/Vector2i/NodePath
coercion fails, return INVALID_PARAMS instead of silently passing the
raw value through to node.set(). _coerce_for_type now returns
{"ok": bool, "value": ...} so failures are explicit.
3. create_theme overwritten: captured pre-save existence flag instead of
computing it post-save (which was always true when overwrite=true).
4. _validate_res_path: accepts a param_name (default "theme_path") so
create_theme reports "Missing required param: path" rather than
"theme_path". Applies the name uniformly across all three validation
branches.
5. _set_scalar: reject null value explicitly with a clear error message.
Previously a null payload slipped past the parser failure check and
reached Theme.set_color(null) / equivalent.
Adds GDScript regression tests for:
- theme: null-value rejection, overwritten-flag accuracy on first vs
second create, param-name-aware missing-path error
- build_layout: non-Theme resource rejection, uncoercible property
rejection1 parent acf169c commit ac550eb
4 files changed
Lines changed: 120 additions & 26 deletions
File tree
- plugin/addons/godot_ai/handlers
- test_project/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
54 | | - | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
121 | 130 | | |
122 | 131 | | |
123 | 132 | | |
| |||
331 | 340 | | |
332 | 341 | | |
333 | 342 | | |
334 | | - | |
| 343 | + | |
335 | 344 | | |
336 | | - | |
| 345 | + | |
337 | 346 | | |
338 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
339 | 351 | | |
340 | 352 | | |
341 | 353 | | |
342 | | - | |
| 354 | + | |
343 | 355 | | |
344 | 356 | | |
345 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
243 | | - | |
| 246 | + | |
244 | 247 | | |
245 | 248 | | |
246 | 249 | | |
| |||
292 | 295 | | |
293 | 296 | | |
294 | 297 | | |
295 | | - | |
296 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
297 | 307 | | |
298 | 308 | | |
299 | 309 | | |
300 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
301 | 315 | | |
302 | 316 | | |
303 | 317 | | |
304 | | - | |
| 318 | + | |
305 | 319 | | |
306 | 320 | | |
307 | 321 | | |
308 | 322 | | |
309 | | - | |
| 323 | + | |
| 324 | + | |
310 | 325 | | |
311 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
312 | 331 | | |
313 | 332 | | |
314 | | - | |
| 333 | + | |
315 | 334 | | |
316 | | - | |
| 335 | + | |
317 | 336 | | |
318 | | - | |
| 337 | + | |
| 338 | + | |
319 | 339 | | |
320 | 340 | | |
321 | | - | |
| 341 | + | |
322 | 342 | | |
323 | | - | |
| 343 | + | |
324 | 344 | | |
325 | | - | |
| 345 | + | |
| 346 | + | |
326 | 347 | | |
327 | 348 | | |
328 | | - | |
| 349 | + | |
329 | 350 | | |
330 | | - | |
331 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
0 commit comments