Commit Graph

2 Commits

Author SHA1 Message Date
essentiaMarco 53ebb9b46a fix: resolve merge with master — lifespan app vs router
- Default lifespan: use app.router for _DefaultLifespan (router has
  _startup/_shutdown; FastAPI app does not).
- Wrapper: when app is FastAPI, set fastapi_app from app and pass
  app.router to _run_lifespan_dependencies so lifespan deps are collected.
- Test: use only Request.receive() (Starlette Request has no .send).

Made-with: Cursor
2026-03-15 16:59:20 -07:00
essentiaMarco 9fb0fc8120 refactor(lifespan): align with reviewer feedback, add coverage tests
- Fix _collect_lifespan_dependants: handle route-level flat.computed_scope
  and iterate flat.dependencies (was incorrectly iterating flat)
- No pragmas on noop_receive/noop_send; covered by test that uses
  Request.receive/send in a lifespan dependency
- Add test_collect_lifespan_dependants_route_level_scope for route-level
  lifespan branch
- Add test_lifespan_dependency_synthetic_request_receive_send for
  noop_receive/noop_send coverage
- Add test_lifespan_dependency_nested for dependency_cache hit (utils)
- Add test_lifespan_dependency_cannot_depend_on_request_scope and
  test_lifespan_dependency_not_initialized_raises for edge cases

Made-with: Cursor
2026-03-13 23:39:27 -07:00