spec: plan grouping of all-account rows by instrument (WealthLedger/main#47) (#64)
Specs security / security (push) Successful in 7s
Specs verify / verify (push) Successful in 9s

This commit was merged in pull request #64.
This commit is contained in:
2026-10-30 07:28:31 +03:00
parent 322ddf6a7f
commit f3a6b78461
13 changed files with 1233 additions and 0 deletions
@@ -0,0 +1,73 @@
# Tasks
## 1. Общая механика и ключи
- [x] 1.1 [frontend] Implementation: чистая группировка `groupItems` и точное десятичное сложение по валютам в `shared/lib` с unit-тестами
- **Covers:** `brokerage-account-ledger` — `All-accounts ledger grouping preserves order and limits`, `brokerage-account-ledger` — `All-accounts ledger group shows each entry and an exact total`
- **Source:** design.md — D1, D3; Developer Verification Strategy (unit grouping, unit decimal/money)
- **Verification:** `npm run test:run -- src/shared/lib src/pages/account/model`; `npm run typecheck`
- **Depends on:** none
- [x] 1.2 [frontend] Implementation: ключи группы и правило показа итога для операций и событий (день как на экране, identity, точный тип, `dateKind`), unit-тесты key adapters
- **Covers:** `brokerage-account-ledger` — `All-accounts ledger groups same-day entries of one instrument`, `brokerage-account-upcoming-events` — `All-accounts upcoming events group same-day events of one instrument`, `brokerage-account-upcoming-events` — `All-accounts upcoming event group shows each event and a forecast total`
- **Source:** design.md — D2, D3; Components and Responsibilities (`entities/broker-operation/model/display.ts`, `entities/brokerage-event/model/event-key.ts`)
- **Verification:** `npm run test:run -- src/entities/broker-operation src/entities/brokerage-event`
- **Depends on:** 1.1
## 2. Представление групп
- [x] 2.1 [frontend] Implementation: компоненты группы и строки счёта для операций и событий по ux-design (заголовок, вложенный список, скрытый итог, доступные имена), с component-тестами
- **Covers:** `brokerage-account-ledger` — `Full ledger presents compact rows`, `brokerage-account-ledger` — `All-accounts ledger group shows each entry and an exact total`, `brokerage-account-upcoming-events` — `All-accounts upcoming event group shows each event and a forecast total`
- **Source:** design.md — UI Implementation; ux-design.md — Information Architecture, UI States, Accessibility
- **Verification:** `npm run test:run -- src/entities packages/ui`; проверка в браузере на 320 px и при zoom 200%
- **Depends on:** 1.2
- [x] 2.2 [frontend] Implementation: группировка в режиме `all` на страницах журнала и «Будущие события». Полнота берётся из `meta`, путь одного счёта не меняется. Route-тесты, включая pagination через MSW
- **Covers:** `brokerage-account-ledger` — `User can retrieve an account ledger`, `brokerage-account-ledger` — `All-accounts ledger grouping preserves order and limits`, `brokerage-account-upcoming-events` — `Account page presents an upcoming events list`, `brokerage-account-upcoming-events` — `All-accounts upcoming event grouping preserves order and limits`
- **Source:** design.md — D4, Components and Responsibilities (`pages/account-operations`, `pages/account-events`)
- **Verification:** `npm run test:run -- src/pages/account-operations src/pages/account-events`
- **Depends on:** 2.1
- [x] 2.3 [frontend] Implementation: группировка в превью обзора `/accounts/all` после лимита в 5 записей, с preview-тестами
- **Covers:** `brokerage-account-ledger` — `Account overview includes recent ledger events`, `brokerage-account-ledger` — `All-accounts ledger grouping preserves order and limits`, `brokerage-account-upcoming-events` — `All-accounts upcoming event grouping preserves order and limits`
- **Source:** design.md — Components and Responsibilities (`pages/account/model/previews.ts`, `RecentOperations.view.tsx`, `BrokerageEventsPreview.tsx`)
- **Verification:** `npm run test:run -- src/pages/account`
- **Depends on:** 2.1
- [x] 2.4 [frontend] Implementation: группировка «Выплат» в режиме `all`. Ключи повторных выплат сохраняются, серверные аналитические итоги не меняются. Route-тесты
- **Covers:** `brokerage-account-income-analytics` — `Income payments remain traceable to exact Ledger Entries`, `brokerage-account-income-analytics` — `Realized income analytics is account-scoped and period-bound`
- **Source:** design.md — Components and Responsibilities (`pages/account-income/model/display.ts`)
- **Verification:** `npm run test:run -- src/pages/account-income`
- **Depends on:** 2.1
- [x] 2.5 [frontend] Verification: полный набор frontend gates на итоговом diff
- **Covers:** N/A — сводная проверка задач 1.1–2.4
- **Source:** design.md — Developer Verification Strategy
- **Verification:** `npm run verify` (после `nvm use --silent`)
- **Depends on:** 2.2, 2.3, 2.4
## 3. Документация
- [x] 3.1 [docs] Docs: обновить AS-IS страниц операций, будущих событий, дохода и режима «Все счета»
- **Covers:** N/A — docs отражают реализованное поведение
- **Source:** tasks.md — Docs Impact
- **Verification:** semantic review против реализации; локальные проверки docs-репозитория по его AGENTS
- **Depends on:** 2.5
## 4. Приёмка
- [x] 4.1 [frontend] Independent Review: read-only review кода против specs, ux-design и design
- **Covers:** N/A — проверка реализации всех ADDED и MODIFIED Requirements
- **Source:** process-record.md — протокол G4
- **Verification:** отчёт independent-reviewer без открытых blocker и major
- **Depends on:** 2.5
- [x] 4.2 [frontend] QA Verification: системная проверка по qa-analysis и test-cases на локальном стенде
- **Covers:** N/A — проверка всех ADDED и MODIFIED Requirements по Coverage Matrix
- **Source:** qa-analysis.md — Coverage Matrix; test-cases/*.md
- **Verification:** отчёт qa-engineer по каждому TC и Scenario из матрицы
- **Depends on:** 2.5
## Docs Impact
Обновляются AS-IS страницы в `docs` (по design.md — Docs Impact):
- `docs/domains/operations/overview.md`: группы журнала и превью; точный клиентский итог по показанным записям.
- `docs/domains/income/upcoming-events.md`: группы полного списка и превью, `dateKind`, когда показывается прогнозный итог.
- `docs/domains/income/overview.md`: группировка «Выплат» в режиме `all`; визуальный итог группы отдельно от серверной аналитики.
- `docs/domains/portfolio/all-accounts.md`: группировка в общих списках только в пределах страницы, cursor protocol прежний.
`docs/design/overview.md` не меняется: граница между UI foundation и предметным представлением остаётся прежней. ADR не требуется.