docs: fix broken examples and wrong behaviour claims - #201
Merged
Merged
Conversation
- relay.md: standalone router example uses faststream.kafka.KafkaRouter and faststream_outbox.OutboxRouter; OutboxResponse example passes a session - messaging-service.md: reference database_engine inside the class body - fastapi.md: dispose the engine in a lifespan (no add_event_handler) - troubleshooting.md: config-error path logs and leaves the row to lease expiry (no nack); real ImportError text; concurrent drain; lease_lost message text alongside the event extra; drop stale history - instrumentation-seams.md: four bus-invisible events; drop duplicate line - setup-prometheus-opentelemetry.md: OTel meters go to the global OTel meter provider; duplicate-collector error fires on second collector; consume vs publish destination attribute - dlq.md, schema-validation.md, alembic.md: no enum column; document pg_catalog probes and check_autovacuum; partitioned DLQ last_exception is VARCHAR so validate_schema passes - index.md, how-it-works.md: standalone and relay as two options; index lists performance.md - first-outbox-app.md: Python 3.11+, current version in sample output - README: faststream_outbox.fastapi.OutboxRouter - Replace private internals in testing, observability, dlq, router, comparison, troubleshooting and subscriber pages - Quote the validate extra in the validate_schema ImportError hint
Benchmark gate✅ gate passed
Gated (fails the build): |
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
A docs review found examples that fail when run and behaviour descriptions that disagree with the code. Each item below was checked against the source and, for examples, run in the repo venv.
Changes
Broken examples
docs/usage/messaging-service.md:Resources.database_engineinside theclass Resourcesbody raisedNameError; nowdatabase_engine(checked with modern-di installed).docs/usage/relay.md: the standalone router snippet included the FastAPIStreamRouters into a plainKafkaBroker, which raisesSetupError: Router must be an instance of KafkaRegistrator. It now buildsfaststream.kafka.KafkaRouter+faststream_outbox.OutboxRouter. TheOutboxResponse(..., session=...)example would fail withTypeErrorfrom the eager check (response.py:_validate_publish_args) before the documented dispatch error; nowsession=session.docs/usage/fastapi.md:app.add_event_handlerdoes not exist on the installed FastAPI 0.141 / Starlette 1.6. Replaced with a lifespan example (checked withTestClient: broker starts,engine.dispose()awaited).Wrong behaviour claims
troubleshooting.md: OutboxResponse + foreign publisher is not nacked.subscriber/usecase.py:609-619logs "Outbox configuration error (fix required; row left to lease-expiry retry)" and the row waits for lease expiry (reproduced withTestOutboxBroker(run_loops=True)). Heading/anchor renamed; no private class names.troubleshooting.md: real ImportError text (schema_validation.py:278); drains are gathered (broker.py:302-306), so shutdown is about onegraceful_timeout;lease_lostis anextra, the message text is "lease expired before {phase} write" (usecase.py:839), both now documented.instrumentation-seams.md: "Three" -> "Four" events (addsdrain_timeout); removed duplicate sentence.setup-prometheus-opentelemetry.md: OTel meters go to the global OTel meter provider; the duplicate-collectorValueErrorfires when the second collector set is created (reproduced atPrometheusRecorder(...)); consume spans usemessaging.destination_publish.name, publish spansmessaging.destination.name(opentelemetry/provider.py:51,66).dlq.md: no enum column exists (schema.py:207).schema-validation.md: documents thepg_index/pg_constraintprobes (schema_validation.py:68-77) andcheck_autovacuum=True(broker.py:367).alembic.md: partitioned DLQ DDL usedlast_exception TEXT;validate_schema()against Postgres 17 fails with "type mismatch: expected String(), got TEXT()".VARCHARpasses.index.md/how-it-works.md: standalone and relay presented as two options; index listsconcepts/performance.md.first-outbox-app.md: Python 3.11+ (matchesrequires-python); sample output uses 0.14.1 (latest tag).README.md:faststream_outbox.fastapi.OutboxRouter.schema_validation.py:278: quote'faststream-outbox[validate]'for zsh; test updated first (red, then green).Private internals and stale history
_fake_start,_fetch_loop,_sync_dispatch,_basic_publish,_noop_recorder,_emit_metric,_subscribers,_stopping,_LAST_EXCEPTION_MAX_CHARS,_flush_terminal,OutboxSubscriberConfig.__post_init__, unexportedOutboxClientfrom the pages named in the review; described behaviour instead.Doc code blocks: 92 python blocks extracted from
docs/**/*.md+ README; 88 compile (4 are signature sketches); 42 run cleanly with a shared per-page namespace. The rest are fragments that need earlier context, need Postgres, or need packages not installed (modern-di, OTLP exporter).Checklist
ruff)ty)uv build) if packaging or build config changeddescription, profile blurb) if this touches packagingAlso ran
mkdocs build --strict(passes) and the full pytest suite against Postgres 17 (624 passed).