refactor: drop vestigial faststream_context pass-through#18
Merged
Conversation
…erty The 0.7 migration removed the compat branch that once chose between faststream.context and self.context; the faststream_context property was left behind returning self.context unchanged — interface surface for zero behaviour. BaseMiddleware.__init__ assigns self.context from a context: ContextRepo parameter, so ty infers the type directly and the property's explicit annotation buys nothing. Inline self.context.scope(...) at the single call site and delete the property. Behaviour-preserving: consume_scope is exercised on every message by the existing integration round-trips at 100% coverage. Co-Authored-By: Claude Opus 4.8 (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.
What
Delete the
faststream_contextproperty on_DiMiddlewareand inlineself.context.scope(...)at its single call site (consume_scope).Why
The faststream 0.7 migration removed the compat branch that once chose between
faststream.context(pre-0.6) andself.context. The property was left behind returningself.contextunchanged — interface surface for zero behaviour, a shallow pass-through that fails the deletion test (delete it and complexity vanishes, nothing reappears).BaseMiddleware.__init__assignsself.contextfrom acontext: "ContextRepo"parameter, sotyinfers the type directly; the property's explicit-> faststream.ContextRepoannotation buys nothing.Verification
just lintclean (ruff format + ruff check + ty).just test— 5 passed,main.pyat 100% coverage.consume_scopeis exercised on every message by the existing NATS integration round-trips, so the inlined path is covered with no new test.🤖 Generated with Claude Code