Skip to content

chore: migrate to faststream 0.7#42

Merged
lesnik512 merged 1 commit into
mainfrom
chore/faststream-0.7-migration
Jun 3, 2026
Merged

chore: migrate to faststream 0.7#42
lesnik512 merged 1 commit into
mainfrom
chore/faststream-0.7-migration

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Pure-compat migration from FastStream 0.6 to 0.7. Pin bumped to faststream>=0.7,<0.8; no new 0.7 features adopted (broker-level AckPolicy default, multi-broker, MQTT, etc. each get their own follow-up spec).

Internal break points fixed

  • pyproject.toml: pin bumped.
  • publisher/producer.py: OutboxProducer gained a codec attribute (DefaultCodec()) to satisfy ProducerProto[0.7]. The outbox owns its own encoding pipeline (_encode_payload) and ignores codec at runtime.
  • testing.py: FakeOutboxProducer gained the same codec attribute (typing.Any = None); create_publisher_fake_subscriber converted from @staticmethod to instance method to match upstream's abstract base.
  • registrator.py: dropped middlewares_= from the SubscriberUsecase.add_call call (kwarg removed upstream in 0.7).

Public surface (BREAKING)

Dropped the per-call middlewares= kwarg from:

  • OutboxRegistrator.subscriber() and OutboxRegistrator.publisher()
  • OutboxRoute
  • FastAPI router's subscriber() and publisher() overrides

Upstream removed publisher- and subscriber-level middlewares as a public surface in 0.7. Install middleware at the broker scope instead via OutboxBroker(middlewares=[...]). Broker-scope middlewares on OutboxBroker, OutboxRouter, and the FastAPI router are unchanged.

Two new structural tests pin the producer protocol compliance (test_outbox_producer_satisfies_producer_proto, test_fake_outbox_producer_satisfies_producer_proto) using the public typing.get_protocol_members() API.

Test plan

  • just lint-ci — clean
  • just test — 391 passed, --cov-fail-under=100 satisfied
  • uv run pytest tests/test_unit.py tests/test_fake.py (no-Postgres tier) — 271 passed standalone
  • git grep -n "middlewares=" faststream_outbox/ tests/ docs/ shows only broker-scope references
  • git grep -n "faststream<0.7\|faststream>=0.6" . returns nothing
  • python -c "from faststream_outbox import OutboxBroker; from faststream_outbox.fastapi import OutboxRouter" exits 0

Spec: planning/specs/2026-06-03-faststream-0.7-migration-design.md
Plan: planning/plans/2026-06-03-faststream-0.7-migration-plan.md

🤖 Generated with Claude Code

Pure compat migration; no new 0.7 features adopted.

Internal break points fixed:
- pyproject.toml: pin bumped to faststream>=0.7,<0.8.
- publisher/producer.py: OutboxProducer gained a `codec` attribute to
  satisfy ProducerProto[0.7]. The outbox owns its own encoding pipeline
  via _encode_payload and ignores the attribute at runtime.
- testing.py: FakeOutboxProducer gained the same `codec` attribute;
  create_publisher_fake_subscriber converted from @staticmethod to
  instance method to match upstream's abstract base.
- registrator.py: dropped `middlewares_=` from the SubscriberUsecase
  .add_call call (kwarg removed upstream in 0.7).

Public surface (BREAKING):
- Dropped the per-call `middlewares=` kwarg from
  OutboxRegistrator.subscriber, OutboxRegistrator.publisher, OutboxRoute,
  and the FastAPI router's subscriber/publisher overrides. Upstream
  removed publisher- and subscriber-level middlewares as a public
  surface in 0.7; install middleware at the broker scope instead via
  `OutboxBroker(middlewares=[...])`. Broker-scope middlewares on
  OutboxBroker, OutboxRouter, and the FastAPI router are unchanged.

Spec: planning/specs/2026-06-03-faststream-0.7-migration-design.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 self-assigned this Jun 3, 2026
@lesnik512 lesnik512 merged commit b36dcc5 into main Jun 3, 2026
3 checks passed
@lesnik512 lesnik512 deleted the chore/faststream-0.7-migration branch June 3, 2026 18:33
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