Skip to content
  • Andrey Azeev's avatar
    a30a3e97
    feat(unification): align project with FastAPI Unification standard · a30a3e97
    Andrey Azeev authored
    Полная сверка проекта против скила fastapi-unification и приведение к стандарту.
    
    Обязательные либы (P14):
    - lib-utils v0.8.0 -> v1.0.0 (BREAKING: lib_utils.security перенесён в lib-auth-guard)
    - lib-auth-guard v0.2.1 (новая обязательная либа, заменяет 167 строк локального src/guard/index.py)
    - lucente-observability v0.6.1 -> v0.7.0 (RequestIdMiddleware pure-ASGI)
    
    CONDITIONAL-либы:
    - lib-aiomongo v1.0.1 -> v1.1.0 + миграция на MongoClientManager (lifespan-singleton)
    - lib-aiohttp v0.4.0 -> v0.6.0 [fastapi] + attach_apis + request_hook список
    - fastapi ^0.135.2 -> ^0.136.1 (APIKeyHeader 401 для missing header)
    
    Singleton-pattern (P17):
    - AsyncExitStack в app.py: auth_guard_lifespan -> MongoClientManager -> ensure_mongo_indexes -> attach_apis
    - src/db/__init__.py + dependencies.py: MongoDep, NotificationDep через DI
    - src/routers/{products,orders}/utils.py: per-call AsyncMongoCRUD/Producer/NotificationApi удалён в hot-path
    - src/micro_services_api/*/api.py: headers=create_header_temp_token() -> request_hook=[request_id_hook(), create_technical_auth_hook(...)] (свежий JWT на каждый запрос)
    
    Тесты (P13):
    - tests/ из шаблона + расширен conftest проектными env
    - tests/routers/test_products.py (16), test_orders.py (29), tests/micro_services_api/test_notifications.py (26)
    - pyproject.toml: pytest/pytest-asyncio/pytest-cov dev-deps, [tool.pytest.ini_options], [tool.coverage.*], cov-fail-under=80
    - 106 passed, coverage 94.88%
    
    Прочее:
    - .gitlab-ci.yml: добавлена стадия test: с poetry + pytest + cobertura
    - .env.example: раскомментирован обязательный набор + APP__LOGGINGCONFIG_ACCESSLOG
    - LoggingSettings.accessLog + run_app.py/app.py условное глушение httpx/httpcore
    a30a3e97
    feat(unification): align project with FastAPI Unification standard
    Andrey Azeev authored
    Полная сверка проекта против скила fastapi-unification и приведение к стандарту.
    
    Обязательные либы (P14):
    - lib-utils v0.8.0 -> v1.0.0 (BREAKING: lib_utils.security перенесён в lib-auth-guard)
    - lib-auth-guard v0.2.1 (новая обязательная либа, заменяет 167 строк локального src/guard/index.py)
    - lucente-observability v0.6.1 -> v0.7.0 (RequestIdMiddleware pure-ASGI)
    
    CONDITIONAL-либы:
    - lib-aiomongo v1.0.1 -> v1.1.0 + миграция на MongoClientManager (lifespan-singleton)
    - lib-aiohttp v0.4.0 -> v0.6.0 [fastapi] + attach_apis + request_hook список
    - fastapi ^0.135.2 -> ^0.136.1 (APIKeyHeader 401 для missing header)
    
    Singleton-pattern (P17):
    - AsyncExitStack в app.py: auth_guard_lifespan -> MongoClientManager -> ensure_mongo_indexes -> attach_apis
    - src/db/__init__.py + dependencies.py: MongoDep, NotificationDep через DI
    - src/routers/{products,orders}/utils.py: per-call AsyncMongoCRUD/Producer/NotificationApi удалён в hot-path
    - src/micro_services_api/*/api.py: headers=create_header_temp_token() -> request_hook=[request_id_hook(), create_technical_auth_hook(...)] (свежий JWT на каждый запрос)
    
    Тесты (P13):
    - tests/ из шаблона + расширен conftest проектными env
    - tests/routers/test_products.py (16), test_orders.py (29), tests/micro_services_api/test_notifications.py (26)
    - pyproject.toml: pytest/pytest-asyncio/pytest-cov dev-deps, [tool.pytest.ini_options], [tool.coverage.*], cov-fail-under=80
    - 106 passed, coverage 94.88%
    
    Прочее:
    - .gitlab-ci.yml: добавлена стадия test: с poetry + pytest + cobertura
    - .env.example: раскомментирован обязательный набор + APP__LOGGINGCONFIG_ACCESSLOG
    - LoggingSettings.accessLog + run_app.py/app.py условное глушение httpx/httpcore
Loading