chore: adopt faststream 0.7.1 TestBroker typing fix#43
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ag2ai/faststream#2903 makes TestBroker generic over a second EnterType TypeVar (default Any) and threads it through __aenter__. Bind EnterType = OutboxBroker in our TestOutboxBroker so the entered context is typed as a single OutboxBroker rather than OutboxBroker | list[OutboxBroker]. Update the ASGI registry hook annotation to the new two-param shape and bump the faststream floor to >=0.7.1. Both pre-existing ty suppressions stay: git blame shows the class-line # ty: ignore[invalid-type-arguments] on TestOutboxBroker predates 0.7.1 and masks a separate issue (BrokerUsecase invariance on its config-type param, the same root cause already documented for patch_broker_calls). The # ty: ignore[invalid-return-type] on get_broker_registry's dict literal is the same generic-invariance story applied to the dict key side — empirically still flagged on 0.7.1 even with the two-param TestBroker annotation. The spec's claim that 0.7.1 would obsolete either suppression was incorrect; ignore-table justifications in CLAUDE.md updated accordingly. Adds a regression test guarding the single-broker contract through future upstream changes. 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.
Summary
faststreamfloor to>=0.7.1,<0.8to pull in fix(testing): type TestBroker context result via __init__ overloads ag2ai/faststream#2903, which makesTestBrokergeneric over a secondEnterTypeTypeVar (defaultAny) and threads it through__aenter__.EnterType = OutboxBrokeronTestOutboxBrokerso the entered context is typed as a singleOutboxBroker(mirrorsfaststream-redis-timersPR test: T1/T2/T3 fetch parity, multi-worker drain, lease-lost subclass refactor #27).get_broker_registry's return annotation to the new two-paramTestBroker[Any, Any]shape so it matches upstream'stry_it_out._get_broker_registrysignature.tests/test_fake.pythat pins the single-broker contract through any future upstream typing refactor.# ty: ignoredirectives (invalid-type-argumentson the class declaration,invalid-return-typeon the registry return) inCLAUDE.md's ignore table.git blameproved they predate 0.7.1 and mask theBrokerUsecaseconfig-invariance issue (same root cause aspatch_broker_calls), not the upstream union-return-type bug the spec originally claimed; 0.7.1 does not obsolete them.Test Plan
just installresolvesfaststream==0.7.1just lintclean (ruff, format, ty check)just test— 392 passed, 100% coverage (--cov-fail-under=100gate satisfied)test_test_broker_aenter_returns_single_outbox_brokerpasses🤖 Generated with Claude Code