feat(handlers): expose sync_catalogs through sales-catalog-driven specialism#790
feat(handlers): expose sync_catalogs through sales-catalog-driven specialism#790bokelley wants to merge 2 commits into
Conversation
| (ergonomic form) or a fully-shaped | ||
| :class:`~adcp.types.SyncCatalogsSuccessResponse`. | ||
| """ | ||
| ... |
|
Triage status: useful feature candidate, but this PR is conflicting with main and has maintainer edits disabled, so I cannot update it in place. Also note the source issue #786 was closed earlier from the wrong signals premise and later re-triaged as a real catalog-driven specialism gap. Recommended path: author rebases, or we re-cut from current main if we want to proceed. |
6098ae2 to
4324ef9
Compare
|
Rebased onto current One conflict resolved: Post-rebase verification:
Branch is now at Triaged by Claude Code. Session: https://claude.ai/code/session_01WfCNbekqBBmXgoGtVokFyT Generated by Claude Code |
…cialism Wires the sync_catalogs tool (available in types since 5.6.0) into the DecisioningPlatform advertisement and dispatch path for sales-catalog-driven platforms. Previously the tool was unreachable: SPECIALISM_TO_ADVERTISED_TOOLS had no mapping for it and PlatformHandler had no shim. Closes #786 https://claude.ai/code/session_01RHG8jmrXLEyLjwaLTZHSi5
4324ef9 to
20258e3
Compare
sync_catalogs is required for sales-catalog-driven (enforced at boot by
validate_platform) rather than optional. Listing it in _OPTIONAL_PLATFORM_METHODS
was semantically misleading and could confuse a future reviewer or pass
adding it to a future validation gate that suppresses the boot-fail.
The _require_platform_method("sync_catalogs") guard in the shim correctly
surfaces UNSUPPORTED_FEATURE for non-catalog-driven callers via hasattr —
it does not depend on _OPTIONAL_PLATFORM_METHODS.
https://claude.ai/code/session_01RHG8jmrXLEyLjwaLTZHSi5
Summary
Closes #786
Re-cut from current main (resolves conflict from the original PR #790 which was rebased from an older base).
sync_catalogsintoSPECIALISM_TO_ADVERTISED_TOOLSsosales-catalog-drivenplatforms expose the tool viatools/listPlatformHandler.sync_catalogsdispatcher — fullSyncCatalogsRequestpassed through (noarg_projector) so adopters can inspectreq.delete_missing,req.dry_run,req.validation_mode, andreq.catalog_idssync_catalogstoSalesPlatformProtocol body under thesales-catalog-driven-required section_require_platform_method("sync_catalogs")guard →UNSUPPORTED_FEATURE(notINTERNAL_ERROR) when a non-catalog-driven platform receives the calldispatch.py'sREQUIRED_METHODS_PER_SPECIALISM["sales-catalog-driven"]already includedsync_catalogson main — the boot-fail gate was pre-existingNote:
sync_catalogsis on the unifiedSalesPlatformProtocol body (not a separate mixin), which means@runtime_checkable isinstance(x, SalesPlatform)checks require it on allsales-*adopters.validate_platformenforces it only forsales-catalog-driven. This is a deliberate tradeoff over aSalesCatalogDrivenPlatformmixin — the existing pattern for sales tools is unified (SalesPlatform), and a mixin would be the only exception.Test plan
test_validate_platform_raises_on_catalog_driven_without_sync_catalogs— boot-fail whensales-catalog-drivenis claimed withoutsync_catalogstest_catalog_driven_advertises_sync_catalogs—tools/listincludessync_catalogsforsales-catalog-driventest_non_catalog_sales_does_not_advertise_sync_catalogs—tools/listexcludessync_catalogsforsales-non-guaranteedtest_sync_catalogs_shim_passes_full_request_to_platform— full request object threaded through (no projection)test_sync_catalogs_discovery_mode_passes_none_catalogs—req.catalogs=Nonethreads through intacttest_sync_catalogs_list_return_projected_to_envelope— ergonomic list return projected to{catalogs: [...]}test_sync_catalogs_unsupported_when_platform_lacks_method—UNSUPPORTED_FEATUREon non-catalog-driven platformtest_project_sync_catalogs_wraps_pydantic_row_listtest_project_sync_catalogs_wraps_plain_dict_row_listtest_project_sync_catalogs_passthrough_envelope_dicttest_project_sync_catalogs_passthrough_non_listtest_advertised_tools_covers_every_specialism_wire_tool— universe includessync_catalogstest_sales_platform_protocol_still_runtime_checkable—@runtime_checkablecheck updated4325 passed, 18 skipped, 1 xfailed. Ruff and mypy clean.
What tested
pytest tests/ -x -q— 4325 passedmypy src/adcp/decisioning/handler.py src/adcp/decisioning/specialisms/sales.py— no issuesruff check src/adcp/decisioning/handler.py src/adcp/decisioning/specialisms/sales.py— all checks passedPre-PR review
sync_catalogsin_OPTIONAL_PLATFORM_METHODSas semantically misleading (a required method shouldn't be in the optional set); fixed in commit 2934122 by removing it. Nit:_project_sync_catalogsasymmetry with_project_sync_audiencesarg_projector documented in shim docstring.@runtime_checkablestructural consequence noted in PR body above.Session: https://claude.ai/code/session_01RHG8jmrXLEyLjwaLTZHSi5