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.
3.3 KiB
3.3 KiB
Consolidated Refactoring Plan (From 5-Agent Audit)
Inputs
- Software architect report
- Frontend SolidJS report
- Backend Rust report
- Technical lead report
- QA integration/E2E report
Clarifications Required Before Implementation
- Theme creation contract:
- Draft allowed with empty topic/categories, or mandatory valid values on create?
- Schedule GET contract:
404when absent, or200withnull?
- Canonical theme defaults:
max_items_per_category/summary_lengthshould be 4/3 or 5/2?
- Theme scoping policy:
- Are import/export/preferred operations always theme-scoped?
- Terminology:
- Fallback category label (
AutrevsDivers) - Source-link extraction mode still required or deprecated
- Fallback category label (
Executive Summary
- The codebase has good foundations (clear layering intent, provider abstraction, strong backend unit coverage), but there is significant spec/implementation drift in theme/schedule/source contracts.
- Highest risk is correctness, not style: multi-theme data scoping and contract mismatches can break core user flows.
- Complexity is concentrated in a few large files; decomposition should happen only after correctness and reliability fixes.
Priority Backlog
P0 (Immediate)
- Fix theme-scoped source correctness:
- Ensure bulk/CSV import preserves
theme_id - Scope preferred-source updates by theme
- Make CSV export theme-aware
- Ensure bulk/CSV import preserves
- Fix theme creation flow contract mismatch:
- Align UI create payload and backend validation
- Add tests for P0 flows:
- Multi-theme isolation integration tests
- End-to-end create theme happy path
P1 (Next)
- Unify schedule API contract across docs/backend/frontend/tests.
- Align theme defaults across migration/backend/frontend/docs.
- Harden scheduler reliability:
- deterministic integration tests
- timeout parity with manual generation
- Add deterministic SSE progress integration tests.
- Add Brave fallback/rate-limit/max-age pipeline integration coverage.
P2 (Then)
- Decompose backend synthesis pipeline module by phase.
- Decompose large frontend pages (
ThemeManager,Providers,Settings) into hooks/components. - Remove direct
fetchin pages; enforce API client boundary. - Remove hardcoded UI strings; enforce i18n conventions.
- Replace silent
.ok()error swallowing with warn/metric patterns.
P3 (Opportunistic)
- Convention enforcement via lint/codemods.
- Clean reactive anti-patterns (render-time side effects).
- Performance optimizations (N+1 phase-2 checks, set-based inserts).
Suggested Delivery Sequence (For Follow-up Team)
- Decision sprint (0.5-1 day): finalize 5 open clarifications.
- Correctness sprint (1-2 weeks): all P0 + tests merged.
- Reliability sprint (1 week): scheduler/SSE/fallback/rate-limit/max-age tests + runtime parity fixes.
- Simplification sprint (1-2 weeks): decomposition of largest backend/frontend hotspots.
- Governance sprint (2-3 days): lint/conformance checks to prevent drift.
Acceptance Criteria
- No spec drift for theme/schedule/source contracts (tests and docs aligned).
- Multi-theme operations fully isolated and verifiably correct.
- Scheduled generation reliability covered by deterministic integration tests.
- SSE and fallback branches have deterministic coverage in CI.
- Largest hotspots reduced in size and complexity with no behavior regression.