Skip to content
  • Andrey Azeev's avatar
    cb7d8bc2
    chore(unification): apply fastapi-unification audit (steps 1-13) · cb7d8bc2
    Andrey Azeev authored
    Migrate internal libs and align project with canonical layout.
    
    Libs:
    - lib-utils v0.3.0 → v1.0.0
    - lib-aiohttp v0.4.0 → v0.6.0 (request_hook Sequence, attach_apis,
      base_api_lifespan)
    - lib-aio-rabbit-broker v2.0.0 → v3.1.0 (MessageQueueBase.message is
      dict[str, Any])
    - lib-aiomongo v1.0.1 → v1.1.0 (MongoClientManager shared client)
    - lucente-observability v0.6.0 → v0.7.0 (pure-ASGI RequestIdMiddleware)
    - lib-auth-guard v0.2.1 (new — replaces local src/guard/index.py)
    
    Architecture:
    - attach_apis(app, ...) singleton HTTP clients + base_api_lifespan in
      consumer.py; DI getters Exchange1CApiDep / S3StorageApiDep
    - MongoClientManager in lifespan + src/db/ (get_mongo, MongoDep,
      ensure_mongo_indexes)
    - partial(_LibAuthGuard, auth_guard_settings) + auth_guard_lifespan in
      AsyncExitStack
    - create_technical_auth_hook for outbound JWT (was static
      create_header_temp_token)
    - UpdateBackendConsumer canonical: with_log_ctx, Event.RABBIT_CONSUME /
      TASK_SUCCESS / TASK_FAIL, raise NotImplementedError for unknown msg_type
    - Pure-ASGI MetricsSecurityMiddleware (template STRICT)
    - RabbitMessageQueueBase dropped — MessageQueueBase used directly
    - Typed Ctx (HttpCtx/MongoCtx/RabbitCtx/TaskCtx) in merge_ctx;
      Event.APP_START / APP_STOP in lifespan
    - LoggingSettings.accessLog field + httpx/httpcore suppress + uvicorn
      access_log= + extra= in gunicorn build_options
    
    Removed:
    - src/guard/index.py (local AuthGuard on python-jose)
    - src/schemas/auth_model/ (re-imported from lib_auth_guard)
    - python-jose, python-json-logger from direct deps (transitive)
    - broken health probes (utils_health/redis.py, services.py)
    
    Added:
    - tests/ scaffold (35 tests, 72% cov gate awaits)
    - .gitlab-ci.yml test stage (python:3.12-slim, junit + cobertura)
    - env.template (REQUIRED + OPTIONAL by subsystem)
    - CHANGELOG.md (Keep a Changelog)
    - src/schemas/{shop,counter}/types.py (ShopBatch / CounterBatch)
    - Field(description=...) on bare fields in sale/employee schemas
    
    Verification:
    - ruff check src/ app.py consumer.py run_app.py: all checks passed
    - poetry check --lock: All set!
    - pytest --no-cov: 35 passed
    - legacy grep (jose / guard.index / auth_model / lib_utils.security /
      RabbitMessageQueueBase): empty
    cb7d8bc2
    chore(unification): apply fastapi-unification audit (steps 1-13)
    Andrey Azeev authored
    Migrate internal libs and align project with canonical layout.
    
    Libs:
    - lib-utils v0.3.0 → v1.0.0
    - lib-aiohttp v0.4.0 → v0.6.0 (request_hook Sequence, attach_apis,
      base_api_lifespan)
    - lib-aio-rabbit-broker v2.0.0 → v3.1.0 (MessageQueueBase.message is
      dict[str, Any])
    - lib-aiomongo v1.0.1 → v1.1.0 (MongoClientManager shared client)
    - lucente-observability v0.6.0 → v0.7.0 (pure-ASGI RequestIdMiddleware)
    - lib-auth-guard v0.2.1 (new — replaces local src/guard/index.py)
    
    Architecture:
    - attach_apis(app, ...) singleton HTTP clients + base_api_lifespan in
      consumer.py; DI getters Exchange1CApiDep / S3StorageApiDep
    - MongoClientManager in lifespan + src/db/ (get_mongo, MongoDep,
      ensure_mongo_indexes)
    - partial(_LibAuthGuard, auth_guard_settings) + auth_guard_lifespan in
      AsyncExitStack
    - create_technical_auth_hook for outbound JWT (was static
      create_header_temp_token)
    - UpdateBackendConsumer canonical: with_log_ctx, Event.RABBIT_CONSUME /
      TASK_SUCCESS / TASK_FAIL, raise NotImplementedError for unknown msg_type
    - Pure-ASGI MetricsSecurityMiddleware (template STRICT)
    - RabbitMessageQueueBase dropped — MessageQueueBase used directly
    - Typed Ctx (HttpCtx/MongoCtx/RabbitCtx/TaskCtx) in merge_ctx;
      Event.APP_START / APP_STOP in lifespan
    - LoggingSettings.accessLog field + httpx/httpcore suppress + uvicorn
      access_log= + extra= in gunicorn build_options
    
    Removed:
    - src/guard/index.py (local AuthGuard on python-jose)
    - src/schemas/auth_model/ (re-imported from lib_auth_guard)
    - python-jose, python-json-logger from direct deps (transitive)
    - broken health probes (utils_health/redis.py, services.py)
    
    Added:
    - tests/ scaffold (35 tests, 72% cov gate awaits)
    - .gitlab-ci.yml test stage (python:3.12-slim, junit + cobertura)
    - env.template (REQUIRED + OPTIONAL by subsystem)
    - CHANGELOG.md (Keep a Changelog)
    - src/schemas/{shop,counter}/types.py (ShopBatch / CounterBatch)
    - Field(description=...) on bare fields in sale/employee schemas
    
    Verification:
    - ruff check src/ app.py consumer.py run_app.py: all checks passed
    - poetry check --lock: All set!
    - pytest --no-cov: 35 passed
    - legacy grep (jose / guard.index / auth_model / lib_utils.security /
      RabbitMessageQueueBase): empty
Loading