Commit c1b532e
fix(schema): stop an unresolvable $ref silently disabling verb validation
`validateVerb('connect', {to, zzz_not_a_real_key})` returned
`{"valid":true,"errors":[]}` — a config nobody validated came back clean.
The bundled schema.json holds exactly one non-local `$ref`:
`$defs/SWMLAction.SWML -> "SWMLObject.json"`, a sibling spec file that is not
bundled. Ajv resolves refs EAGERLY, so compiling any verb whose `$defs` subtree
reaches `SWMLAction` threw `can't resolve reference SWMLObject.json from id #`.
`getVerbValidator`'s bare `catch` swallowed that and returned null, and
`validateVerb` then fell through to `validateVerbLightweight`, which only checks
required props — so a COMPILE FAILURE read as a PASS.
The blast radius was never just `connect`: 8 of 39 verbs degraded this way, all
via `... -> Action -> SWMLAction -> SWMLObject.json` —
ai, ai_sidecar, amazon_bedrock, cond, connect, execute, join_conference, switch.
Two independent fixes:
1. Ref policy (the root). Register a permissive placeholder for the schema's
unbundled external ref on our own Ajv instance, so the ref RESOLVES and
compilation succeeds. Every other constraint — crucially the
`unevaluatedProperties` closure that rejects unknown keys — is then enforced
normally; only the nested `SWML` payload goes unchecked. This is exactly how
go's santhosh-tekuri validator already behaves, which is why go never showed
the symptom. schema.json is NOT modified, vendored, or reinterpreted.
2. Loud degradation (the backstop). A compile failure is now recorded and
reported as an error instead of falling through to the permissive lightweight
check, so validation that did not happen can never again read as `valid:true`.
New `compileFailedVerbs` / `precompileVerbValidators()` make the condition
observable rather than silent.
Both directions covered by 9 regression tests: a forbidden key is rejected and a
legitimate config still passes on each of the 8 verbs, and the guard is proven by
reinstating the pre-fix Ajv instance and asserting a refusal rather than a pass.
Negative-controlled — with the ref policy disabled, 9 of them fail.
Full suite: 133 files / 2835 tests passed. SURFACE's DRIFT/SURFACE-FRESH/
SURFACE-DIFF failures reproduce identically on clean main and are unrelated.
Supplying the real SWMLObject.json remains an owner-held schema-artifact change
(held under #223); afterwards the placeholder in UNBUNDLED_EXTERNAL_REFS can be
dropped and the nested SWML payload becomes fully validated too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PbNcuqH8o9WEoEnT24q4wB1 parent 0e9c9bf commit c1b532e
2 files changed
Lines changed: 212 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
13 | 46 | | |
14 | 47 | | |
15 | 48 | | |
| |||
143 | 176 | | |
144 | 177 | | |
145 | 178 | | |
146 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
147 | 183 | | |
148 | 184 | | |
149 | 185 | | |
| |||
181 | 217 | | |
182 | 218 | | |
183 | 219 | | |
| 220 | + | |
184 | 221 | | |
185 | 222 | | |
186 | 223 | | |
| |||
251 | 288 | | |
252 | 289 | | |
253 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
254 | 322 | | |
255 | 323 | | |
256 | 324 | | |
| |||
388 | 456 | | |
389 | 457 | | |
390 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
391 | 477 | | |
392 | 478 | | |
393 | 479 | | |
| |||
397 | 483 | | |
398 | 484 | | |
399 | 485 | | |
400 | | - | |
| 486 | + | |
401 | 487 | | |
402 | 488 | | |
403 | 489 | | |
| |||
411 | 497 | | |
412 | 498 | | |
413 | 499 | | |
414 | | - | |
| 500 | + | |
415 | 501 | | |
416 | 502 | | |
417 | 503 | | |
418 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
419 | 518 | | |
420 | 519 | | |
421 | 520 | | |
| |||
444 | 543 | | |
445 | 544 | | |
446 | 545 | | |
447 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
448 | 555 | | |
| 556 | + | |
449 | 557 | | |
450 | 558 | | |
451 | 559 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
34 | 51 | | |
35 | 52 | | |
36 | 53 | | |
| |||
330 | 347 | | |
331 | 348 | | |
332 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
333 | 433 | | |
334 | 434 | | |
335 | 435 | | |
| |||
0 commit comments