docs: finalize sdd artifacts — mark checkboxes, update status, document cross-slice export

This commit is contained in:
Sergey Krylov 2026-06-20 13:12:04 +03:00
parent b02ee9cd74
commit 4db95146a7
4 changed files with 43 additions and 39 deletions

View File

@ -63,3 +63,7 @@ broker-specific query/read-model части. Остальные домены о
структурой кода и code review, а не автоматическим правилом. структурой кода и code review, а не автоматическим правилом.
- Документацию frontend потребуется обновить после реализации пилота, чтобы опубликованная - Документацию frontend потребуется обновить после реализации пилота, чтобы опубликованная
структура не расходилась с кодом. структура не расходилась с кодом.
- Для поддержки обратной совместимости со старыми импортами `entities/broker-position/index.ts`
реэкспортирует отдельные operation-типы (`BROKER_OPERATION_TYPE_OPTIONS`, `isBrokerOperationType`
и др.) из `entities/broker-operation`. Это transitional артефакт shim-стратегии, который будет
устранён при следующей итерации миграции после отключения старых entrypoints.

View File

@ -1,6 +1,6 @@
# Frontend FSD Broker Pilot Implementation Plan # 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. **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.ts` — aggregation/read-model helpers.
- Create `apps/frontend/src/entities/broker-account/model/brokerAccountsOverview.test.ts` — unit-тесты агрегатов. - 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.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/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/api/brokerPositionApi.ts` — positions endpoint wrapper.
- Create `apps/frontend/src/entities/broker-position/model/useBrokerPositions.ts` — positions query hook. - 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` - Create: `apps/frontend/src/pages/broker-operations/ui/BrokerOperationsPage.tsx`
- Modify: `apps/frontend/src/routes.tsx` - Modify: `apps/frontend/src/routes.tsx`
- [ ] **Step 1: Написать smoke-тест на broker routes** - [x] **Step 1: Написать smoke-тест на broker routes**
```tsx ```tsx
import { MemoryRouter } from 'react-router-dom'; 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` Run: `npm test -w apps/frontend -- BrokerPages.test.tsx`
Expected: FAIL, потому что новые page entrypoints ещё не существуют. Expected: FAIL, потому что новые page entrypoints ещё не существуют.
- [ ] **Step 3: Создать public entrypoints страниц и временно реэкспортировать текущие реализации** - [x] **Step 3: Создать public entrypoints страниц и временно реэкспортировать текущие реализации**
```ts ```ts
// apps/frontend/src/pages/broker-accounts/index.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'; 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` Run: `npm test -w apps/frontend -- BrokerPages.test.tsx`
Expected: PASS. Expected: PASS.
- [ ] **Step 5: Закоммитить безопасный FSD routing shell** - [x] **Step 5: Закоммитить безопасный FSD routing shell**
```bash ```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 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` - Create: `apps/frontend/src/widgets/broker-accounts-summary/ui/BrokerAccountsSummary.tsx`
- Modify: `apps/frontend/src/pages/broker-accounts/ui/BrokerAccountsPage.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 ```ts
import { aggregateBrokerAccounts } from '../model/brokerAccountsOverview'; 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` Run: `npm test -w apps/frontend -- brokerAccountsOverview.test.ts`
Expected: FAIL, потому что новый entity path пока не экспортирует implementation. 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 ```ts
// apps/frontend/src/entities/broker-account/index.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'; 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` Run: `npm test -w apps/frontend -- brokerAccountsOverview.test.ts BrokerAccountsPage.test.tsx useBrokerAccountPortfolios.test.tsx useBrokerAccounts.test.tsx`
Expected: PASS. 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 ```ts
export { export {
@ -207,7 +207,7 @@ export {
} from '../entities/broker-account'; } from '../entities/broker-account';
``` ```
- [ ] **Step 6: Закоммитить broker-account slice** - [x] **Step 6: Закоммитить broker-account slice**
```bash ```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 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-account/ui/BrokerAccountOverviewPage.tsx`
- Modify: `apps/frontend/src/pages/broker-positions/ui/BrokerPositionsPage.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 ```ts
import { buildBrokerAllocation } from '../model/brokerAllocation'; import { buildBrokerAllocation } from '../model/brokerAllocation';
import { getBrokerInstrumentPath } from '../model/brokerDisplay'; 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` Run: `npm test -w apps/frontend -- brokerAllocation.test.ts brokerDisplay.test.ts`
Expected: FAIL, потому что новые entity exports ещё не подключены. 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 ```ts
// apps/frontend/src/entities/broker-position/index.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'; 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` Run: `npm test -w apps/frontend -- BrokerPages.test.tsx brokerAllocation.test.ts brokerDisplay.test.ts`
Expected: PASS. 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 ```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 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/pages/broker-operations/ui/BrokerOperationsPage.tsx`
- Modify: `apps/frontend/src/routes.tsx` - Modify: `apps/frontend/src/routes.tsx`
- [ ] **Step 1: Добавить unit-тесты для guards и filters операций** - [x] **Step 1: Добавить unit-тесты для guards и filters операций**
```ts ```ts
import { 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` Run: `npm test -w apps/frontend -- operationFilters.test.ts BrokerPages.test.tsx`
Expected: FAIL, потому что filters/layout/operations public API ещё не созданы. 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 ```ts
// apps/frontend/src/entities/broker-operation/index.ts // apps/frontend/src/entities/broker-operation/index.ts
@ -333,13 +333,13 @@ import {
import { BrokerOperationsTable } from '../../../widgets/broker-operations-table'; 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` Run: `npm test -w apps/frontend -- BrokerPages.test.tsx BrokerAccountsPage.test.tsx operationFilters.test.ts useBrokerOperations.test.tsx`
Expected: PASS. 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 ```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 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: `apps/docs/docs/frontend/overview.md`
- Modify: `docs/features/frontend-fsd-broker-pilot/tasks.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 ```tsx
// keep behaviour assertions, but import only through new public routes/pages // 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'); expect(screen.getByRole('link', { name: /вся история/i })).toHaveAttribute('href');
``` ```
- [ ] **Step 2: Обновить опубликованную frontend-документацию** - [x] **Step 2: Обновить опубликованную frontend-документацию**
```md ```md
## Структура исходников ## Структура исходников
@ -377,7 +377,7 @@ Broker-домен переведён в пилотный FSD-срез:
Остальные домены пока остаются в исторической технической структуре. Остальные домены пока остаются в исторической технической структуре.
``` ```
- [ ] **Step 3: Отметить выполнение в `tasks.md` и прогнать обязательные проверки** - [x] **Step 3: Отметить выполнение в `tasks.md` и прогнать обязательные проверки**
Run: `npm test -w apps/frontend` Run: `npm test -w apps/frontend`
@ -395,13 +395,13 @@ Run: `npm run build -w apps/docs`
Expected: PASS. Expected: PASS.
- [ ] **Step 4: Выполнить финальный diff-review перед завершением** - [x] **Step 4: Выполнить финальный diff-review перед завершением**
Run: `git diff --stat main...HEAD` Run: `git diff --stat main...HEAD`
Expected: только broker FSD pilot, docs и связанные test/style updates без затрагивания других доменов. Expected: только broker FSD pilot, docs и связанные test/style updates без затрагивания других доменов.
- [ ] **Step 5: Закоммитить cleanup и docs** - [x] **Step 5: Закоммитить cleanup и docs**
```bash ```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 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

View File

@ -1,7 +1,7 @@
# Frontend FSD Broker Pilot # Frontend FSD Broker Pilot
Дата: 2026-06-20 Дата: 2026-06-20
Статус: согласовано к планированию Статус: реализовано
## Контекст ## Контекст

View File

@ -1,27 +1,27 @@
# Frontend FSD Broker Pilot — задачи # Frontend FSD Broker Pilot — задачи
Статус: согласовано к реализации Статус: выполнено
Подробные шаги, команды и expected results находятся в [plan.md](plan.md). Подробные шаги, команды и expected results находятся в [plan.md](plan.md).
## 1. FSD entrypoints ## 1. FSD entrypoints
- [ ] Создать новые page entrypoints для broker routes. - [x] Создать новые page entrypoints для broker routes.
- [ ] Переключить `routes.tsx` на новые public entrypoints. - [x] Переключить `routes.tsx` на новые public entrypoints.
- [ ] Сохранить текущее поведение broker routes через совместимые re-export переходы. - [x] Сохранить текущее поведение broker routes через совместимые re-export переходы.
## 2. Broker account slice ## 2. Broker account slice
- [ ] Перенести broker accounts, portfolio queries и aggregation read-model в `entities/broker-account`. - [x] Перенести broker accounts, portfolio queries и aggregation read-model в `entities/broker-account`.
- [ ] Вынести `BrokerAccountCard` и `BrokerAccountsSummary` в widgets с public API. - [x] Вынести `BrokerAccountCard` и `BrokerAccountsSummary` в widgets с public API.
- [ ] Привязать тесты списка счетов и агрегатов к новым slice boundaries. - [x] Привязать тесты списка счетов и агрегатов к новым slice boundaries.
## 3. Broker position slice ## 3. Broker position slice
- [ ] Перенести positions query, allocation helpers и instrument path mapping в - [x] Перенести positions query, allocation helpers и instrument path mapping в
`entities/broker-position`. `entities/broker-position`.
- [ ] Вынести allocation chart в widget. - [x] Вынести allocation chart в widget.
- [ ] Переключить overview и positions pages на новые public API. - [x] Переключить overview и positions pages на новые public API.
## 4. Broker operation slice ## 4. Broker operation slice