docs: update session state - Phase 1 (hook extractions) complete
This commit is contained in:
@@ -1,32 +1,34 @@
|
|||||||
# CURRENT AI WORKING SESSION — HANDOVER
|
# CURRENT AI WORKING SESSION — HANDOVER
|
||||||
|
|
||||||
**Active AI:** Claude Haiku 4.5
|
**Active AI:** Claude Haiku 4.5
|
||||||
**Last Updated:** 2026-04-19 (Session 2 - Code Refactoring)
|
**Last Updated:** 2026-04-19 (Session 3 - Phase 1 Completion)
|
||||||
**Current Version:** v1.10.16 (version saved and merged to master)
|
**Current Version:** v1.10.16 (version saved and merged to master)
|
||||||
**Branch:** refactor/ai-friendly-v2 (Phase 1: Hook Extractions In Progress)
|
**Branch:** refactor/ai-friendly-v2 (Phase 1: ✅ COMPLETE)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## STATUS: 🟡 IN PROGRESS — REFACTORING PHASE 1 (HOOK EXTRACTIONS)
|
## STATUS: 🟢 COMPLETE — REFACTORING PHASE 1 (HOOK EXTRACTIONS)
|
||||||
|
|
||||||
### Phase 1 Hook Extraction Progress
|
### Phase 1 Hook Extraction — ALL COMPLETE ✅
|
||||||
**Baseline:** 332 tests passing (291 Vitest + 41 Pytest)
|
**Final Result:** 332 tests passing (291 Vitest + 41 Pytest)
|
||||||
|
|
||||||
**Completed Extractions:**
|
**Frontend Hooks (5):**
|
||||||
1. ✅ `frontend/hooks/useScanner.ts` — Scanner state, mode, OCR matching (from page.tsx)
|
1. ✅ `frontend/hooks/useScanner.ts` — Scanner state, mode, OCR matching (from page.tsx)
|
||||||
- Commit: `5b8c6039` refactor: extract useScanner hook from page.tsx
|
- Commit: `5b8c6039` refactor: extract useScanner hook from page.tsx
|
||||||
2. ✅ `frontend/hooks/useStockAdjustment.ts` — Stock adjustment logic (from page.tsx)
|
2. ✅ `frontend/hooks/useStockAdjustment.ts` — Stock adjustment logic (from page.tsx)
|
||||||
- Commit: `f5441a7c` refactor: extract useStockAdjustment hook from page.tsx
|
- Commit: `f5441a7c` refactor: extract useStockAdjustment hook from page.tsx
|
||||||
3. ✅ `frontend/hooks/useSync.ts` — Sync operations and inventory refresh (from page.tsx)
|
3. ✅ `frontend/hooks/useSync.ts` — Sync operations and inventory refresh (from page.tsx)
|
||||||
- Commit: `6dfc76ad` refactor: extract useSync hook from page.tsx
|
- Commit: `6dfc76ad` refactor: extract useSync hook from page.tsx
|
||||||
|
4. ✅ `frontend/hooks/useInventoryFilter.ts` — Filter state & search (from inventory/page.tsx)
|
||||||
|
- Commit: `cf45437b` refactor: extract useInventoryFilter hook from inventory/page.tsx
|
||||||
|
5. ✅ `frontend/hooks/useAIExtraction.ts` — AI wizard logic (from AIOnboarding.tsx)
|
||||||
|
- Commit: `a520b1ba` refactor: extract useAIExtraction hook from AIOnboarding.tsx
|
||||||
|
|
||||||
**Remaining Frontend Hooks (Phase 1):**
|
**Backend Routers (2):**
|
||||||
4. ⏳ `frontend/hooks/useInventoryFilter.ts` — Filter state & search (from inventory/page.tsx)
|
6. ✅ `backend/routers/auth.py` — LDAP auth & login endpoint (split from users.py)
|
||||||
5. ⏳ `frontend/hooks/useAIExtraction.ts` — AI wizard logic (from AIOnboarding.tsx)
|
- Commit: `90e9a606` refactor: split LDAP auth into backend/routers/auth.py
|
||||||
|
7. ✅ `backend/routers/sync.py` — Bulk sync endpoint (split from operations.py)
|
||||||
**Backend Splits (Phase 1):**
|
- Commit: `6dc300d3` refactor: split bulk-sync into backend/routers/sync.py
|
||||||
6. ⏳ `backend/routers/auth.py` — LDAP auth & login endpoint (split from users.py)
|
|
||||||
7. ⏳ `backend/routers/sync.py` — Bulk sync endpoint (split from operations.py)
|
|
||||||
|
|
||||||
**Test Status After Each Extraction:**
|
**Test Status After Each Extraction:**
|
||||||
- All tests passing (291 frontend + 41 backend = 332 total)
|
- All tests passing (291 frontend + 41 backend = 332 total)
|
||||||
@@ -44,8 +46,32 @@
|
|||||||
- `data-testid` attributes added to 10+ component files (see commits since b294a51a)
|
- `data-testid` attributes added to 10+ component files (see commits since b294a51a)
|
||||||
- 97 total `data-testid` values needed — most added, some still mismatched with UI
|
- 97 total `data-testid` values needed — most added, some still mismatched with UI
|
||||||
|
|
||||||
### Next Steps for Next Session
|
### Next Steps for Next Session (Phase 2: Component Extractions)
|
||||||
1. Fix remaining E2E selectors — run login workflow test to see current failures:
|
|
||||||
|
**Phase 2 targets** (from refactoring plan):
|
||||||
|
1. **`StockAdjustmentPanel`** from page.tsx
|
||||||
|
2. **`NewItemDialog`** from page.tsx
|
||||||
|
3. **`ScannerSection`** from page.tsx
|
||||||
|
4. **`CameraView`** from Scanner.tsx
|
||||||
|
5. **`InventoryTable`** from inventory/page.tsx
|
||||||
|
6. **`FilterBar`** from inventory/page.tsx
|
||||||
|
7. **`LogsTable`** from logs/page.tsx
|
||||||
|
|
||||||
|
**How to proceed:**
|
||||||
|
1. Run baseline: `npm run test -- --run && python -m pytest backend/tests/ -q`
|
||||||
|
2. Extract components **bottom-up** (leaf nodes first)
|
||||||
|
3. After each extraction: run tests, commit
|
||||||
|
4. After Phase 2: run `npm run build` and smoke-test UI
|
||||||
|
|
||||||
|
**Test Status:**
|
||||||
|
- Backend: 41/41 passing
|
||||||
|
- Frontend: 291/291 passing
|
||||||
|
- E2E: Not yet validated (1/81 tests passing — selectors need fixing)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Previous E2E Notes
|
||||||
|
- Fix remaining E2E selectors — run login workflow test to see current failures:
|
||||||
```bash
|
```bash
|
||||||
cd /data/programare_AI/tfm_ainventory
|
cd /data/programare_AI/tfm_ainventory
|
||||||
source backend/venv/bin/activate && python -m uvicorn backend.main:app --port 8916 &
|
source backend/venv/bin/activate && python -m uvicorn backend.main:app --port 8916 &
|
||||||
|
|||||||
Reference in New Issue
Block a user