Commit Graph

48 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
394ad3aea4 Improve AI logic 2025-11-05 13:34:56 +01:00
Urtzi Alfaro
5adb0e39c0 Improve the frontend 5 2025-11-02 20:24:44 +01:00
Urtzi Alfaro
269d3b5032 Add user delete process 2025-10-31 11:54:19 +01:00
Urtzi Alfaro
36217a2729 Improve the frontend 2 2025-10-29 06:58:05 +01:00
Urtzi Alfaro
8d30172483 Improve the frontend 2025-10-21 19:50:07 +02: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
7c72f83c51 REFACTOR ALL APIs fix 1 2025-10-07 07:15:07 +02:00
Urtzi Alfaro
38fb98bc27 REFACTOR ALL APIs 2025-10-06 15:27:01 +02:00
Urtzi Alfaro
4777e59e7a Add base kubernetes support final fix 4 2025-09-29 07:54:25 +02:00
Urtzi Alfaro
0faaa25e58 Start integrating the onboarding flow with backend 3 2025-09-04 23:19:53 +02:00
Urtzi Alfaro
f7de9115d1 Fix new services implementation 5 2025-08-15 17:53:59 +02:00
Urtzi Alfaro
03737430ee Fix new services implementation 3 2025-08-14 16:47:34 +02:00
Urtzi Alfaro
488bb3ef93 REFACTOR - Database logic 2025-08-08 09:08:41 +02:00
Urtzi Alfaro
32a7b913d0 Fix new Frontend 15 2025-08-04 21:46:12 +02:00
Urtzi Alfaro
35b02ca364 Fix new Frontend 12 2025-08-04 18:21:42 +02:00
Urtzi Alfaro
935f45a283 Add training job status in the db 2025-08-03 14:55:13 +02:00
Urtzi Alfaro
66716c054d Fix user delete flow 2 2025-08-02 17:53:28 +02:00
Urtzi Alfaro
3681429e11 Improve user delete flow 2025-08-02 17:09:53 +02:00
Urtzi Alfaro
277e8bec73 Add user role 2025-08-02 09:41:50 +02:00
Urtzi Alfaro
6e6c2cc42e Websocket fix 3 2025-08-01 20:43:02 +02:00
Urtzi Alfaro
37938b614f Websocket fix 2 2025-08-01 18:13:34 +02:00
Urtzi Alfaro
81e7ab7432 Websocket fix 1 2025-08-01 17:55:14 +02:00
Urtzi Alfaro
2f6f13bfef Training job in the background 2025-08-01 16:26:36 +02:00
Urtzi Alfaro
e581a144be Improve the event messaging for training service 2 2025-07-31 15:34:35 +02:00
Urtzi Alfaro
3f63cc2a49 Start fixing forecast service API 12 2025-07-29 19:11:36 +02:00
Urtzi Alfaro
07872f50d0 Start fixing forecast service API 10 2025-07-29 18:37:23 +02:00
Urtzi Alfaro
7cd595df81 Improve training code 2 2025-07-28 20:20:54 +02:00
Urtzi Alfaro
98f546af12 Improve training code 2025-07-28 19:28:39 +02:00
Urtzi Alfaro
946015b80c Fix data fetch 7 2025-07-27 22:58:18 +02:00
Urtzi Alfaro
0b14cf9eb2 Checking onboardin flow - fix 3 2025-07-27 11:04:32 +02:00
Urtzi Alfaro
30ac945058 Checking onboardin flow - fix 2 2025-07-27 10:30:42 +02:00
Urtzi Alfaro
cb3ae4d78b Checking onboardin flow - fix 1 2025-07-27 10:01:37 +02:00
Urtzi Alfaro
abad270282 REFACTOR API gateway fix 9 2025-07-26 23:34:46 +02:00
Urtzi Alfaro
97ae58fb06 REFACTOR API gateway fix 8 2025-07-26 23:29:57 +02:00
Urtzi Alfaro
e4885db828 REFACTOR API gateway 2025-07-26 18:46:52 +02:00
Urtzi Alfaro
f012f1bb14 Fix start training job 2025-07-25 21:05:55 +02:00
Urtzi Alfaro
8af4cc67d4 Fix training start 3 2025-07-25 19:40:49 +02:00
Urtzi Alfaro
4f459f31f6 Fix training start 2 2025-07-25 19:03:20 +02:00
Urtzi Alfaro
ebb39aa8c9 Fix training start 2025-07-25 17:20:39 +02:00
Urtzi Alfaro
153ae3f154 Fix forecasting service 2025-07-21 20:43:17 +02:00
Urtzi Alfaro
5f56c2fd00 Improve gateway service 2 2025-07-20 07:43:45 +02:00
Urtzi Alfaro
8cd433c0cd Improve gateway service 2025-07-20 07:24:04 +02:00
Urtzi Alfaro
f3071c00bd Add all the code for training service 2025-07-19 16:59:37 +02:00
Urtzi Alfaro
4073222888 Fix imports 2025-07-18 14:41:39 +02:00
Urtzi Alfaro
347ff51bd7 Initial microservices setup from artifacts 2025-07-17 13:09:24 +02:00