Перейти к содержанию

Audit Report: modular_architecture_overhaul (A1-D7)

Audit date: 2026-03-19 Scope: microfrontend, services, docs Status values: done, partial, not_done

Definition of Done for partial items

A partial item is moved to done only when all three checks pass:

  1. Code/behavior is implemented in runtime paths (not only schema/stub).
  2. Validation exists (build/typecheck and at least one smoke path for the changed area).
  3. Documentation reflects actual state (no stale pending/legacy notes for completed wiring).

Status matrix

Item Status Evidence
A1 pipe service extraction done services/pipe/src/main.ts (gRPC 5005), services/pipe/src/pipe/pipe.grpc.controller.ts, services/pipe/src/mongo/mongo.service.ts (crm_pipelines, crm_deal_sources, crm_deals)
A2 orders service extraction done services/orders/src/main.ts (gRPC 5006), services/orders/src/orders/orders.grpc.controller.ts, services/orders/src/mongo/mongo.service.ts (crm_order_types, crm_orders)
A3 product service extraction + CRUD RPC done services/proto/fairflow/product/v1/product.proto (CreateProduct/UpdateProduct/DeleteProduct), services/product/src/product/product.grpc.controller.ts, services/product/src/mongo/mongo.service.ts (crm_products)
A4 activity service extraction done services/activity/src/main.ts (gRPC 5008), services/activity/src/activity/activity.grpc.controller.ts, services/activity/src/mongo/mongo.service.ts (crm_activities)
A5 platform service extraction + real storage done services/platform/src/platform/platform.service.ts now implements persisted quota checks (platform_quota_rules + platform_quota_usage), upload ticket creation (platform_upload_tickets), and real webhook dispatch + log (platform_webhook_log)
A6 remove crm-grpc and scaffold copies done services/crm-grpc absent and residual scaffold services/company/contact/ removed
B1 documents service done services/documents/src/documents/documents.service.ts now renders DOCX (docx package) and uploads binary via uploadObject in services/documents/src/s3/s3.service.ts
B2 reports service done services/reports/src/reports/reports.module.ts registers domain gRPC clients (pipe/orders/contact/company); reports.service.ts composes summary via gRPC list calls with fallback
B3 automation service done RabbitMQ topic flow implemented: services/automation/src/messaging/rabbitmq.service.ts, publish hooks in automation.service.ts, trigger consumer via automation.triggers queue
B4 search service done services/search/src/messaging/rabbitmq.service.ts + consumer in search.service.ts (search.indexer) to reindex on domain events
B5 audit service done services/audit/src/messaging/rabbitmq.service.ts + consumer in audit.service.ts (audit.events) ingesting cross-domain events into audit log
B6 notification service done services/notification/src/notification/notification.service.ts includes push channel sender and v2 channel parsing (push, all-v2)
B7 billing service done Dedicated service + PostgreSQL schema + gRPC methods: services/billing/prisma/schema.prisma, services/billing/src/billing/billing.service.ts, services/proto/fairflow/billing/v1/billing.proto
C1 shared-ui library done All remote module entrypoints import @fairflow/shared-ui and use shared Container wrapper (microfrontend/modules/*/src/*Module.tsx)
C2 contacts remote migration done microfrontend/modules/contacts/src/*, host routes use lazyRemote('contacts') in microfrontend/host/src/configs/routes.config/routes.config.ts
C3 companies remote migration done microfrontend/modules/companies/src/*, host routes use lazyRemote('companies')
C4 deals + pipelines remote migration done microfrontend/modules/deals/src/Deals/*, microfrontend/modules/deals/src/Pipelines/*, microfrontend/modules/deals/src/Import/DealImport.tsx; host routes use lazyRemote('deals')
C5 orders remote migration done microfrontend/modules/orders/src/* including OrderImport.tsx; host routes use lazyRemote('orders')
C6 activities remote migration done microfrontend/modules/activities/src/*; host routes use lazyRemote('activities')
C7 products/reports/documents/automation remotes done microfrontend/modules/{products,reports,documents,automation}/src/*; host routes use lazyRemote(...) for all four
C8 statistics remote module done microfrontend/modules/statistics/src/StatisticsModule.tsx, microfrontend/modules/statistics/vite.config.ts (port 5020), host routes map /dashboard and /statistics to lazyRemote('statistics')
D1 unify API paths to /api/v1/* done Legacy /api/crm/* usage removed from remotes; module code now uses /api/v1/*
D2 project context strategy done Policy documented in docs/promts/project-context.md and reflected in host routing (microfrontend/host/src/configs/routes.config/routes.config.ts) with portfolio routes without /p/:pid
D3 gateway gRPC clients + endpoints for new services done Clients wired in services/gateway/src/bff/grpc-bff.module.ts for documents/reports/automation/search/audit/notification/billing; endpoints present in common-bff.controller.ts and crm-bff.controller.ts
D4 dead code cleanup done Residual scaffold services/company/contact/ removed; no remaining runtime references
D5 docs update done services-runbook.md and gateway-services-grpc-spec.md aligned with actual gateway wiring and /api/v1 path policy
D6 docker-compose coverage + healthchecks done services/docker/docker-compose.yml includes new services (documents,reports,automation,search,audit,notification,billing) with healthchecks
D7 module registry API + remove frontend duplicate registry done Settings.tsx now loads registry only from gateway API and shows controlled error/empty state without local fallback registry

Consolidated gaps (P0/P1/P2)

No open P0/P1/P2 gaps remain for A1-D7 after remediation wave execution.

Closure sequence outcome

  1. Wave 1 completed: D1 + D5.
  2. Wave 2 completed: B3/B4/B5 RabbitMQ backbone.
  3. Wave 3 completed: B1/B2/B6/A5.
  4. Wave 4 completed: C1 + D7.
  5. Wave 5 completed: A6 + D4.