Skip to content

refactor: drop vestigial faststream_context pass-through#18

Merged
lesnik512 merged 1 commit into
mainfrom
chore/drop-vestigial-faststream-context
Jun 25, 2026
Merged

refactor: drop vestigial faststream_context pass-through#18
lesnik512 merged 1 commit into
mainfrom
chore/drop-vestigial-faststream-context

Conversation

@lesnik512

Copy link
Copy Markdown
Member

What

Delete the faststream_context property on _DiMiddleware and inline self.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) and self.context. The property was left behind returning self.context unchanged — interface surface for zero behaviour, a shallow pass-through that fails the deletion test (delete it and complexity vanishes, nothing reappears).

BaseMiddleware.__init__ assigns self.context from a context: "ContextRepo" parameter, so ty infers the type directly; the property's explicit -> faststream.ContextRepo annotation buys nothing.

Verification

  • just lint clean (ruff format + ruff check + ty).
  • just test — 5 passed, main.py at 100% coverage. consume_scope is 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

…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>
@lesnik512 lesnik512 merged commit 1dd5a59 into main Jun 25, 2026
6 checks passed
@lesnik512 lesnik512 deleted the chore/drop-vestigial-faststream-context branch June 25, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant