Commit graph

335 commits

Author SHA1 Message Date
senke
b7551c2841 api-contracts: add validation error recovery mechanism
- Added cache fallback: uses cached response for GET requests when validation fails
- Added optional retry mechanism (disabled by default, enabled via config)
- Added user notifications for recovery actions (configurable)
- Recovery config: { useCache, retry, notifyUser } on request config
- Prevents infinite retry loops with _validationRetryAttempted flag
- Validates cached responses before using them
- Handles both wrapped and direct format responses
- Graceful degradation: falls back to unvalidated data if recovery fails
- Applied to both validation sections (wrapped and direct formats)
- Action 1.2.2.5 complete - validation errors now handled gracefully
2026-01-15 17:25:44 +01:00
senke
5412720318 api-contracts: add validation error alerting for high failure rates
- Created ValidationAlerting class to monitor validation metrics
- Alerts when failure rate exceeds threshold (default 5%)
- Periodic checks every 5 minutes (configurable)
- Cooldown period (15 min) to prevent alert spam
- Minimum validations required (10) before alerting
- Structured alert logging with full metrics context
- Automatically starts in production (can be disabled via env var)
- Alerts sent to backend logging and Sentry
- Action 1.2.2.4 complete - validation alerting now active for monitoring
2026-01-15 17:23:01 +01:00
senke
65427efd8b api-contracts: add validation error metrics tracking
- Created ValidationMetricsTracker class to track validation metrics
- Tracks total, successful, and failed validations
- Calculates failure rate percentage
- Tracks failures by normalized endpoint patterns
- Records last failure and success timestamps
- Integrated into both validation points (wrapped and direct formats)
- Exported singleton for metrics access and monitoring
- Action 1.2.2.3 complete - validation metrics now tracked for monitoring
2026-01-15 17:21:41 +01:00
senke
5170085d48 api-contracts: add production error logging for validation failures
- Enhanced validation error logging with production monitoring context
- Added error_type field for easy filtering in monitoring systems
- Added timestamp and schema_provided flag for correlation
- Logs automatically sent to backend endpoint and Sentry in production
- Structured JSON format for easy aggregation and alerting
- Action 1.2.2.2 complete - validation failures now fully logged for production monitoring
2026-01-15 17:19:17 +01:00
senke
ca43af5606 api-contracts: enhance response validation for all responses with schemas
- Enhanced response validation logging (wrapped and direct formats)
- Changed validation failures from warn to error level for better visibility
- Added structured error details (path, message, code, received, expected)
- Added response data preview for debugging
- Added success logging in debug mode
- Maintains graceful degradation (continues with unvalidated data) to avoid breaking app
- Action 1.2.2.1 complete - validation now comprehensive for all responses with schemas
2026-01-15 17:18:02 +01:00
senke
50baff3d62 api-contracts: update feature-specific auth types to use generated types
- Replace RefreshResponse with VezaBackendApiInternalDtoTokenResponse
- Replace ResendVerificationRequest with VezaBackendApiInternalDtoResendVerificationRequest
- Keep AuthResponse as is (uses extended User/AuthTokens)
- Keep form data types (frontend-specific)
- Tracks types already updated, roles/chat/settings kept as is
2026-01-15 17:13:43 +01:00
senke
e2feac8023 api-contracts: update barrel exports to document generated type usage
- Add documentation noting User, Track extend generated types
- Export generated types directly for advanced use cases
- Update comments to reflect ApiError location (schemas)
- All existing imports continue to work via barrel exports
2026-01-15 17:11:23 +01:00
senke
6f2ce84fb6 api-contracts: replace User interface with generated type base
- Update User type in types/api.ts to extend VezaBackendApiInternalModelsUser
- Preserve UI-specific computed fields (avatar_url, stats, roles, status, etc.)
- Make required fields actually required (id, username, email, role, etc.)
- All existing imports continue to work via barrel exports
- No User-specific TypeScript errors introduced
2026-01-15 17:09:14 +01:00
senke
8f60275b1f api-contracts: replace Track interface with generated type base
- Update Track type in types/api.ts to extend VezaBackendApiInternalModelsTrack
- Update Track type in features/tracks/types/track.ts to extend generated type
- Preserve UI-specific computed fields (coverUrl, plays, likes, etc.)
- Support backward compatibility for duration (number|string)
- All existing imports continue to work without changes
- No Track-specific TypeScript errors introduced
2026-01-15 17:07:50 +01:00
senke
1cdd274f00 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
17f7887c2a api-contracts: add type generation to pre-commit hook
- Install husky as dev dependency
- Create pre-commit hook to run type generation script
- Ensures types are always up-to-date with backend API before commit
- Hook runs from apps/web directory to execute generate-types.sh
2026-01-15 17:00:30 +01:00
senke
263c537b1e api-versioning: add X-API-Deprecated header and frontend deprecation warning
- Backend: Add X-API-Deprecated header alongside existing X-API-Version-Deprecated
- Frontend: Show deprecation warning toast when deprecated API version detected
- Warning shown only once per session to avoid spam
- Includes sunset date in warning message if available
2026-01-15 16:56:21 +01:00
senke
ea6d5202e2 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
6d909acfd4 state-ownership: audit all files using useAuthStore().user
Found 24 files using user from authStore:
- 18 components (Header, DashboardPage, Chat components, etc.)
- 4 hooks (useAuth, useChat, useLogin)
- 2 utilities (stateHydration, storeSelectors docs)

Created comprehensive audit document with migration strategy.

Action 4.1.1.2 complete
2026-01-14 01:40:42 +01:00
senke
95b1931c88 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
32d89d80eb incus deployement fully implemented, Makefile updated and make fmt ran 2026-01-13 19:47:57 +01:00
senke
995e71bcfb 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
9c366d4ba2 state-ownership: audit components using library store domain data - found 2 DashboardPage components and storeSelectors utility 2026-01-11 18:21:08 +01:00
senke
43548ab144 state-ownership: create React Query hooks for library items (useLibraryItems, useLibraryFavorites) 2026-01-11 18:19:52 +01:00
senke
c7b42b1ebd state-ownership: audit library store domain data - identified 3 domain fields and 3 UI state fields 2026-01-11 18:18:45 +01:00
senke
3aa0341b12 state-ownership: audit track queries React Query usage - only comments/likes use React Query 2026-01-11 18:18:15 +01:00
senke
977f02dbda state-ownership: update STATE_SELECTORS.md with correct auth store import path 2026-01-11 18:17:45 +01:00
senke
69e8557145 state-ownership: update STATE_DEBUGGING.md to reflect current store structure (Action 4.6.1.7) 2026-01-11 18:04:42 +01:00
senke
eed64df580 state-ownership: remove obsolete state utilities (stateCleanup, stateVersioning, statePersistence) 2026-01-11 18:03:58 +01:00
senke
d12fa69469 state-ownership: categorize state utilities as needed, redundant, or obsolete (Action 4.6.1.2) 2026-01-11 18:03:13 +01:00
senke
b6dd14c494 state-ownership: audit cartStore for domain data (Action 4.5.1.6) 2026-01-11 18:00:11 +01:00
senke
1a10e550fc state-ownership: list all state utility files (Action 4.6.1.1) 2026-01-11 17:58:05 +01:00
senke
675723047a state-ownership: verify stores/auth.ts is removed (Action 4.5.1.3) 2026-01-11 17:57:19 +01:00
senke
bc8243dbaf state-ownership: list all Zustand stores (Action 4.5.1.1) 2026-01-11 17:56:31 +01:00
senke
136a0aafcf state-ownership: audit all mutations for optimistic updates (Action 4.4.1.4) 2026-01-11 17:55:39 +01:00
senke
d139ebdbca state-ownership: audit custom optimistic updates (Action 4.4.1.1) 2026-01-11 17:43:51 +01:00
senke
c56ef95ac3 state-ownership: create React Query hook for user (Action 4.1.1.1) 2026-01-11 17:43:07 +01:00
senke
b1f4a4d949 error-propagation: integrate offline detection utility with error handler 2026-01-11 17:42:04 +01:00
senke
8ddada1939 error-propagation: add offline detection utility 2026-01-11 17:41:37 +01:00
senke
4f18f566ae error-propagation: enhance network error detection to distinguish timeout, connection refused, and offline 2026-01-11 17:41:08 +01:00
senke
d2bf96d136 error-propagation: fix retry handlers and mark Action 3.4.1.3 complete 2026-01-11 17:40:21 +01:00
senke
274c3fdd99 error-propagation: implement retry for failed mutations (remaining handlers) 2026-01-11 17:39:51 +01:00
senke
bb9a0e655c error-propagation: implement retry for failed mutations (ShareDialog, CommentSection) 2026-01-11 17:38:54 +01:00
senke
6e16fce1b9 error-propagation: implement retry for failed mutations (MarketplaceHome, RolesPage, SettingsPage) 2026-01-11 17:38:15 +01:00
senke
f929e8ebd0 error-propagation: implement retry for failed mutations (AccountSettings) 2026-01-11 17:37:04 +01:00
senke
aee6624e2e error-propagation: implement retry for failed mutations (Cart) 2026-01-11 17:36:33 +01:00
senke
318ea5e06e error-propagation: implement retry for failed mutations (ProfileForm, LibraryPage) 2026-01-11 17:35:38 +01:00
senke
ff00fa6ba0 error-propagation: audit all mutation error handlers 2026-01-11 17:33:30 +01:00
senke
a5fb8b6b28 error-propagation: enhance error boundary logging for monitoring 2026-01-11 17:33:03 +01:00
senke
23a9ffd25b error-propagation: update ErrorBoundary to use ErrorDisplay component 2026-01-11 17:32:25 +01:00
senke
b6577cf969 error-propagation: audit existing ErrorBoundary usage 2026-01-11 17:31:41 +01:00
senke
fccc2db5e1 error-propagation: highlight form fields on validation errors 2026-01-11 17:31:12 +01:00
senke
27ce7a5391 error-propagation: redirect to login on auth errors 2026-01-11 17:29:55 +01:00
senke
dbd2a4ad15 error-propagation: integrate issue reporting with ErrorDisplay 2026-01-11 17:29:11 +01:00
senke
9e24dd9367 error-propagation: create support issue reporting utility 2026-01-11 17:27:45 +01:00