1b7703f07b
feat(IIO)!: BREAKING CHANGE - Callback-based message dispatch
...
## Breaking Change
IIO API redesigned from manual pull+if-forest to callback dispatch.
All modules must update their subscribe() calls to pass handlers.
### Before (OLD API)
```cpp
io->subscribe("input:mouse");
void process(...) {
while (io->hasMessages()) {
auto msg = io->pullMessage();
if (msg.topic == "input:mouse") {
handleMouse(msg);
} else if (msg.topic == "input:keyboard") {
handleKeyboard(msg);
}
}
}
```
### After (NEW API)
```cpp
io->subscribe("input:mouse", [this](const Message& msg) {
handleMouse(msg);
});
void process(...) {
while (io->hasMessages()) {
io->pullAndDispatch(); // Callbacks invoked automatically
}
}
```
## Changes
**Core API (include/grove/IIO.h)**
- Added: `using MessageHandler = std::function<void(const Message&)>`
- Changed: `subscribe()` now requires `MessageHandler` callback parameter
- Changed: `subscribeLowFreq()` now requires `MessageHandler` callback
- Removed: `pullMessage()`
- Added: `pullAndDispatch()` - pulls and auto-dispatches to handlers
**Implementation (src/IntraIO.cpp)**
- Store callbacks in `Subscription.handler`
- `pullAndDispatch()` matches topic against ALL subscriptions (not just first)
- Fixed: Regex pattern compilation supports both wildcards (*) and regex (.*)
- Performance: ~1000 msg/s throughput (unchanged from before)
**Files Updated**
- 31 test/module files migrated to callback API (via parallel agents)
- 8 documentation files updated (DEVELOPER_GUIDE, USER_GUIDE, module READMEs)
## Bugs Fixed During Migration
1. **pullAndDispatch() early return bug**: Was only calling FIRST matching handler
- Fix: Loop through ALL subscriptions, invoke all matching handlers
2. **Regex pattern compilation bug**: Pattern "player:.*" failed to match
- Fix: Detect ".*" in pattern → use as regex, otherwise escape and convert wildcards
## Testing
✅ test_11_io_system: PASSED (IIO pub/sub, pattern matching, batching)
✅ test_threaded_module_system: 6/6 PASSED
✅ test_threaded_stress: 5/5 PASSED (50 modules, 100x reload, concurrent ops)
✅ test_12_datanode: PASSED
✅ 10 TopicTree scenarios: 10/10 PASSED
✅ benchmark_e2e: ~1000 msg/s throughput
Total: 23+ tests passing
## Performance Impact
No performance regression from callback dispatch:
- IIO throughput: ~1000 msg/s (same as before)
- ThreadedModuleSystem: Speedup ~1.0x (barrier pattern expected)
## Migration Guide
For all modules using IIO:
1. Update subscribe() calls to include handler lambda
2. Replace pullMessage() loops with pullAndDispatch()
3. Move topic-specific logic from if-forest into callbacks
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 14:19:27 +07:00
2f16ba0362
fix: Windows test stability - scenario_09 race condition and IOSystemStress crash
...
- Fix scenario_09_threadsafety: Add writerDone flag to ensure writer thread
finishes before clear() is called, preventing race condition
- Fix IntraIO destructor: Call removeInstance() to unregister from
IntraIOManager and prevent dangling pointer access
- Fix IOTestEngine destructor: Inline cleanup instead of calling unloadModule()
which was modifying the map while iterating (undefined behavior)
- Fix CTest macro: Use WORKING_DIRECTORY with PATH environment variable
instead of cmake -E chdir for proper Windows DLL loading
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 15:23:56 +07:00
edf4d76844
fix: Windows MinGW CTest compatibility - DLL loading and module paths
...
- Add cmake -E chdir wrapper for CTest on Windows to resolve DLL loading
- Auto-copy MinGW runtime DLLs to build directories during configure
- Fix module paths in integration tests (.so -> .dll for Windows)
- Update grove_add_test macro for cross-platform test registration
Tests now pass: 55% (16/29) on Windows MinGW
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 20:04:44 +07:00
e004bc015b
feat: Windows portage + Phase 4 SceneCollector integration
...
- Port to Windows (MinGW/Ninja):
- ModuleFactory/ModuleLoader: LoadLibrary/GetProcAddress
- SystemUtils: Windows process memory APIs
- FileWatcher: st_mtime instead of st_mtim
- IIO.h: add missing #include <cstdint>
- Tests (09, 10, 11): grove_dlopen/dlsym wrappers
- Phase 4 - SceneCollector & IIO:
- Implement view/proj matrix calculation in parseCamera()
- Add IIO routing test with game→renderer pattern
- test_22_bgfx_sprites_headless: 5 tests, 23 assertions pass
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 09:48:14 +08:00
ddbed30ed7
feat: Add Scenario 11 IO System test & fix IntraIO routing architecture
...
Implémentation complète du scénario 11 (IO System Stress Test) avec correction majeure de l'architecture de routing IntraIO.
## Nouveaux Modules de Test (Scenario 11)
- ProducerModule: Publie messages pour tests IO
- ConsumerModule: Consomme et valide messages reçus
- BroadcastModule: Test multi-subscriber broadcasting
- BatchModule: Test low-frequency batching
- IOStressModule: Tests de charge concurrents
## Test d'Intégration
- test_11_io_system.cpp: 6 tests validant:
* Basic Publish-Subscribe
* Pattern Matching avec wildcards
* Multi-Module Routing (1-to-many)
* Low-Frequency Subscriptions (batching)
* Backpressure & Queue Overflow
* Thread Safety (concurrent pub/pull)
## Fix Architecture Critique: IntraIO Routing
**Problème**: IntraIO::publish() et subscribe() n'utilisaient PAS IntraIOManager pour router entre modules.
**Solution**: Utilisation de JSON comme format de transport intermédiaire
- IntraIO::publish() → extrait JSON → IntraIOManager::routeMessage()
- IntraIO::subscribe() → enregistre au IntraIOManager::registerSubscription()
- IntraIOManager::routeMessage() → copie JSON pour chaque subscriber → deliverMessage()
**Bénéfices**:
- ✅ Routing centralisé fonctionnel
- ✅ Support 1-to-many (copie JSON au lieu de move unique_ptr)
- ✅ Pas besoin d'implémenter IDataNode::clone()
- ✅ Compatible futur NetworkIO (JSON sérialisable)
## Modules Scenario 13 (Cross-System)
- ConfigWatcherModule, PlayerModule, EconomyModule, MetricsModule
- test_13_cross_system.cpp (stub)
## Documentation
- CLAUDE_NEXT_SESSION.md: Instructions détaillées pour build/test
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 11:43:08 +08:00