feat(decisioning): advertise_all kwarg + handler.get_advertised_tools#529
Merged
Conversation
…#519) Surfaces ``advertise_all`` on ``create_adcp_server_from_platform`` for parity with ``serve()``, and adds a ``handler.get_advertised_tools()`` inspection method that returns the same set ``tools/list`` would emit at serve time — without standing up a network port. Salesagent migration feedback #14: a fresh ``MockSellerPlatform`` (5 methods) shows ~50 entries in ``handler.advertised_tools`` (the class-level universe) but only ~10 actually advertise on the wire after the per-instance specialism filter. The new method makes the effective set readable from the handler instance directly, with the ``advertise_all`` flag controllable at factory time and overridable per-call. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a test that constructs a handler with advertise_all=False and verifies passing advertise_all=True on the method call returns a wider set than the call without the override. Closes the only branch in the method body not previously covered. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #519.
Summary
advertise_all: bool = Falsekwarg tocreate_adcp_server_from_platform(matching the existing flag onserve()).handler.get_advertised_tools(advertise_all=None) -> frozenset[str]— returns the same settools/listemits at serve time. Default reads the configuredadvertise_all; the kwarg lets adopters override per-call.serve()→create_adcp_server_from_platform→PlatformHandler.__init__, stored on the instance as_advertise_all.Why
Salesagent migration feedback (item #14): a fresh
MockSellerPlatformwith 5 implemented methods shows ~50 entries inhandler.advertised_tools(the class-level universe). Buyers see only the per-specialism intersection (~10 entries for sales-only). Adopters had no way to inspect that effective set without standing up a real server.Test plan
test_decisioning_serve.py:frozensetadvertise_all=Trueat factory time stores on handlerFalse, matchingserve()test_decisioning_serve.py + handler.py + handler_shims.pysuite — 106 passedruff,mypycleanNotes for reviewers
The
_is_method_overriddenfilter is essentially a no-op forPlatformHandlersubclasses — the base class shims technically "override" every spec method, so the override detection returns True for all of them. The real shrink (~50 → ~10) comes fromadvertised_tools_for_instance(specialism intersection), whichget_advertised_toolsincludes viaget_tools_for_handler. Tests assert the size shrink rather than specific override-vs-not entries, since the practical filter is the specialism one.🤖 Generated with Claude Code