Title: test(server): refactor spec_compat_hooks tests to use public API · Issue #653 · adcontextprotocol/adcp-client-python · GitHub
Open Graph Title: test(server): refactor spec_compat_hooks tests to use public API · Issue #653 · adcontextprotocol/adcp-client-python
X Title: test(server): refactor spec_compat_hooks tests to use public API · Issue #653 · adcontextprotocol/adcp-client-python
Description: Follow-up to #646 / PR #648. The tests in tests/test_spec_compat_hooks.py (added in PR #648) reach into private helpers (_hook_get_products, _infer_asset_type, _coerce_asset, _make_sync_creatives_hook) and assert on internal shapes. Per ...
Open Graph Description: Follow-up to #646 / PR #648. The tests in tests/test_spec_compat_hooks.py (added in PR #648) reach into private helpers (_hook_get_products, _infer_asset_type, _coerce_asset, _make_sync_creatives_h...
X Description: Follow-up to #646 / PR #648. The tests in tests/test_spec_compat_hooks.py (added in PR #648) reach into private helpers (_hook_get_products, _infer_asset_type, _coerce_asset, _make_sync_creatives_h...
Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/653
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test(server): refactor spec_compat_hooks tests to use public API","articleBody":"Follow-up to #646 / PR #648.\n\nThe tests in `tests/test_spec_compat_hooks.py` (added in PR #648) reach into private helpers (`_hook_get_products`, `_infer_asset_type`, `_coerce_asset`, `_make_sync_creatives_hook`) and assert on internal shapes. Per CLAUDE.md the testing contract is:\n\n- **Test what you import** — call the public API, not internals.\n- **Validate with `.model_validate()`** — prove hook output is actually 4.4-schema-valid by feeding it through the generated `SyncCreativesRequest` / `GetProductsRequest` models from `adcp.types`.\n\n### Scope\n\n1. Rewrite assertions to go through `spec_compat_hooks()` + the published hook dict surface (e.g. via `create_tool_caller` with the hooks installed), not the private helpers.\n2. Add at least one test that runs the coerced `sync_creatives` payload through `SyncCreativesRequest.model_validate()` and asserts no `ValidationError`.\n3. Expand the `create_tool_caller` integration test (currently only checks the `buying_mode` default on get_products) to exercise the harder paths:\n - `format_id` wrap (string → object)\n - `asset_type` inference for unknown assets\n - `image` → `url` demotion through the actual `sync_creatives` tool path\n4. Optional: emit a `warnings.warn` when `exclude=` contains a name not in the canonical set, so typos like `exclude={\"sync_creative\"}` don't silently leave the hook active.\n\n### Why not block PR #648 on this\n\nThe implementation in `src/adcp/server/spec_compat.py` is correct and matches the spec table from #646. The current tests do exercise every code path (just at the wrong level); regression coverage is real. Splitting the test refactor out keeps the feature shippable.","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-11T07:15:20Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/653"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7cc24a63-b089-6e09-6e76-c0cc57a35f77 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBF4:5D487:BD6E1:FDBA7:6B018483 |
| html-safe-nonce | be7e570cb90ebcfebda59fb40acdddcc93e4b1be4ad3dab444cab247444c0453 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkY0OjVENDg3OkJENkUxOkZEQkE3OjZCMDE4NDgzIiwidmlzaXRvcl9pZCI6Ijg5MTUzNzAzODYxNDE1NzgzNzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3907f3485bdd642455d4040c8c4462c5773b020af3a53345bd0f8a9abb644d32 |
| hovercard-subject-tag | issue:4418818321 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/653/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e7a9ac6c56aae6bb540c870e7b52c761db045316f29750e6e692c40736fedb08/adcontextprotocol/adcp-client-python/issues/653 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e7a9ac6c56aae6bb540c870e7b52c761db045316f29750e6e692c40736fedb08/adcontextprotocol/adcp-client-python/issues/653 |
| og:image:alt | Follow-up to #646 / PR #648. The tests in tests/test_spec_compat_hooks.py (added in PR #648) reach into private helpers (_hook_get_products, _infer_asset_type, _coerce_asset, _make_sync_creatives_h... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bokelley |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git |
| octolytics-dimension-user_id | 221690821 |
| octolytics-dimension-user_login | adcontextprotocol |
| octolytics-dimension-repository_id | 1090305973 |
| octolytics-dimension-repository_nwo | adcontextprotocol/adcp-client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1090305973 |
| octolytics-dimension-repository_network_root_nwo | adcontextprotocol/adcp-client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width