Repository navigation
Commit fcfee67
test(server): rewrite spec_compat tests against public API (#657)
Closes #653. The previous tests in tests/test_spec_compat_hooks.py
reached into private helpers (_hook_get_products, _make_sync_creatives_hook,
_coerce_asset, _infer_asset_type) and asserted on internal shapes, which
hid a class of bugs the public surface would expose.
Changes:
- All tests now exercise spec_compat_hooks() and the returned dict only.
No private imports.
- Add four model_validate() proofs that hook output is actually 4.4-valid:
one for get_products (buying_mode default), three for sync_creatives
(format_id wrap, asset_type inference, image→url demotion). Failure
here means the hook is producing dicts that pass our internal asserts
but fail at the dispatcher boundary.
- Expand the create_tool_caller integration suite from one buying_mode
smoke test to four end-to-end paths: get_products default, sync_creatives
format_id wrap, asset_type inference, image→url demotion.
- spec_compat_hooks(exclude={...}) now emits a UserWarning for unknown
hook names (typos like "sync_creative" used to silently leave the hook
active). Document the behaviour in the factory's exclude= section.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1b4f3e0 commit fcfee67
2 files changed
Lines changed: 509 additions & 137 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
| |||
119 | 127 | | |
120 | 128 | | |
121 | 129 | | |
122 | | - | |
123 | | - | |
124 | | - | |
| 130 | + | |
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
| |||
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
224 | 231 | | |
225 | 232 | | |
226 | 233 | | |
| |||
231 | 238 | | |
232 | 239 | | |
233 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
234 | 251 | | |
235 | 252 | | |
236 | 253 | | |
| |||
0 commit comments