You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
4.4 KiB
Markdown
60 lines
4.4 KiB
Markdown
# Frontend Audit Report (Partial)
|
|
|
|
## Scope and limits
|
|
- Audited `frontend/src` against:
|
|
- `/Users/oabrivard/Projects/rust/ai_synth/docs/requirements.md`
|
|
- `/Users/oabrivard/Projects/rust/ai_synth/docs/functional_specs.md`
|
|
- `/Users/oabrivard/Projects/rust/ai_synth/docs/technical_specs.md`
|
|
- `/Users/oabrivard/Projects/rust/ai_synth/docs/dev_guidelines.md`
|
|
- Validation:
|
|
- `tsc --noEmit` passed
|
|
- `vitest` blocked by missing optional package `@rollup/rollup-darwin-x64`
|
|
|
|
## Clarification Questions
|
|
1. Should fallback category label be `Autre` (functional spec) or `Divers` (current behavior)?
|
|
2. Is the "use `Button` component instead of raw `<button>`" rule strict or only for primary actions?
|
|
|
|
## Prioritized Findings
|
|
|
|
### P1
|
|
- Article history filter values are out of contract with documented statuses/source types.
|
|
- Evidence: `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/ArticleHistory.tsx:18`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/ArticleHistory.tsx:28`, `/Users/oabrivard/Projects/rust/ai_synth/docs/technical_specs.md:249`, `/Users/oabrivard/Projects/rust/ai_synth/docs/technical_specs.md:251`
|
|
- Direction: centralize allowed enums and mirror backend contract.
|
|
|
|
- i18n guideline is violated by hardcoded French strings in JSX/logic.
|
|
- Evidence: `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/ArticleHistory.tsx:140`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/ArticleHistory.tsx:308`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/components/settings/SettingsBraveSearch.tsx:58`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/components/ApiKeyManager.tsx:132`, `/Users/oabrivard/Projects/rust/ai_synth/docs/dev_guidelines.md:196`
|
|
- Direction: move all user-facing strings to `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/i18n/fr.ts`.
|
|
|
|
- SSE lifecycle cleanup is fragile and may leave open connections.
|
|
- Evidence: `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/GenerateSynthesis.tsx:225`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/GenerateSynthesis.tsx:241`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/GenerateSynthesis.tsx:251`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/utils/sse.ts:156`
|
|
- Direction: own connection lifecycle in page-level `onCleanup`; keep SSE utility side-effect free.
|
|
|
|
### P2
|
|
- State mutation occurs during render in admin providers.
|
|
- Evidence: `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/admin/Providers.tsx:559`
|
|
- Direction: initialize edit state in dedicated `createEffect`.
|
|
|
|
- Frontend complexity is too high in several page components.
|
|
- Evidence: `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/ThemeManager.tsx`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/admin/Providers.tsx`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/Settings.tsx`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/SynthesisDetail.tsx`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/GenerateSynthesis.tsx`
|
|
- Direction: extract composables/hooks and split large UI sections.
|
|
|
|
- API layer is bypassed in places with raw `fetch`.
|
|
- Evidence: `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/GenerateSynthesis.tsx:241`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/api/client.ts:25`
|
|
- Direction: add typed API method and remove direct fetch from pages.
|
|
|
|
### P3
|
|
- Dead reactive effect and redundant flow in article history.
|
|
- Evidence: `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/ArticleHistory.tsx:91`
|
|
- Direction: replace with `createResource` keyed by filters/page or remove no-op effect.
|
|
|
|
- Style guideline drift (imports, raw button usage).
|
|
- Evidence: `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/index.tsx:4`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/api/themes.ts:1`, `/Users/oabrivard/Projects/rust/ai_synth/frontend/src/pages/Home.tsx:196`, `/Users/oabrivard/Projects/rust/ai_synth/docs/dev_guidelines.md:181`, `/Users/oabrivard/Projects/rust/ai_synth/docs/dev_guidelines.md:207`
|
|
- Direction: add ESLint rules/codemods for import alias and button policy.
|
|
|
|
## Immediate High-Impact Refactoring Order
|
|
1. Fix `ArticleHistory` contract mismatches for enums/labels.
|
|
2. Normalize i18n usage and remove hardcoded strings.
|
|
3. Refactor SSE lifecycle ownership in generation flow.
|
|
4. Split `ThemeManager` and `admin/Providers` into hooks + presentational components.
|
|
5. Enforce conventions with lint rules.
|