Commit 8101265
authored
docs: Add async lifecycle patterns guide (#477)
## Summary
- Rewrites `docs/guides/lifecycle-async-patterns.md` with detailed
coverage of the `@lifecycle` decorator patterns
- Adds concrete examples for SQLAlchemy async engine, aiohttp
ClientSession, Redis connection pool, and RabbitMQ message queue
- Documents error handling patterns: initialization failure rollback and
dispose failure continuation
- Adds FAQ section covering why `resolve()` is sync, why test fakes skip
`@lifecycle`, and sync method rejection
- Adds troubleshooting section for "component not initialized",
TypeError at decoration time, and resource leak diagnosis
- Documents how `@lifecycle` interacts with `Scope.REQUEST` for
pool-vs-session patterns
- Adds `tests/test_lifecycle_docs_examples.py` with 11 tests verifying
all documented API behaviors
## Test plan
- [x] All 11 new documentation example tests pass
- [x] All 27 existing lifecycle tests still pass
- [x] mypy passes with zero errors
- [x] ruff check and format pass
- [x] Sphinx docs build succeeds with no warnings on the guide file
Fixes #342
Generated with [Claude Code](https://claude.ai/claude-code)1 parent 37c9731 commit 8101265
File tree
2 files changed
+961
-77
lines changed- docs/guides
- tests
2 files changed
+961
-77
lines changed
0 commit comments