Commit Graph

14 Commits

Author SHA1 Message Date
Claude
5a84be83d6 Fix multiple critical bugs in onboarding training step
This commit addresses all identified bugs and issues in the training code path:

## Critical Fixes:
- Add get_start_time() method to TrainingLogRepository and fix non-existent method call
- Remove duplicate training.started event from API endpoint (trainer publishes the accurate one)
- Add missing progress events for 80-100% range (85%, 92%, 94%) to eliminate progress "dead zone"

## High Priority Fixes:
- Fix division by zero risk in time estimation with double-check and max() safety
- Remove unreachable exception handler in training_operations.py
- Simplify WebSocket token refresh logic to only reconnect on actual user session changes

## Medium Priority Fixes:
- Fix auto-start training effect with useRef to prevent duplicate starts
- Add HTTP polling debounce delay (5s) to prevent race conditions with WebSocket
- Extract all magic numbers to centralized constants files:
  - Backend: services/training/app/core/training_constants.py
  - Frontend: frontend/src/constants/training.ts
- Standardize error logging with exc_info=True on critical errors

## Code Quality Improvements:
- All progress percentages now use named constants
- All timeouts and intervals now use named constants
- Improved code maintainability and readability
- Better separation of concerns

## Files Changed:
- Backend: training_service.py, trainer.py, training_events.py, progress_tracker.py
- Backend: training_operations.py, training_log_repository.py, training_constants.py (new)
- Frontend: training.ts (hooks), MLTrainingStep.tsx, training.ts (constants, new)

All training progress events now properly flow from 0% to 100% with no gaps.
2025-11-05 13:02:39 +00:00
Urtzi Alfaro
dbb48d8e2c Improve the sales import 2025-10-15 21:09:42 +02:00
Urtzi Alfaro
8f9e9a7edc Add role-based filtering and imporve code 2025-10-15 16:12:49 +02:00
Urtzi Alfaro
3c689b4f98 REFACTOR external service and improve websocket training 2025-10-09 14:11:02 +02:00
Urtzi Alfaro
4777e59e7a Add base kubernetes support final fix 4 2025-09-29 07:54:25 +02:00
Urtzi Alfaro
ddb75f8e55 Simplify the onboardinf flow components 4 2025-09-08 22:28:26 +02:00
Urtzi Alfaro
c8b1a941f8 Simplify the onboardinf flow components 2 2025-09-08 21:44:04 +02:00
Urtzi Alfaro
2e1e696cb5 Simplify the onboardinf flow components 2025-09-08 17:19:00 +02:00
Urtzi Alfaro
905f848573 Start integrating the onboarding flow with backend 8 2025-09-05 22:51:39 +02:00
Urtzi Alfaro
548a2ddd11 Start integrating the onboarding flow with backend 7 2025-09-05 22:46:28 +02:00
Urtzi Alfaro
069954981a Start integrating the onboarding flow with backend 6 2025-09-05 17:49:48 +02:00
Urtzi Alfaro
3fe1f17610 Start integrating the onboarding flow with backend 4 2025-09-05 12:55:26 +02:00
Urtzi Alfaro
9eedc2e5f2 Start integrating the onboarding flow with backend 2 2025-09-04 18:59:56 +02:00
Urtzi Alfaro
a55d48e635 Add onboarding flow improvements 2025-09-03 14:06:38 +02:00