diff --git a/.a0/current_status.md b/.a0/current_status.md index f22d9f7..91b2d33 100644 --- a/.a0/current_status.md +++ b/.a0/current_status.md @@ -1,15 +1,16 @@ # Current Status — LeoCRM **Phase**: 3 — Implementation -**Status**: T03 COMPLETE — 103/103 tests pass, 85.92% plugin coverage -**Commit**: 7a5a48f (pushed to Forgejo) -**Date**: 2026-06-29 01:20 CEST +**Status**: T09 COMPLETE — 238/238 tests pass, 84.12% T09 coverage +**Commit**: 14bd4e3 (pushed to Forgejo) +**Date**: 2026-06-29 02:46 CEST ## Completed Tasks - T01 ✅ Core Infrastructure + Auth (29 tests) - T02 ✅ Companies + Contacts + Import/Export (27 tests) - T03 ✅ Plugin System Framework (47 tests) +- T09 ✅ KI-Copilot API + Workflow Engine (135 tests: 30 AC + 105 coverage) ## Next Action -- Delegate T07a (Frontend SPA Shell) + T09 (KI-Copilot API) in parallel -- Awaiting user approval +- Delegate T07a (Frontend SPA Shell — React 18 + Vite + TypeScript) +- T07a briefing ready at .a0/briefings/T07a_briefing.md diff --git a/.a0/next_steps.md b/.a0/next_steps.md index ccc46cf..29c16a2 100644 --- a/.a0/next_steps.md +++ b/.a0/next_steps.md @@ -1,26 +1,21 @@ # Next Steps — LeoCRM -## Current: T03 COMPLETE ✅ (commit 7a5a48f, pushed) +## Current: T09 COMPLETE ✅ (commit 14bd4e3, pushed) ## Phase 3 Implementation Progress - T01 ✅ Core Infrastructure + Multi-Tenant + Auth (commit 7a7daf8) - T02 ✅ Company + Contact + Import/Export (commit 6bf0746) - T03 ✅ Plugin System Framework (commit 7a5a48f) +- T09 ✅ KI-Copilot API + Workflow Engine (commit 14bd4e3) -## Next: T07a ∥ T09 (Parallel) -### T07a — Frontend SPA Shell +## Next: T07a — Frontend SPA Shell - Deps: T01 ✅ - Reqs: 23 features, 27 ACs -- Vue 3 + Vite + Pinia + Vue Router + TailwindCSS -- Auth flow, layout, navigation, dashboard, settings +- Stack: React 18 + Vite + TypeScript + React Router v6 + TanStack Query v5 + Zustand + react-i18next + Tailwind CSS + Vitest +- Briefing ready: .a0/briefings/T07a_briefing.md -### T09 — KI-Copilot API + Hybrid Workflow Engine Backend -- Deps: T01 ✅, T02 ✅ -- Reqs: 5 features, 22 ACs -- LLM integration, workflow engine, task automation - -## After T07a + T09: T07b (Frontend Feature Pages) +## After T07a: T07b (Frontend Feature Pages) ## After T07b: T10 (Monitoring, Performance, Documentation) ## v1 Execution Order -T01 ✅ → T02 ✅ → T03 ✅ → (T07a ∥ T09) → T07b → T10 +T01 ✅ → T02 ✅ → T03 ✅ → T09 ✅ → T07a → T07b → T10 diff --git a/.a0/worklog.md b/.a0/worklog.md index 3d8b4ca..827d80f 100644 --- a/.a0/worklog.md +++ b/.a0/worklog.md @@ -34,3 +34,53 @@ - Pushed to Forgejo: 6bf0746..7a5a48f ### Next: T07a (Frontend SPA Shell) ∥ T09 (KI-Copilot API) — parallel delegation + +## T09 — KI-Copilot API + Hybrid Workflow Engine Backend — COMPLETE ✅ +**Date**: 2026-06-29 02:46 +**Commit**: 14bd4e3 (pushed to Forgejo) +**Tests**: 238/238 full suite pass (30 AC + 105 coverage + 103 existing) +**Coverage**: 84.12% for T09 modules (target: 80% ✅) +**Migration**: 0004_ai_workflows.py applied (5 tables with RLS) + +### Files Created (24 new) +- app/models/ai_conversation.py, app/models/workflow.py +- app/schemas/ai_copilot.py, app/schemas/workflow.py +- app/ai/__init__.py, app/ai/llm_client.py, app/ai/action_mapper.py +- app/services/ai_copilot_service.py (~500 lines), app/services/workflow_service.py (~675 lines) +- app/routes/ai_copilot.py, app/routes/workflows.py +- app/workflows/__init__.py, app/workflows/engine.py +- app/workflows/code/__init__.py, app/workflows/code/onboarding.py +- alembic/versions/0004_ai_workflows.py +- tests/test_ai_copilot.py (67 tests), tests/test_workflows.py (68 tests) +- test_report.md + +### Files Modified (7) +- app/models/__init__.py, app/routes/__init__.py, app/schemas/__init__.py, app/services/__init__.py +- app/main.py (added ai_copilot + workflows routers) +- tests/conftest.py (added new tables to TRUNCATE + model imports) +- app/core/event_bus.py (added workflow event handler registration) + +### Bugs Fixed +1. MissingGreenlet on async lazy-load of updated_at/created_at — fixed with _safe_iso() and _get_attr() helpers +2. _message_to_dict in ai_copilot_service.py — patched by orchestrator (m.created_at.isoformat() → _safe_iso(_get_attr(m, "created_at"))) + +### Coverage Breakdown +- app/workflows/engine.py: 0% → 90.00% +- app/services/ai_copilot_service.py: 38.89% → 98.61% +- app/ai/action_mapper.py: 43.44% → 96.72% +- app/ai/llm_client.py: 64.62% → 81.54% +- app/services/workflow_service.py: 62.54% → 75.95% +- app/routes/workflows.py: 59.48% → 62.93% +- app/routes/ai_copilot.py: 65% → 65.00% +- **Overall: 45.37% → 84.12%** ✅ + +### Verification (Orchestrator Independent) +- pytest tests/: 238/238 PASS (zero regressions) +- Migration 0004 applied via alembic upgrade head +- RLS policies on all 5 new tables (ai_conversations, ai_messages, workflows, workflow_instances, workflow_step_history) +- No forbidden patterns (.test TLD, SET LOCAL, raise HTTPException in middleware, POST without status_code) +- POST action endpoints (query/execute/advance/cancel) correctly use 200 default +- POST creation endpoints (workflows, instances) correctly use 201 +- Pushed to Forgejo: 7a5a48f..14bd4e3 + +### Next: T07a (Frontend SPA Shell — React 18)