- Add Catch2 test framework with MockIO and TimeSimulator utilities - Implement 10 TI for SchedulerModule (task lifecycle, hyperfocus, breaks) - Implement 10 TI for NotificationModule (queue, priority, silent mode) - Fix SchedulerModule: update m_lastActivityTime in process() - Add AISSIA_TEST_BUILD guards to avoid symbol conflicts - All 20 tests passing (69 assertions total) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
175 lines
6.3 KiB
Markdown
175 lines
6.3 KiB
Markdown
# Document de Succession - AISSIA
|
|
|
|
## Contexte
|
|
|
|
AISSIA = Assistant vocal agentique basé sur GroveEngine (C++17 hot-reload). Architecture "Claude Code en vocal" avec tools internes + MCP.
|
|
|
|
**Dernier commit** : `92fb0b7`
|
|
|
|
## Ce qui a été fait (Session actuelle)
|
|
|
|
### Infrastructure de Tests d'Intégration
|
|
|
|
Créé **110 tests d'intégration** avec Catch2 :
|
|
|
|
```
|
|
tests/
|
|
├── CMakeLists.txt # Config Catch2, targets test_all/test_modules/test_mcp
|
|
├── main.cpp
|
|
├── mocks/
|
|
│ ├── MockIO.hpp/cpp # Mock IIO pub/sub (fonctionnel)
|
|
│ └── MockTransport.hpp # Mock IMCPTransport (fonctionnel)
|
|
├── utils/
|
|
│ ├── TestHelpers.hpp # Macros REQUIRE_PUBLISHED, tags
|
|
│ └── TimeSimulator.hpp # Simulation gameTime pour modules
|
|
├── fixtures/
|
|
│ ├── echo_server.py # Echo JSON-RPC pour tests transport
|
|
│ ├── mock_mcp_server.py # Serveur MCP complet (initialize, tools/list, tools/call)
|
|
│ └── mock_mcp.json # Config test
|
|
├── modules/ # 60 TI (10 par module)
|
|
│ ├── SchedulerModuleTests.cpp
|
|
│ ├── NotificationModuleTests.cpp
|
|
│ ├── MonitoringModuleTests.cpp
|
|
│ ├── AIModuleTests.cpp
|
|
│ ├── VoiceModuleTests.cpp
|
|
│ └── StorageModuleTests.cpp
|
|
└── mcp/ # 50 TI
|
|
├── MCPTypesTests.cpp # 15 TI - serialisation JSON
|
|
├── StdioTransportTests.cpp # 20 TI - process spawn, IPC, timeout
|
|
└── MCPClientTests.cpp # 15 TI - multi-server, routing
|
|
```
|
|
|
|
### Plan de Tests Détaillé
|
|
|
|
Créé `PLAN_TESTS_INTEGRATION.md` avec :
|
|
- Tableau de tous les 110 TI avec descriptions
|
|
- Exemples de code pour chaque catégorie
|
|
- Ordre d'implémentation en 5 sprints
|
|
- Métriques de succès
|
|
|
|
## Architecture Actuelle
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ LLMService │
|
|
│ (Agentic Loop) │
|
|
├─────────────────────────────────────────────────────────────┤
|
|
│ ToolRegistry │
|
|
│ ├── InternalTools (11 tools) ─────► IIO pub/sub │
|
|
│ └── MCPClient (tools externes) ─────► stdio JSON-RPC │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
│
|
|
┌──────────────┬─────┴──────┬──────────────┐
|
|
Scheduler Monitoring Storage Voice
|
|
Module Module Module Module
|
|
```
|
|
|
|
### Modules (Hot-Reloadable)
|
|
|
|
| Module | Fonctionnalité | Topics |
|
|
|--------|----------------|--------|
|
|
| SchedulerModule | Tâches, hyperfocus, breaks | `scheduler:*` |
|
|
| NotificationModule | Queue notifications, priorités | - |
|
|
| MonitoringModule | Classification apps, stats | `monitoring:*` |
|
|
| AIModule | Logique LLM, suggestions | `ai:*`, `llm:*` |
|
|
| VoiceModule | TTS/STT coordination | `voice:*` |
|
|
| StorageModule | Notes, persistence | `storage:*` |
|
|
|
|
### Services (Non Hot-Reloadable)
|
|
|
|
| Service | Rôle |
|
|
|---------|------|
|
|
| LLMService | HTTP Claude/OpenAI, agentic loop, tools |
|
|
| StorageService | SQLite, prepared statements |
|
|
| PlatformService | Window tracking (Win32/X11) |
|
|
| VoiceService | TTS (SAPI/espeak), STT (Whisper) |
|
|
|
|
### MCP
|
|
|
|
| Fichier | Description |
|
|
|---------|-------------|
|
|
| `MCPTypes.hpp` | Structs (Tool, Resource, JsonRpc*) |
|
|
| `MCPTransport.hpp` | Interface abstraite |
|
|
| `StdioTransport.*` | Fork/exec + JSON-RPC stdio |
|
|
| `MCPClient.*` | Multi-serveur, routing tools |
|
|
|
|
## Commandes
|
|
|
|
```bash
|
|
# Build standard
|
|
cmake -B build && cmake --build build -j4
|
|
|
|
# Build avec tests
|
|
cmake -B build -DBUILD_TESTING=ON && cmake --build build -j4
|
|
|
|
# Exécuter tous les tests
|
|
cmake --build build --target test_all
|
|
|
|
# Tests par catégorie
|
|
./build/aissia_tests "[scheduler]"
|
|
./build/aissia_tests "[mcp]"
|
|
./build/aissia_tests "[mcp][types]"
|
|
./build/aissia_tests "[mcp][transport]"
|
|
|
|
# Run AISSIA
|
|
./build/aissia
|
|
```
|
|
|
|
## État des Tests
|
|
|
|
Les tests sont des **squelettes fonctionnels** :
|
|
- Fixtures et mocks implémentés
|
|
- TEST_CASE avec assertions réelles
|
|
- Certaines vérifications d'état marquées `// TODO` (nécessitent getState() côté module)
|
|
|
|
**Prêt à compiler** mais nécessite :
|
|
1. Vérifier que GroveEngine expose `grove::Message` correctement
|
|
2. Les modules doivent exposer leur état via `getState()` pour les assertions
|
|
|
|
## Prochaines Étapes
|
|
|
|
### Priorité Haute
|
|
1. **Compiler les tests** - `cmake -B build -DBUILD_TESTING=ON`
|
|
2. **Fixer les erreurs de compilation** - Probablement des includes manquants
|
|
3. **Compléter les `// TODO`** - Assertions sur getState() des modules
|
|
|
|
### Priorité Moyenne
|
|
4. **Ajouter CI** - GitHub Actions ou GitLab CI pour run tests
|
|
5. **Couverture de code** - gcov/lcov
|
|
6. **Tests end-to-end** - Flux complet inter-modules
|
|
|
|
### Priorité Basse
|
|
7. **Tests de performance** - Latence IIO, throughput MCP
|
|
8. **Fuzzing** - MCPTypes parsing, JsonRpc
|
|
|
|
## Fichiers Clés Modifiés
|
|
|
|
```
|
|
CMakeLists.txt # Ajout option BUILD_TESTING + add_subdirectory(tests)
|
|
PLAN_TESTS_INTEGRATION.md # Plan détaillé des 110 TI (nouveau)
|
|
tests/ # Toute la structure (nouveau)
|
|
```
|
|
|
|
## Variables d'Environnement
|
|
|
|
```bash
|
|
export ANTHROPIC_API_KEY="sk-ant-..." # Claude API
|
|
export BRAVE_API_KEY="..." # Si MCP brave-search activé
|
|
```
|
|
|
|
## Notes Techniques
|
|
|
|
### MockIO
|
|
- Capture tous les `publish()` dans un vector
|
|
- Permet `injectMessage()` pour simuler messages entrants
|
|
- Helpers : `wasPublished()`, `getLastPublished()`, `countPublished()`
|
|
|
|
### TimeSimulator
|
|
- Simule `gameTime` pour les modules
|
|
- `advanceMinutes()` pratique pour tests hyperfocus
|
|
- `createInput()` génère le JSON attendu par `process()`
|
|
|
|
### Fixtures Python
|
|
- `echo_server.py` : echo params en result
|
|
- `mock_mcp_server.py` : implémente initialize, tools/list, tools/call
|