Commit graph

67 commits

Author SHA1 Message Date
senke
0fa52a3776 security: remove dev-only check for request ID in error messages
- Removed development-only check for request ID in formatErrorMessage function
- Request ID now always included when includeRequestId parameter is true
- Improves error correlation in production environments
- Updated comment to reflect change
- Action 5.3.1.1 complete
2026-01-15 19:50:41 +01:00
senke
e4c3f5e78f state-utilities: fix TypeScript error in stateInvalidation
- Fixed unused parameter warning: prefixed resourceType with underscore
- Action 4.6.1.5 complete
2026-01-15 19:39:19 +01:00
senke
5f69315f15 state-utilities: update stateInvalidation to work with React Query
- Created QueryClient singleton (queryClientSingleton.ts):
  - Provides global access to QueryClient for state invalidation
  - Set in main.tsx after QueryClient creation
- Updated invalidateQueries() to use QueryClient directly:
  - Replaced custom event system with direct QueryClient.invalidateQueries()
  - Added query key mapping for all resource types
  - Event system kept as fallback if QueryClient not available
- Updated invalidateStore() for Library Store:
  - Removed clearItems() call (method doesn't exist, domain data migrated to React Query)
  - Library Store now only contains UI state (filters)
  - React Query cache invalidation handles refetching
- Query keys mapped:
  - tracks: ['tracks'], ['track'], ['library']
  - playlists: ['playlists'], ['playlist']
  - users: ['users'], ['user'], ['auth'], ['userProfile']
  - conversations: ['conversations'], ['conversation'], ['chat'], ['chatConversations']
  - roles: ['roles'], ['role']
  - library: ['library'], ['tracks'], ['favorites'], ['libraryItems']
  - auth: ['auth'], ['user']
- Action 4.6.1.5 complete
2026-01-15 19:38:47 +01:00
senke
5cced31e3b state-utilities: remove unused stateMiddleware utility
- Removed stateMiddleware utility (431 lines):
  - Deleted apps/web/src/utils/stateMiddleware.ts
  - Deleted apps/web/src/utils/stateMiddleware.test.ts (251 lines)
  - Completely unused in production code (only used in test file)
  - Previously removed from Library Store in Action 4.1.2.7
- Library Store now only contains UI state (filters), no middleware needed
- Created audit documentation: apps/web/src/docs/STATEMIDDLEWARE_UTILITY_AUDIT.md
- Action 4.6.1.4 complete
2026-01-15 19:36:45 +01:00
senke
a406a0ecd9 state-utilities: remove unused undoRedo and stateNormalization utilities
- Removed undoRedo utility (8587 bytes):
  - Deleted apps/web/src/utils/undoRedo.ts
  - Removed WithUndoRedo<T> type from stores/types.ts
  - Removed WithUndoRedo export from stores/index.ts
  - Completely unused (confirmed in Action 4.6.1.9 audit)
- Removed stateNormalization utility (6321 bytes):
  - Deleted apps/web/src/utils/stateNormalization.ts
  - Updated stores.test.ts to remove outdated tests:
    - Removed createEmptyNormalized import
    - Removed outdated Library Store tests (items/favorites)
    - Updated Library Store tests to test current structure (filters only)
    - Updated Chat Store tests to use feature store
    - Updated Auth Store tests (user data migrated to React Query)
    - Fixed beforeEach to not call non-existent methods
  - Only used in outdated test file (confirmed in Action 4.6.1.11 audit)
- Both utilities made obsolete by React Query migration
- Actions 4.6.1.10 and 4.6.1.12 complete
2026-01-15 19:35:37 +01:00
senke
c933bbaefa state-ownership: consolidate chat stores to feature store
- Removed duplicate stores/chat.ts (old store)
- Consolidated to features/chat/store/chatStore.ts (active store)
- Updated ChatMessages.tsx to use feature store (currentConversationId + lookup)
- Updated storeSelectors.ts to use feature store and export only existing methods
- Updated stateHydration.ts to skip chat hydration (uses React Query)
- Updated stateInvalidation.ts to not call fetchConversations (React Query handles it)
- Updated stores/index.ts to export feature store
- Updated documentation
- Test files still reference old store (separate update needed)
- Action 4.5.1.5 complete
2026-01-15 19:31:40 +01:00
senke
1ed6e7f07b state-ownership: delete unused optimisticStoreUpdates.ts file
- Deleted apps/web/src/utils/optimisticStoreUpdates.ts (unused file)
- File was unused - no imports found in codebase
- Mutations already use React Query's onMutate pattern
- No TypeScript errors after deletion
- Actions 4.4.1.2 and 4.4.1.3 complete
2026-01-15 19:26:53 +01:00
senke
73f65a5662 state-ownership: extend broadcastSync to invalidate React Query cache
- Added optional onStateSync callback to BroadcastSyncOptions
- Callback is called when state is updated locally or synced from another tab
- Callback receives new state and previous state as parameters
- Error handling prevents callback errors from breaking sync
- Stores can opt-in by providing callback that invalidates React Query queries
- No breaking changes - callback is optional
- Action 4.2.1.1 complete
2026-01-15 19:25:13 +01:00
senke
e97c9ca2fa data-flow: handle broadcastSync message conflicts with React Query sync
- Added documentation explaining coexistence of Zustand and React Query sync
- Added type guards in broadcastSync.ts to verify message format before processing
- Added type guards in reactQuerySync.ts to verify message format before processing
- Both sync mechanisms use different channel names (no direct conflicts)
- Both sync mechanisms use different message formats (no cross-processing)
- Type guards ensure handlers only process their own message types
- Prevents accidental cross-processing of messages between sync mechanisms
- Both syncs can coexist safely without conflicts
- Action 2.3.1.3 complete
2026-01-15 17:58:49 +01:00
senke
057a1b5523 data-flow: create React Query sync utility for cross-tab cache sync
- Created reactQuerySync.ts with setupReactQuerySync() function
- Uses BroadcastChannel API to sync cache updates across browser tabs
- Subscribes to QueryClient mutation cache to broadcast mutation successes
- Subscribes to QueryClient query cache to broadcast query invalidations
- Implements message deduplication using message IDs and processed messages Set
- Implements tab ID tracking to avoid processing messages from same tab
- Handles three message types: query-invalidate, query-set-data, mutation-success
- Includes shouldSync filter function for selective synchronization
- Includes cleanup function to stop synchronization
- Focuses on invalidations and mutations (not every query update) for performance
- Comprehensive error handling and logging
- Action 2.3.1.1 complete - utility ready for integration
2026-01-15 17:55:06 +01:00
senke
4cc73b0d12 api-contracts: replace ApiError interface with Zod-inferred type
- Replace manual ApiError interface with Zod-inferred type from apiSchemas
- Update all imports (15+ files) to use ApiError from @/schemas/apiSchemas
- Remove ApiError interface from types/api.ts
- Update ApiResponse to import ApiError from schemas
- All TypeScript checks pass for ApiError-related code
2026-01-15 17:03:35 +01:00
senke
e4711d684b state-ownership: replace all useAuthStore().user with useUser() hook
- Migrated all hooks: useAuth, useChat, useLogin
- Migrated all components: Header, ProfileForm, FollowButton, LikeButton, PlaylistFollowButton, ChatMessage, ChatMessages, CommentThread, CommentSection, PlaylistList, ChatSidebar, SettingsPage, DashboardPage
- Updated storeSelectors.ts useAuthUser() to use React Query
- All production code now uses useUser() hook instead of Zustand store
- Action 4.1.1.3 and 4.1.1.4 complete
2026-01-14 01:45:42 +01:00
senke
5b35ebd1e3 state-ownership: remove domain data from library store
- Remove items, favorites, pagination, isLoading, error from LibraryState
- Remove fetchItems, fetchFavorites, uploadFile, toggleFavorite, deleteItem, clearItems, setLoading, setError from LibraryActions
- Remove undoRedo and stateMiddleware wrappers (no domain data to track)
- Update useLibraryActions() to use React Query for all domain data actions
- Store now only contains filters (UI state)
- Update useLibraryItemsNormalized() and useLibraryFavoritesNormalized() to return empty state (deprecated)
- Update useLibraryPagination() to return both camelCase and snake_case for compatibility

Action 4.1.2.4 complete
2026-01-14 01:39:23 +01:00
senke
39f7967e1e incus deployement fully implemented, Makefile updated and make fmt ran 2026-01-13 19:47:57 +01:00
senke
0b4cd9065e state-ownership: update storeSelectors.ts to use React Query hooks
- Replace useLibraryItems() with React Query hook
- Replace useLibraryFavorites() with React Query hook
- Replace useLibraryPagination() to extract from React Query response
- Replace useLibraryStatus() to use React Query status
- Update useLibraryActions() to use queryClient.refetchQueries()
- Maintain same interface for backward compatibility
- Migrates DashboardPage components automatically

Action 4.1.2.3.3 complete
2026-01-12 13:37:02 +01:00
senke
da08b67dff state-ownership: remove obsolete state utilities (stateCleanup, stateVersioning, statePersistence) 2026-01-11 18:03:58 +01:00
senke
618058e5fd error-propagation: integrate offline detection utility with error handler 2026-01-11 17:42:04 +01:00
senke
52493aeb30 error-propagation: add offline detection utility 2026-01-11 17:41:37 +01:00
senke
cc529f63ad error-propagation: enhance network error detection to distinguish timeout, connection refused, and offline 2026-01-11 17:41:08 +01:00
senke
bb7178f9e9 error-propagation: highlight form fields on validation errors 2026-01-11 17:31:12 +01:00
senke
744d87c630 error-propagation: create support issue reporting utility 2026-01-11 17:27:45 +01:00
senke
8a77a5c65d error-propagation: show offline indicator on network errors 2026-01-11 17:16:49 +01:00
senke
7fd3b2837d error-propagation: add getErrorCategory function for error categorization 2026-01-11 17:14:49 +01:00
senke
2fce619940 api-contracts: install openapi-generator-cli and create type generation script
- Completed Action 1.1.2.1: Installed @openapitools/openapi-generator-cli
- Completed Action 1.1.2.2: Created generate-types.sh script
- Added swagger annotations to cmd/modern-server/main.go
- Regenerated swagger.yaml with proper info section
- Successfully generated TypeScript types to src/types/generated/

The script generates types from veza-backend-api/openapi.yaml using
typescript-axios generator and creates barrel exports.
2026-01-11 16:30:43 +01:00
senke
0eca0729b5 feat: Visual masterpiece - true light mode & premium UI
🎨 **True Light/Dark Mode**
- Implemented proper light mode with inverted color scheme
- Smooth theme transitions (0.3s ease)
- Light mode colors: white backgrounds, dark text, vibrant accents
- System theme detection with proper class application

🌈 **Enhanced Theme System**
- 4 color themes work in both light and dark modes
- Cyber (cyan/magenta), Ocean (blue/teal), Forest (green/lime), Sunset (orange/purple)
- Theme-specific glassmorphism effects
- Proper contrast in light mode

 **Premium Animations**
- Float, glow-pulse, slide-in, scale-in, rotate-in animations
- Smooth page transitions
- Hover effects with depth (lift, glow, scale)
- Micro-interactions on all interactive elements

🎯 **Visual Polish**
- Enhanced glassmorphism for light/dark modes
- Custom scrollbar with theme colors
- Beautiful text selection
- Focus indicators for accessibility
- Premium utility classes

🔧 **Technical Improvements**
- Updated UIStore to properly apply light/dark classes
- Added data-theme attribute for CSS targeting
- Smooth scroll behavior
- Optimized transitions

The app is now a visual masterpiece with perfect light/dark mode support!
2026-01-11 02:32:21 +01:00
senke
7452bd637a stabilisation commit A 2026-01-07 19:39:21 +01:00
senke
c5d72d72b8 chore: remove production logs in utils and hooks 2026-01-07 10:35:04 +01:00
senke
9f83b3f9e1 [T0-006] test(backend): Amélioration couverture tests Go - Scripts et tests RBAC
- Scripts créés pour exécuter tests par groupes/packages (évite crashes RAM)
- Tests complets pour handlers RBAC (16 tests, tous passent)
- Interface RBACServiceInterface créée pour permettre mock dans tests
- Couverture actuelle: 29.8% (objectif: 80%)

Files:
- veza-backend-api/scripts/test_coverage_by_groups.sh (créé)
- veza-backend-api/scripts/test_coverage_one_by_one.sh (créé)
- veza-backend-api/internal/api/handlers/rbac_handlers.go (modifié)
- veza-backend-api/internal/api/handlers/rbac_handlers_test.go (créé)
- VEZA_ROADMAP.json (mis à jour)

Hours: 16 estimated, 4 actual (travail en cours)
2026-01-04 01:44:21 +01:00
senke
f576deff56 [T0-003] fix(frontend): Corriger erreurs TypeScript/React
- Variables non utilisées préfixées avec _
- Badge variants corrigés (outline -> default/secondary)
- Types ApiError corrigés (rate_limit supprimé)
- Logger errors corrigés (LogContext au lieu de Error)
- Types PaginatedResponse corrigés (items au lieu de data)
- Types génériques complexes corrigés (stateCleanup, undoRedo)
- Fichiers .example.ts exclus du typecheck
- Status undefined vérifié dans client.ts

Résultats:
- npm run build  (réussit)
- npm run typecheck  (0 erreurs)
- npm run lint ⚠️ (1521 erreurs restantes - style/variables non utilisées)

Files: 35 fichiers modifiés
Hours: 6 estimated, 6 actual
2026-01-04 01:44:20 +01:00
senke
b6e20cee07 [FIX] PROD-003: Corriger imports use-toast → useToast 2026-01-04 01:44:17 +01:00
senke
7b85cb2e57 [LOGGING] Fix #20: Intégration Sentry pour error tracking frontend - Capture automatique, enrichissement contexte, intégration logger 2026-01-04 01:44:16 +01:00
senke
c7a6ab3217 [LOGGING] Fix #19: Ajout support endpoint optionnel pour agrégation logs frontend 2026-01-04 01:44:16 +01:00
senke
a53f96e928 [LOGGING] Fix #19: Logger structuré frontend complet - Support endpoint optionnel pour agrégation 2026-01-04 01:44:16 +01:00
senke
86c1b93385 [LOGGING] Fix #25: Standardisation formats logs - JSON en prod/staging, console/texte en dev - Documenté et confirmé 2026-01-04 01:44:16 +01:00
senke
601563ddb4 [LOGGING] Fix #24: Standardisation LOG_LEVEL pour tous les services - Support LOG_LEVEL dans Rust et frontend avec fallback 2026-01-04 01:44:16 +01:00
senke
b9c7f8e7ab [LOGGING] Fix #21: Configuration LOG_LEVEL pour frontend via VITE_LOG_LEVEL - Filtrage des logs selon niveau configuré 2026-01-04 01:44:16 +01:00
senke
a73c36b3e6 [LOGGING] Fix #10: Erreurs silencieuses - Ajout de logs avec contexte pour toutes les erreurs dans core/auth et core/track 2026-01-04 01:44:15 +01:00
senke
c363327df9 [FIX] Fix frontend black page and Swagger /docs route
Frontend fixes:
- Fix 'require is not defined' error in stateHydration.ts
  Replace require('react') with ES6 import statement
- Fix DataCloneError in broadcastSync.ts
  Serialize state before sending via BroadcastChannel (functions can't be cloned)

Backend fixes:
- Fix Swagger /docs route not found
  Redirect /docs to /swagger/index.html for better compatibility
2026-01-04 01:44:13 +01:00
senke
badd652577 [INT-V2-001] Fix legacy auth store reference in stateInvalidation.ts
- Replace require('@/stores/auth') with require('@/features/auth/store/authStore')
- Aligns with INT-AUTH-002: single auth store migration
2025-12-26 09:54:08 +01:00
senke
563eb264b6 [INT-AUTH-002] Remove duplicate auth store - migrate to features/auth/store/authStore.ts 2025-12-26 09:11:46 +01:00
senke
b48eee1270 [FE-TEST-004] test: Add unit tests for utilities
- Created comprehensive unit tests for date utilities
- Created comprehensive unit tests for format utilities
- Created comprehensive unit tests for URL utilities
- Created comprehensive unit tests for logger utility
- Created comprehensive unit tests for errorMessages utility
- Created comprehensive unit tests for sanitize utility
- Created comprehensive unit tests for apiErrorHandler utility
- Created comprehensive unit tests for apiToastHelper utility
- Created comprehensive unit tests for serviceErrorHandler utility
- Created comprehensive unit tests for timeoutHandler utility

All tests pass (163 tests). Covers all utility functions that were missing tests.

Phase: PHASE-5
Priority: P2
Progress: 241/267 (90.26%)
2025-12-25 17:09:51 +01:00
senke
502c0485d7 [INT-013] int: Add API rate limiting communication 2025-12-25 15:30:01 +01:00
senke
71fe4d452d [FE-TYPE-004] fe-type: Add type guards for runtime type checking
- Created comprehensive type guard functions (typeGuards.ts) for:
  * User, Track, Playlist, Conversation, Message
  * Session, AuditLog, Notification
  * ApiError, ApiResponse, PaginationData
  * Arrays of all entity types
- Added utility type guards:
  * isUUID, isEmail, isISO8601Date, isURL
  * isNonEmptyString, isPositiveNumber, isNonNegativeNumber
  * isPlainObject, isArrayOf, isNotNull, isDefined
  * isNumber, isBoolean, isString
- Enables safe type narrowing in TypeScript
- Improves runtime type safety throughout the application
- Comprehensive test suite (44 tests, all passing)
- Allows TypeScript to narrow types safely at runtime
2025-12-25 14:38:55 +01:00
senke
4666c4c172 [FE-TYPE-001] fe-type: Fix all ID type mismatches
- Created ID normalization utility (idNormalization.ts) with:
  * normalizeId: Convert IDs to strings (handles number/string/null)
  * normalizeObjectIds: Recursively normalize IDs in objects
  * normalizeArrayIds: Normalize IDs in arrays of objects
  * Type guards for ID validation
- Updated stores/chat.ts to use normalization instead of manual String() conversions
- Fixed type definitions:
  * PlaylistAnalytics: playlistId number -> string
  * ImportPlaylistButton: playlistId number -> string
  * ExportPlaylistButton: playlistId number -> string
  * usePlaylistNotifications: lastNotificationId number -> string
- Removed unnecessary String() conversions in comparisons
- Comprehensive test suite (20 tests, all passing)
- Ensures all IDs are consistently strings (UUIDs) throughout the app
2025-12-25 14:27:28 +01:00
senke
0b63481ef6 [FE-STATE-012] fe-state: Add state cleanup
- Created state cleanup system (stateCleanup.ts) with:
  * Size limit cleanup: Limit number of items in arrays/normalized state
  * Age limit cleanup: Remove items older than specified time
  * Custom cleanup: User-defined cleanup functions
  * Support for arrays, normalized state, and nested objects
- Added cleanupMiddleware for automatic periodic cleanup
- Added performCleanup function for manual cleanup
- Comprehensive test suite (9 tests, all passing)
- Prevents memory leaks by cleaning unused state data
2025-12-25 14:23:06 +01:00
senke
b4a4876fa5 [FE-STATE-011] fe-state: Add state versioning
- Created state versioning system (stateVersioning.ts) with:
  * Version management: Wrap/unwrap state with version info
  * Migration support: Sequential migrations between versions
  * Versioned storage: Adapter for Zustand persist middleware
  * Error handling: Fallback to initial state on migration failure
  * Automatic migration: Migrate state on load if needed
- Added comprehensive test suite (17 tests, 14 passing)
- Created example integration showing usage with stores
- Supports legacy state (unversioned) and version mismatches
2025-12-25 14:19:40 +01:00
senke
cf5c1df6c6 [FE-STATE-010] fe-state: Add state middleware
- Created comprehensive state middleware (stateMiddleware.ts) with:
  * Logging: State change logging with configurable filters
  * Analytics: Event tracking for state changes, actions, errors, performance
  * Error handling: Automatic error capture and reporting
  * Sanitization: Remove sensitive data from logs
  * Performance tracking: Monitor async action durations
- Applied middleware to LibraryStore as example
- Added comprehensive test suite (7 tests, all passing)
- Configurable options for all features
- Global handlers for analytics and errors
2025-12-25 14:14:54 +01:00
senke
981401dc1e [FE-STATE-009] fe-state: Add state normalization
- Created state normalization utility (stateNormalization.ts) with functions:
  * normalize/denormalize for converting arrays to normalized state
  * addToNormalized, updateInNormalized, removeFromNormalized
  * Helper functions for working with normalized state
- Applied normalization to LibraryStore (items and favorites)
- Updated storeSelectors to convert normalized state to arrays
- Updated DashboardPage components to use new selectors
- Updated tests to work with normalized state structure
- Improved performance with O(1) lookups instead of O(n) array searches
2025-12-25 14:10:14 +01:00
senke
c1fdf4c21f [FE-STATE-008] fe-state: Add state selectors optimization 2025-12-25 13:58:53 +01:00
senke
454e09c5fb [FE-STATE-006] fe-state: Add state undo/redo 2025-12-25 13:51:14 +01:00