codex/frontend-debt-audit #40

Merged
ksv741 merged 10 commits from codex/frontend-debt-audit into main 2026-06-24 09:10:42 +03:00
2 changed files with 123 additions and 0 deletions
Showing only changes of commit 2a6cb1cec9 - Show all commits

View File

@ -0,0 +1,95 @@
# Frontend Shared Boundary Cleanup 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.
**Goal:** Narrow the frontend shared/public API surface and remove remaining architecture ambiguity without changing business logic or UI behavior.
**Architecture:** This feature is a boundary cleanup pass. First identify the exact shared/public exports and the remaining cross-entity or cross-widget dependencies, then move or remove the problematic edges, then update docs so the layer boundaries are explicit for future work.
**Tech Stack:** TypeScript, FSD conventions, existing frontend barrels, shared/api, docs in `apps/docs`.
---
### Task 1: Audit shared/public boundaries
**Files:**
- Read: `apps/frontend/src/shared/api/index.ts`
- Read: `apps/frontend/src/shared/api/kyClient.ts`
- Read: `apps/frontend/src/entities/*/index.ts`
- Read: `apps/frontend/src/widgets/*/index.ts`
- Read: `apps/docs/docs/frontend/overview.md`
- Read: `docs/features/frontend-fsd-final/spec.md`
- [ ] **Step 1: Identify the current shared API surface**
List which exports are truly shared infrastructure and which exports are actually domain-specific convenience aliases.
- [ ] **Step 2: Identify remaining boundary ambiguities**
Check for cross-entity or cross-widget imports that are technically working but should use public barrels or be moved.
### Task 2: Narrow the shared surface
**Files:**
- Modify: `apps/frontend/src/shared/api/index.ts`
- Modify: `apps/frontend/src/shared/api/kyClient.ts` only if needed for public surface consistency
- Modify: `apps/frontend/src/entities/*/api/*.ts` where the boundary cleanup requires public API reshaping
- [ ] **Step 1: Keep only truly shared infrastructure in shared/api**
Remove or relocate aliases that are better expressed through entity public APIs rather than the shared root.
- [ ] **Step 2: Route domain-specific access through entity barrels**
Ensure entities expose their own public entrypoints instead of relying on shared convenience exports for domain shapes.
### Task 3: Fix ambiguous cross-boundary imports
**Files:**
- Modify: any remaining `apps/frontend/src/entities/*/model/*.ts`
- Modify: any remaining `apps/frontend/src/widgets/*/ui/*.tsx`
- Modify: any impacted `index.ts` barrel files
- [ ] **Step 1: Replace ambiguous cross-entity imports with public barrels**
If one entity consumes another, use the other entity's public API rather than deep imports.
- [ ] **Step 2: Replace ambiguous widget dependencies with shared or public widget APIs**
If one widget reuses another widget's reusable piece, either move the reusable piece to shared or expose a proper public entrypoint.
### Task 4: Update boundary docs
**Files:**
- Modify: `apps/docs/docs/frontend/overview.md`
- Modify: `apps/docs/docs/frontend/api-client.md`
- Modify: `docs/features/frontend-shared-boundary-cleanup/spec.md` if scope clarification is needed during implementation
- [ ] **Step 1: Document the current public API rules**
Spell out what `shared`, `entities`, and `widgets` are expected to export publicly after cleanup.
- [ ] **Step 2: Reflect the narrowed shared surface**
Remove wording that implies shared owns domain-specific convenience exports.
### Task 5: Verification
**Files:**
- Read: changed frontend files and docs
- [ ] **Step 1: Run the targeted frontend checks**
Run:
```bash
npm run lint -w apps/frontend
npm run test -w apps/frontend
npm run build -w apps/frontend
```
Expected: all three commands pass after the boundary cleanup changes land.
- [ ] **Step 2: Verify no behavior drift**
Confirm that the UI and API contracts still behave the same after import and export boundary changes.

View File

@ -0,0 +1,28 @@
# Frontend Shared Boundary Cleanup — tasks
Статус: pending
## 1. Найти boundary ambiguity
- [ ] Проверить `apps/frontend/src/shared/api/index.ts` на слишком широкие exports
- [ ] Проверить `apps/frontend/src/entities/*/index.ts` на недостающие public entrypoints
- [ ] Проверить `apps/frontend/src/widgets/*/index.ts` на конфликтующие или неявные зависимости
## 2. Сузить shared/public surface
- [ ] Убрать из `shared/api` то, что является доменной convenience-обёрткой, а не shared infrastructure
- [ ] Переключить доменные потребители на entity barrels
- [ ] Убедиться, что новые imports не обходят public API слои
## 3. Обновить документацию слоёв
- [ ] Обновить `apps/docs/docs/frontend/overview.md`
- [ ] Обновить `apps/docs/docs/frontend/api-client.md`
- [ ] Зафиксировать правила публичных API слоёв для shared/entities/widgets
## 4. Финальная проверка
- [ ] Запустить `npm run lint -w apps/frontend`
- [ ] Запустить `npm run test -w apps/frontend`
- [ ] Запустить `npm run build -w apps/frontend`
- [ ] Убедиться, что изменения не затронули runtime-поведение