veza/apps/web/docs/TODO_COMMENTS_AUDIT.md

190 lines
8.7 KiB
Markdown

# TODO Comments Audit
**Date**: 2025-01-27
**Action**: Cleanup 13 - Audit TODO/FIXME/XXX/HACK comments
**Status**: ✅ Complete
**Phase 3 Update (2026-02)**: AbortController propagation done. Ghost features (Education, Studio, Gamification) removed. Remaining TODOs documented for future sprints.
## Summary
This audit identifies all TODO, FIXME, XXX, and HACK comments in the codebase and categorizes them for action.
## Methodology
Searched for:
- `TODO`
- `FIXME`
- `XXX`
- `HACK`
**Excluded**:
- Generated files (`types/generated/`)
- Test files (TODO comments in tests are often intentional placeholders)
- Documentation files (markdown files)
## Findings
**Total TODO/FIXME/XXX/HACK comments found**: 26 (excluding generated files)
### Categories
#### 1. ✅ **Preserve** (Backend Dependency - Future Work)
These TODOs indicate features waiting for backend implementation. They should be preserved until backend is ready.
- **`config/features.ts:7`**: `TODO: Move these to environment variables or backend config after MVP.`
- **Context**: Feature flags configuration
- **Action**: Keep until MVP is complete, then migrate to backend config
- **Priority**: LOW (post-MVP)
- **`features/streaming/services/hlsService.ts:9`**: `TODO: Enable when backend implements /api/v1/tracks/:id/hls/* endpoints`
- **Context**: HLS streaming service (disabled feature)
- **Action**: Keep until backend implements HLS endpoints
- **Priority**: MEDIUM (feature blocked by backend)
- **`features/playlists/services/playlistService.ts:258`**: `TODO: Enable when backend implements GET /api/v1/playlists/recommendations`
- **Context**: Playlist recommendations (disabled feature)
- **Action**: Keep until backend implements recommendations endpoint
- **Priority**: LOW (feature disabled)
- **`features/playlists/services/playlistService.ts:266`**: `TODO: Replace with actual API call when backend is ready`
- **Context**: Mock implementation for playlist recommendations
- **Action**: Keep until backend is ready
- **Priority**: LOW (feature disabled)
- **`features/playlists/services/playlistService.ts`**: Multiple TODOs for disabled features:
- `TODO: Enable when backend implements GET /api/v1/playlists/search`
- `TODO: Enable when backend implements POST /api/v1/playlists/:id/share`
- **Action**: Keep until backend implements these features
- **Priority**: LOW (features disabled)
#### 2. ⚠️ **Action Required** (Implementation Needed)
These TODOs indicate missing functionality that should be implemented.
- **`services/websocket.ts`**: `TODO: Implement removal for other event types if needed`
- **Context**: WebSocket event handler cleanup
- **Action**: Review if needed, implement or remove TODO
- **Priority**: LOW (may not be needed)
- **`features/tracks/components/TrackSearchResults.tsx`**: `TODO: Implement play functionality`
- **Context**: Track search results component
- **Action**: Implement play functionality or remove if not needed
- **Priority**: MEDIUM (user-facing feature)
- **`features/library/components/LibraryManager.tsx`**: `TODO: Implement edit track functionality`
- **Context**: Library manager component
- **Action**: Implement edit functionality or remove if not needed
- **Priority**: MEDIUM (user-facing feature)
- **`features/library/pages/LibraryPage.tsx`**: `TODO: Play track`
- **Context**: Library page
- **Action**: Implement play functionality or remove if not needed
- **Priority**: MEDIUM (user-facing feature)
- **`features/chat/hooks/useChat.ts`**: `TODO: Add fetchHistory function`
- **Context**: Chat hook
- **Action**: Implement fetchHistory or remove if not needed
- **Priority**: LOW (may be handled elsewhere)
- **`features/auth/utils/ipLocation.ts:72`**: `TODO: Implement actual IP geolocation API call`
- **Context**: IP location utility (currently returns null)
- **Action**: Implement IP geolocation API call or remove if not needed
- **Priority**: LOW (nice-to-have feature)
#### 3. 🔧 **Fix Required** (Bug/Issue)
These TODOs indicate bugs or issues that need to be fixed.
- **`features/auth/components/TwoFactorVerify.tsx:47`**: `TODO: Fix this - twoFactorService.verify is for setup, not login verification`
- **Context**: Two-factor authentication verification component
- **Action**: **HIGH PRIORITY** - Fix the verification logic for login flow
- **Priority**: HIGH (authentication bug)
- **`services/requestDeduplication.test.ts`**: `TODO: Investigate why _disableDeduplication flag isn't working as expected`
- **Context**: Test file for request deduplication
- **Action**: Investigate and fix the test issue
- **Priority**: MEDIUM (test reliability)
#### 4. 🔄 **Refactor/Migration** (Code Improvement)
These TODOs indicate code that should be refactored or migrated.
- **`features/sessions/api/sessionsApi.ts`**: `TODO: Consider creating @/services/api/sessions (sessionsApi) in the future`
- **Context**: Sessions API (consider moving to services)
- **Action**: Keep as future improvement, or implement if needed
- **Priority**: LOW (architectural improvement)
- **`features/admin/api/auditService.ts`**: `TODO: Consider creating @/services/api/admin (adminApi) or @/services/api/audit (auditApi)`
- **Context**: Audit service (consider moving to services)
- **Action**: Keep as future improvement, or implement if needed
- **Priority**: LOW (architectural improvement)
- **`features/webhooks/api/webhookApi.ts`**: `TODO: Consider creating @/services/api/webhooks (webhooksApi) in the future`
- **Context**: Webhooks API (consider moving to services)
- **Action**: Keep as future improvement, or implement if needed
- **Priority**: LOW (architectural improvement)
- **`utils/storeSelectors.ts`**: Multiple TODOs for React Query migration:
- `TODO: Re-enable useShallow once initialization issue is resolved`
- `TODO: Migrate to React Query mutation with optimistic update` (3 instances)
- **Context**: Store selectors utility (migration to React Query)
- **Action**: Keep until React Query migration is complete
- **Priority**: MEDIUM (part of ongoing migration)
- **`features/chat/components/ChatInterface.tsx`**: `TODO: wsService should be replaced with websocketService or a proper chat service`
- **Context**: Chat interface component
- **Action**: Replace wsService with proper service or remove TODO if already done
- **Priority**: LOW (code cleanup)
- **`features/chat/components/ChatRoom.tsx`**: `TODO: Check with current user ID from store`
- **Context**: Chat room component (isMe check)
- **Action**: Implement proper user ID check or remove if already done
- **Priority**: LOW (code improvement)
- **`features/playlists/components/PlaylistList.tsx`**: `TODO: Retirer ce tri côté client une fois que le backend supporte le tri`
- **Context**: Client-side sorting (should be moved to backend)
- **Action**: Keep until backend supports sorting
- **Priority**: LOW (performance improvement)
- **`features/playlists/components/PlaylistAnalytics.tsx`**: `TODO: T0491 - Remplacer par l'appel API réel une fois le backend implémenté`
- **Context**: Mock analytics data (waiting for backend)
- **Action**: Keep until backend implements analytics endpoint
- **Priority**: LOW (feature blocked by backend)
## Recommendations
### Immediate Actions (High Priority)
1. **Fix TwoFactorVerify.tsx** - Authentication bug that needs immediate attention
- File: `features/auth/components/TwoFactorVerify.tsx:47`
- Action: Fix verification logic for login flow
### Short-term Actions (Medium Priority)
2. **Implement missing play functionality** - User-facing features
- Files: `TrackSearchResults.tsx`, `LibraryPage.tsx`
- Action: Implement play functionality or remove TODOs if not needed
3. **Fix request deduplication test** - Test reliability
- File: `services/requestDeduplication.test.ts`
- Action: Investigate and fix the test issue
### Long-term Actions (Low Priority)
4. **Backend-dependent features** - Keep TODOs until backend is ready
- Files: Various playlist/streaming services
- Action: Preserve TODOs, remove when backend implements
5. **Architectural improvements** - Future refactoring
- Files: Various API services
- Action: Keep as future improvements, or implement if needed
6. **React Query migration** - Ongoing migration
- File: `utils/storeSelectors.ts`
- Action: Keep until migration is complete
## Next Steps
- **Cleanup 14**: Address or remove TODO comments based on this audit
- **High Priority**: Fix TwoFactorVerify.tsx authentication bug
- **Medium Priority**: Implement play functionality or remove TODOs
- **Low Priority**: Keep backend-dependent TODOs, remove obsolete ones
---
**Last Updated**: 2025-01-27
**Status**: Audit complete - Ready for Cleanup 14