From 4db95146a72f5091b11f3581aaec6012b7ec9169 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Sat, 20 Jun 2026 13:12:04 +0300 Subject: [PATCH] =?UTF-8?q?docs:=20finalize=20sdd=20artifacts=20=E2=80=94?= =?UTF-8?q?=20mark=20checkboxes,=20update=20status,=20document=20cross-sli?= =?UTF-8?q?ce=20export?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adr/ADR-013-frontend-fsd-broker-pilot.md | 4 ++ .../frontend-fsd-broker-pilot/plan.md | 56 +++++++++---------- .../frontend-fsd-broker-pilot/spec.md | 2 +- .../frontend-fsd-broker-pilot/tasks.md | 20 +++---- 4 files changed, 43 insertions(+), 39 deletions(-) diff --git a/apps/docs/docs/adr/ADR-013-frontend-fsd-broker-pilot.md b/apps/docs/docs/adr/ADR-013-frontend-fsd-broker-pilot.md index 3923c67..d615688 100644 --- a/apps/docs/docs/adr/ADR-013-frontend-fsd-broker-pilot.md +++ b/apps/docs/docs/adr/ADR-013-frontend-fsd-broker-pilot.md @@ -63,3 +63,7 @@ broker-specific query/read-model части. Остальные домены о структурой кода и code review, а не автоматическим правилом. - Документацию frontend потребуется обновить после реализации пилота, чтобы опубликованная структура не расходилась с кодом. +- Для поддержки обратной совместимости со старыми импортами `entities/broker-position/index.ts` + реэкспортирует отдельные operation-типы (`BROKER_OPERATION_TYPE_OPTIONS`, `isBrokerOperationType` + и др.) из `entities/broker-operation`. Это transitional артефакт shim-стратегии, который будет + устранён при следующей итерации миграции после отключения старых entrypoints. diff --git a/docs/features/frontend-fsd-broker-pilot/plan.md b/docs/features/frontend-fsd-broker-pilot/plan.md index db4a4b8..8b2ba8d 100644 --- a/docs/features/frontend-fsd-broker-pilot/plan.md +++ b/docs/features/frontend-fsd-broker-pilot/plan.md @@ -1,6 +1,6 @@ # Frontend FSD Broker Pilot Implementation Plan -> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [x]`) syntax for tracking. **Goal:** Перевести broker-домен frontend на первый вертикальный FSD-срез без изменения пользовательского поведения и с сохранением текущих data contracts. @@ -32,7 +32,7 @@ - Create `apps/frontend/src/entities/broker-account/model/brokerAccountsOverview.ts` — aggregation/read-model helpers. - Create `apps/frontend/src/entities/broker-account/model/brokerAccountsOverview.test.ts` — unit-тесты агрегатов. - Create `apps/frontend/src/entities/broker-account/ui/BrokerAccountLayout.tsx` — nested account route shell и context. -- Create `apps/frontend/src/entities/broker-account/ui/BrokerAccountLayout.test.tsx` — тесты route shell. +- ~~Create `apps/frontend/src/entities/broker-account/ui/BrokerAccountLayout.test.tsx` — тесты route shell.~~ (покрывается интеграционными тестами в `BrokerPages.test.tsx`) - Create `apps/frontend/src/entities/broker-position/index.ts` — public API position slice. - Create `apps/frontend/src/entities/broker-position/api/brokerPositionApi.ts` — positions endpoint wrapper. - Create `apps/frontend/src/entities/broker-position/model/useBrokerPositions.ts` — positions query hook. @@ -72,7 +72,7 @@ - Create: `apps/frontend/src/pages/broker-operations/ui/BrokerOperationsPage.tsx` - Modify: `apps/frontend/src/routes.tsx` -- [ ] **Step 1: Написать smoke-тест на broker routes** +- [x] **Step 1: Написать smoke-тест на broker routes** ```tsx import { MemoryRouter } from 'react-router-dom'; @@ -90,13 +90,13 @@ it('renders broker routes through fsd entrypoints', () => { }); ``` -- [ ] **Step 2: Запустить route smoke-test и подтвердить RED** +- [x] **Step 2: Запустить route smoke-test и подтвердить RED** Run: `npm test -w apps/frontend -- BrokerPages.test.tsx` Expected: FAIL, потому что новые page entrypoints ещё не существуют. -- [ ] **Step 3: Создать public entrypoints страниц и временно реэкспортировать текущие реализации** +- [x] **Step 3: Создать public entrypoints страниц и временно реэкспортировать текущие реализации** ```ts // apps/frontend/src/pages/broker-accounts/index.ts @@ -116,13 +116,13 @@ import { BrokerPositionsPage } from './pages/broker-positions'; import { BrokerOperationsPage } from './pages/broker-operations'; ``` -- [ ] **Step 4: Запустить route smoke-test и подтвердить GREEN** +- [x] **Step 4: Запустить route smoke-test и подтвердить GREEN** Run: `npm test -w apps/frontend -- BrokerPages.test.tsx` Expected: PASS. -- [ ] **Step 5: Закоммитить безопасный FSD routing shell** +- [x] **Step 5: Закоммитить безопасный FSD routing shell** ```bash git add apps/frontend/src/routes.tsx apps/frontend/src/pages/broker-accounts apps/frontend/src/pages/broker-account apps/frontend/src/pages/broker-positions apps/frontend/src/pages/broker-operations @@ -146,7 +146,7 @@ git commit -m "refactor(frontend): add broker fsd page entrypoints" - Create: `apps/frontend/src/widgets/broker-accounts-summary/ui/BrokerAccountsSummary.tsx` - Modify: `apps/frontend/src/pages/broker-accounts/ui/BrokerAccountsPage.tsx` -- [ ] **Step 1: Перенести unit-тесты read-model в новый slice path** +- [x] **Step 1: Перенести unit-тесты read-model в новый slice path** ```ts import { aggregateBrokerAccounts } from '../model/brokerAccountsOverview'; @@ -158,13 +158,13 @@ describe('aggregateBrokerAccounts', () => { }); ``` -- [ ] **Step 2: Запустить read-model unit-тест и подтвердить RED** +- [x] **Step 2: Запустить read-model unit-тест и подтвердить RED** Run: `npm test -w apps/frontend -- brokerAccountsOverview.test.ts` Expected: FAIL, потому что новый entity path пока не экспортирует implementation. -- [ ] **Step 3: Перенести broker account API/hooks/aggregation и подключить widgets через public API** +- [x] **Step 3: Перенести broker account API/hooks/aggregation и подключить widgets через public API** ```ts // apps/frontend/src/entities/broker-account/index.ts @@ -190,13 +190,13 @@ import { BrokerAccountCard } from '../../../widgets/broker-account-card'; import { BrokerAccountsSummary } from '../../../widgets/broker-accounts-summary'; ``` -- [ ] **Step 4: Запустить account slice тесты и страницы списка** +- [x] **Step 4: Запустить account slice тесты и страницы списка** Run: `npm test -w apps/frontend -- brokerAccountsOverview.test.ts BrokerAccountsPage.test.tsx useBrokerAccountPortfolios.test.tsx useBrokerAccounts.test.tsx` Expected: PASS. -- [ ] **Step 5: Удалить или превратить старые `src/hooks/useBrokerAccounts.ts`, `src/hooks/useBrokerAccountPortfolios.ts`, `src/hooks/useBrokerPortfolio.ts`, `src/pages/broker/BrokerAccountCard.tsx`, `src/pages/broker/BrokerAccountsSummary.tsx`, `src/pages/broker/brokerAccountsOverview.ts` в совместимые re-export shim-файлы** +- [x] **Step 5: Удалить или превратить старые `src/hooks/useBrokerAccounts.ts`, `src/hooks/useBrokerAccountPortfolios.ts`, `src/hooks/useBrokerPortfolio.ts`, `src/pages/broker/BrokerAccountCard.tsx`, `src/pages/broker/BrokerAccountsSummary.tsx`, `src/pages/broker/brokerAccountsOverview.ts` в совместимые re-export shim-файлы** ```ts export { @@ -207,7 +207,7 @@ export { } from '../entities/broker-account'; ``` -- [ ] **Step 6: Закоммитить broker-account slice** +- [x] **Step 6: Закоммитить broker-account slice** ```bash git add apps/frontend/src/entities/broker-account apps/frontend/src/widgets/broker-account-card apps/frontend/src/widgets/broker-accounts-summary apps/frontend/src/pages/broker-accounts apps/frontend/src/hooks/useBrokerAccounts.ts apps/frontend/src/hooks/useBrokerAccountPortfolios.ts apps/frontend/src/hooks/useBrokerPortfolio.ts apps/frontend/src/pages/broker/BrokerAccountCard.tsx apps/frontend/src/pages/broker/BrokerAccountsSummary.tsx apps/frontend/src/pages/broker/brokerAccountsOverview.ts @@ -230,20 +230,20 @@ git commit -m "refactor(frontend): move broker account slice to fsd" - Modify: `apps/frontend/src/pages/broker-account/ui/BrokerAccountOverviewPage.tsx` - Modify: `apps/frontend/src/pages/broker-positions/ui/BrokerPositionsPage.tsx` -- [ ] **Step 1: Переместить существующие unit-тесты `brokerAllocation` и `brokerDisplay` в новый entity slice** +- [x] **Step 1: Переместить существующие unit-тесты `brokerAllocation` и `brokerDisplay` в новый entity slice** ```ts import { buildBrokerAllocation } from '../model/brokerAllocation'; import { getBrokerInstrumentPath } from '../model/brokerDisplay'; ``` -- [ ] **Step 2: Запустить position-related unit-тесты и подтвердить RED** +- [x] **Step 2: Запустить position-related unit-тесты и подтвердить RED** Run: `npm test -w apps/frontend -- brokerAllocation.test.ts brokerDisplay.test.ts` Expected: FAIL, потому что новые entity exports ещё не подключены. -- [ ] **Step 3: Перенести positions API/query/model и переключить overview/positions pages на public API** +- [x] **Step 3: Перенести positions API/query/model и переключить overview/positions pages на public API** ```ts // apps/frontend/src/entities/broker-position/index.ts @@ -257,13 +257,13 @@ export { getBrokerInstrumentPath } from './model/brokerDisplay'; import { useBrokerPositions, getBrokerInstrumentPath } from '../../../entities/broker-position'; ``` -- [ ] **Step 4: Запустить position page tests** +- [x] **Step 4: Запустить position page tests** Run: `npm test -w apps/frontend -- BrokerPages.test.tsx brokerAllocation.test.ts brokerDisplay.test.ts` Expected: PASS. -- [ ] **Step 5: Перевести старые files `src/hooks/useBrokerPositions.ts`, `src/pages/broker/brokerAllocation.ts`, `src/pages/broker/brokerDisplay.ts`, `src/pages/broker/BrokerAllocationChart.tsx`, `src/pages/broker/BrokerPositionsPage.tsx` в re-export shim или удалить после переключения импортов** +- [x] **Step 5: Перевести старые files `src/hooks/useBrokerPositions.ts`, `src/pages/broker/brokerAllocation.ts`, `src/pages/broker/brokerDisplay.ts`, `src/pages/broker/BrokerAllocationChart.tsx`, `src/pages/broker/BrokerPositionsPage.tsx` в re-export shim или удалить после переключения импортов** ```bash git add apps/frontend/src/entities/broker-position apps/frontend/src/widgets/broker-allocation-chart apps/frontend/src/pages/broker-account apps/frontend/src/pages/broker-positions apps/frontend/src/hooks/useBrokerPositions.ts apps/frontend/src/pages/broker/brokerAllocation.ts apps/frontend/src/pages/broker/brokerDisplay.ts apps/frontend/src/pages/broker/BrokerAllocationChart.tsx apps/frontend/src/pages/broker/BrokerPositionsPage.tsx @@ -287,7 +287,7 @@ git commit -m "refactor(frontend): move broker position slice to fsd" - Modify: `apps/frontend/src/pages/broker-operations/ui/BrokerOperationsPage.tsx` - Modify: `apps/frontend/src/routes.tsx` -- [ ] **Step 1: Добавить unit-тесты для guards и filters операций** +- [x] **Step 1: Добавить unit-тесты для guards и filters операций** ```ts import { @@ -301,13 +301,13 @@ it('accepts only declared broker operation types', () => { }); ``` -- [ ] **Step 2: Запустить tests операций и подтвердить RED** +- [x] **Step 2: Запустить tests операций и подтвердить RED** Run: `npm test -w apps/frontend -- operationFilters.test.ts BrokerPages.test.tsx` Expected: FAIL, потому что filters/layout/operations public API ещё не созданы. -- [ ] **Step 3: Перенести operations API/query/filter logic, route shell и operations table widget** +- [x] **Step 3: Перенести operations API/query/filter logic, route shell и operations table widget** ```ts // apps/frontend/src/entities/broker-operation/index.ts @@ -333,13 +333,13 @@ import { import { BrokerOperationsTable } from '../../../widgets/broker-operations-table'; ``` -- [ ] **Step 4: Запустить operations/layout/page tests** +- [x] **Step 4: Запустить operations/layout/page tests** Run: `npm test -w apps/frontend -- BrokerPages.test.tsx BrokerAccountsPage.test.tsx operationFilters.test.ts useBrokerOperations.test.tsx` Expected: PASS. -- [ ] **Step 5: Перевести старые files `src/hooks/useBrokerOperations.ts`, `src/pages/broker/BrokerOperationsPage.tsx`, `src/pages/broker/BrokerOperationsTable.tsx`, `src/pages/broker/BrokerAccountLayout.tsx` в shim или удалить** +- [x] **Step 5: Перевести старые files `src/hooks/useBrokerOperations.ts`, `src/pages/broker/BrokerOperationsPage.tsx`, `src/pages/broker/BrokerOperationsTable.tsx`, `src/pages/broker/BrokerAccountLayout.tsx` в shim или удалить** ```bash git add apps/frontend/src/entities/broker-operation apps/frontend/src/entities/broker-account/ui/BrokerAccountLayout.tsx apps/frontend/src/widgets/broker-operations-table apps/frontend/src/pages/broker-operations apps/frontend/src/routes.tsx apps/frontend/src/hooks/useBrokerOperations.ts apps/frontend/src/pages/broker/BrokerOperationsPage.tsx apps/frontend/src/pages/broker/BrokerOperationsTable.tsx apps/frontend/src/pages/broker/BrokerAccountLayout.tsx @@ -355,7 +355,7 @@ git commit -m "refactor(frontend): move broker operations and layout to fsd" - Modify: `apps/docs/docs/frontend/overview.md` - Modify: `docs/features/frontend-fsd-broker-pilot/tasks.md` -- [ ] **Step 1: Сконцентрировать broker route coverage вокруг новых FSD entrypoints** +- [x] **Step 1: Сконцентрировать broker route coverage вокруг новых FSD entrypoints** ```tsx // keep behaviour assertions, but import only through new public routes/pages @@ -363,7 +363,7 @@ expect(screen.getByRole('heading', { name: /брокерские счета/i }) expect(screen.getByRole('link', { name: /вся история/i })).toHaveAttribute('href'); ``` -- [ ] **Step 2: Обновить опубликованную frontend-документацию** +- [x] **Step 2: Обновить опубликованную frontend-документацию** ```md ## Структура исходников @@ -377,7 +377,7 @@ Broker-домен переведён в пилотный FSD-срез: Остальные домены пока остаются в исторической технической структуре. ``` -- [ ] **Step 3: Отметить выполнение в `tasks.md` и прогнать обязательные проверки** +- [x] **Step 3: Отметить выполнение в `tasks.md` и прогнать обязательные проверки** Run: `npm test -w apps/frontend` @@ -395,13 +395,13 @@ Run: `npm run build -w apps/docs` Expected: PASS. -- [ ] **Step 4: Выполнить финальный diff-review перед завершением** +- [x] **Step 4: Выполнить финальный diff-review перед завершением** Run: `git diff --stat main...HEAD` Expected: только broker FSD pilot, docs и связанные test/style updates без затрагивания других доменов. -- [ ] **Step 5: Закоммитить cleanup и docs** +- [x] **Step 5: Закоммитить cleanup и docs** ```bash git add apps/frontend/src/pages/broker/BrokerPages.test.tsx apps/frontend/src/styles.css apps/docs/docs/frontend/overview.md docs/features/frontend-fsd-broker-pilot/tasks.md diff --git a/docs/features/frontend-fsd-broker-pilot/spec.md b/docs/features/frontend-fsd-broker-pilot/spec.md index 5b559e6..aba1adb 100644 --- a/docs/features/frontend-fsd-broker-pilot/spec.md +++ b/docs/features/frontend-fsd-broker-pilot/spec.md @@ -1,7 +1,7 @@ # Frontend FSD Broker Pilot Дата: 2026-06-20 -Статус: согласовано к планированию +Статус: реализовано ## Контекст diff --git a/docs/features/frontend-fsd-broker-pilot/tasks.md b/docs/features/frontend-fsd-broker-pilot/tasks.md index ccaff9f..fc503ec 100644 --- a/docs/features/frontend-fsd-broker-pilot/tasks.md +++ b/docs/features/frontend-fsd-broker-pilot/tasks.md @@ -1,27 +1,27 @@ # Frontend FSD Broker Pilot — задачи -Статус: согласовано к реализации +Статус: выполнено Подробные шаги, команды и expected results находятся в [plan.md](plan.md). ## 1. FSD entrypoints -- [ ] Создать новые page entrypoints для broker routes. -- [ ] Переключить `routes.tsx` на новые public entrypoints. -- [ ] Сохранить текущее поведение broker routes через совместимые re-export переходы. +- [x] Создать новые page entrypoints для broker routes. +- [x] Переключить `routes.tsx` на новые public entrypoints. +- [x] Сохранить текущее поведение broker routes через совместимые re-export переходы. ## 2. Broker account slice -- [ ] Перенести broker accounts, portfolio queries и aggregation read-model в `entities/broker-account`. -- [ ] Вынести `BrokerAccountCard` и `BrokerAccountsSummary` в widgets с public API. -- [ ] Привязать тесты списка счетов и агрегатов к новым slice boundaries. +- [x] Перенести broker accounts, portfolio queries и aggregation read-model в `entities/broker-account`. +- [x] Вынести `BrokerAccountCard` и `BrokerAccountsSummary` в widgets с public API. +- [x] Привязать тесты списка счетов и агрегатов к новым slice boundaries. ## 3. Broker position slice -- [ ] Перенести positions query, allocation helpers и instrument path mapping в +- [x] Перенести positions query, allocation helpers и instrument path mapping в `entities/broker-position`. -- [ ] Вынести allocation chart в widget. -- [ ] Переключить overview и positions pages на новые public API. +- [x] Вынести allocation chart в widget. +- [x] Переключить overview и positions pages на новые public API. ## 4. Broker operation slice