Conversation
…ng, and add routing tests - dispatcher: track handler tasks in a set to prevent GC mid-execution and log unhandled exceptions via done callbacks - base: add handler_tasks set, pass it to dispatch_to_handlers, cancel all handler tasks on stop() - load_balancer: replace silent pip auto-install with ImportError pointing to pip install genesis[redis] - inbound: remove inner try/except that tested tracer errors by string matching; OTel API guarantees start_as_current_span never raises - tests: add test_routing.py with 18 tests covering ChannelRoutingStrategy, GlobalRoutingStrategy, CompositeRoutingStrategy, and dispatch_to_handlers Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
dispatch_to_handlershad no strong reference and could be garbage-collected mid-execution. Exceptions in handlers were silently dropped. Added an optionaltask_setparameter to keep tasks alive and adone_callbackto log exceptions and remove completed tasks.Protocolnow holds ahandler_tasks: setand cancels all of them onstop()._create_redis_clientranpip install redisvia subprocess when the package was missing. Replaced with anImportErrorwith a clear message pointing topip install genesis[redis].start()had an innertry/exceptthat detected tracer errors by string-matching ("tracer" not in str(e).lower()). The OTel API spec guaranteesstart_as_current_spannever raises — the block was removed.ChannelRoutingStrategy,GlobalRoutingStrategy,CompositeRoutingStrategyanddispatch_to_handlershad no test coverage. Addedtests/test_routing.pywith 18 tests.Test plan
poetry run pytest tests/test_routing.py -v— 18/18 passedpoetry run pytest tests/ -v— 186/186 passedpoetry run black --check genesis/ tests/ examples/— no changespoetry run mypy— no issuespoetry run tox— py312 passed (py310/py311 not installed locally)