docs(ui): update legacy cleanup baseline

This commit is contained in:
Saravana Achu Mac 2026-05-06 18:33:10 -07:00
parent 5f38adac62
commit 987ccae747

View File

@ -10,7 +10,7 @@ Live source of truth for migrating `learning_ai_invt_trdg` UI/UX and platform cl
- Current common-platform usage: `@bytelyst/api-client`, `@bytelyst/design-tokens`, `@bytelyst/errors`, `@bytelyst/kill-switch-client`, `@bytelyst/react-auth`, `@bytelyst/react-native-platform-sdk`, `@bytelyst/telemetry-client`, `@bytelyst/ui`
- UI adapter in code: `web/src/components/ui/Primitives.tsx` imports from `@bytelyst/ui`, re-exports common primitives, and owns product status-to-tone mapping.
- Design token foundation in code: `web/src/index.css` imports `@bytelyst/design-tokens/generated/tokens.css` and defines product `--bl-*` aliases.
- Remaining UI duplicates to migrate: legacy global badge/surface CSS, hardcoded color literals, and local status/surface/list/table patterns where still product-local.
- Remaining UI duplicates to migrate: hardcoded color literals and local status/surface/list/table patterns where still product-local.
- Common UI target: `@bytelyst/ui` through the product adapter only; direct `@bytelyst/ui` imports outside the adapter remain disallowed.
- Design token target: `@bytelyst/design-tokens` with product aliases to `--bl-*`; chart/domain colors may remain product-owned when they encode trading semantics.
@ -48,7 +48,7 @@ Reviewed against current product code on 2026-05-06:
- Product code currently imports adapter primitives in `Login`, `ResetPassword`, `PositionsTab`, `MyStrategiesTab`, `VisualRuleBuilder`, `PortfolioView`, `ScreenerView`, `SimpleView`, `ChatControl`, `SettingsTab`, and `EntriesTab`.
- `web/src/index.css` imports shared generated design tokens and defines `--bl-*` aliases for product surfaces/status/focus/radius.
- Production raw-control audit now reports zero findings outside approved UI primitives.
- Remaining legacy CSS/status areas observed include `web/src/App.css`, `web/src/components/SymbolCard.css`, and `web/src/components/SymbolCard.tsx`.
- Legacy global surface-class audit now reports zero findings; `SymbolCard` status/rule labels route through adapter badges where product-agnostic.
- `scripts/ui-drift-audit.sh` uses a portable Python implementation so missing `rg` cannot produce false-zero counts.
## Common UI Gap Closure Decision
@ -82,11 +82,10 @@ Note: common platform had a pre-existing local modification in `packages/ui/src/
| [x] | 9. Advanced product-specific surfaces | product | Migrated Visual Strategy Builder controls to adapter Select/Input/Button/IconButton primitives while keeping dnd-kit composition and strategy rule logic product-owned. | Passed: `pnpm --filter @bytelyst/trading-web exec vitest run src/components/strategy/VisualRuleBuilder.dom.test.tsx`; `pnpm --filter @bytelyst/trading-web typecheck`; `pnpm run audit:ui`; `git diff --check`. | `bb4efc2b0d5f8e2ebbd7487b5731e0e6446ec4fb` | Audit raw controls reduced from 17 to 13. Charts, rule semantics, and strategy execution remain product-owned. |
| [x] | 10. Audit tooling hardening | product | Replaced brittle `rg`-based shell counting with a portable Python audit that excludes approved UI/test surfaces and reports non-zero raw controls reliably. | Passed: `pnpm run audit:ui`; `pnpm --filter @bytelyst/trading-web typecheck`; `git diff --check`. | `9ea72f7` | Audit now reports 0 direct `@bytelyst/ui` imports outside the adapter and no false-zero dependency on local `rg`. |
| [x] | 11. Remaining raw-control migration | product | Migrated remaining production raw controls in portfolio, screener, simple trade plan, chat, settings, and entries surfaces to adapter primitives while preserving trading workflow behavior. | Passed: `pnpm --filter @bytelyst/trading-web exec vitest run src/tabs/SettingsTab.dom.test.tsx src/tabs/EntriesTab.dom.test.tsx`; `pnpm --filter @bytelyst/trading-web typecheck`; `pnpm run audit:ui`; `git diff --check`. | `324e34d`, `7f5f125` | Audit raw interactive controls outside approved primitives reduced to 0. `EntriesTab.tsx` line endings were normalized to satisfy `git diff --check`. |
| [ ] | 12. Legacy global cleanup and strict audit | product | Remove or greatly reduce old global classes and hardcoded literals; replace generic badge/status/surface CSS with adapter/common primitives or token aliases; enable strict audit only after accepted debt is cleared. | `pnpm run audit:ui:strict`; `pnpm verify`; `pnpm lint`; `git diff --check` | Pending | Current audit baseline: 23 legacy global surface classes and 550 hardcoded color literals. Chart palettes and trading semantic colors remain product-owned unless extracted into product token aliases. |
| [~] | 12. Legacy global cleanup and strict audit | product | Removed unused global `.badge` CSS, removed legacy `SymbolCard` badge selectors, preserved adapter `Badge`/`ProductStatusBadge` usage, and tightened legacy-class audit so product token names such as `--bl-surface-card` are not false positives. | Passed: `pnpm run audit:ui`; `pnpm --filter @bytelyst/trading-web typecheck`; `pnpm --filter @bytelyst/trading-web lint`; `pnpm --filter @bytelyst/trading-web test`; `git diff --check`. | `5f38ada` | Audit now reports 0 legacy global surface classes and 525 hardcoded color literals. Strict audit remains deferred for color classification/allowlisting. |
## Remaining Work
- **Clean legacy global CSS**: Reduce or replace `.badge`, `*-badge`, `surface-*`, and older dark-surface classes in `App.css` and `SymbolCard.css`.
- **Reduce hardcoded colors**: Move reusable surface/status colors to token aliases; keep chart palette and trading semantic colors product-owned when appropriate.
- **Standardize local status/list/table patterns**: Prefer adapter/common primitives for product-agnostic surfaces while keeping trading workflows product-owned.
- **Strict audit decision**: Enable `pnpm run audit:ui:strict` only after accepted legacy CSS/color debt is cleared or explicitly allowlisted.