|
1 | | -# MeshRF v1.15.5 - Stability & Reliability Patch |
| 1 | +# MeshRF v1.16.0 - Major Refactoring & Modularization |
2 | 2 |
|
3 | | -**Release Date**: February 15, 2026 |
4 | | -**Type**: Patch Release |
5 | | -**Focus**: Critical bugfixes, memory leak prevention, and WASM binding corrections |
| 3 | +**Release Date**: February 26, 2026 |
| 4 | +**Type**: Minor Release (Architecture Update) |
| 5 | +**Focus**: Codebase restructuring, modularization, and maintainability improvements. |
6 | 6 |
|
7 | 7 | --- |
8 | 8 |
|
9 | 9 | ## 🎯 Overview |
10 | 10 |
|
11 | | -This patch addresses **18 critical stability issues** discovered through systematic code review, including infinite loops, memory leaks, race conditions, silent failures, and a critical WASM binding bug that prevented the ITM propagation model from functioning correctly. |
| 11 | +This release focuses entirely on **structural architecture and technical debt reduction**. The codebase has undergone a major refactor to decompose monolithic files, separate concerns, and establish a cleaner foundation for future feature development. All existing functionality has been preserved and verified against automated test suites. |
12 | 12 |
|
13 | 13 | --- |
14 | 14 |
|
15 | | -## 🐛 Critical Fixes |
| 15 | +## 🏗️ Refactoring Highlights |
16 | 16 |
|
17 | | -### Backend (Python - 7 fixes) |
| 17 | +### Frontend Architecture |
18 | 18 |
|
19 | | -| Issue | Impact | Fix | |
20 | | -| -------------------------------- | ----------------------------------- | ----------------------------------------- | |
21 | | -| **SSE Infinite Loop** | Open HTTP connections indefinitely | Added 600-poll max timeout (5 min) | |
22 | | -| **Silent Exception Swallowing** | Errors hidden, debugging impossible | Structured logging with error summaries | |
23 | | -| **False-Positive Perfect Links** | Misleading "100% clearance" reports | Evaluation flag prevents 0-point analysis | |
24 | | -| **ThreadPoolExecutor Leaks** | Thread count grows unbounded | `shutdown()` + `__del__()` methods | |
25 | | -| **Missing Timeouts** | Indefinite blocking on tile fetches | 30s timeout with `TimeoutError` handling | |
26 | | -| **Unbounded tile_locks** | Memory exhaustion over time | OrderedDict LRU cache (1000 limit) | |
27 | | -| **Wrong HTTP Status Codes** | 500 errors for client mistakes | Differentiated 400 vs 500 responses | |
| 19 | +- **Component Decomposition**: Massive components like `MapContainer.jsx` and `Sidebar.jsx` have been broken down into specialized layers (`LinkLayerManager`, `CoverageLayerManager`) and sections (`HardwareSection`, `EnvironmentSection`). |
| 20 | +- **State Management**: Implemented Facade pattern for React Context (`RFContext.jsx` wrapping isolated domains). |
| 21 | +- **RF Math Modularization**: Split the monolithic `rfMath.js` into isolated mathematics modules (`fspl.js`, `bullington.js`, `earth.js`, etc.) located in `src/utils/math/`. |
| 22 | +- **Worker & Data Hooks**: Standardized Web Worker interactions via `useWorkerState.js` and extracted map tile fetching to `tileFetcher.js`. |
28 | 23 |
|
29 | | -### Frontend (React/JS - 10 fixes) |
| 24 | +### Backend API Structure |
30 | 25 |
|
31 | | -| Issue | Impact | Fix | |
32 | | -| ----------------------------- | ---------------------------------------------- | ----------------------------------- | |
33 | | -| **Stale Message Listeners** | Duplicate worker handlers, memory leaks | Moved handler into `useEffect` | |
34 | | -| **Stale Closures** | Infinite re-render loops | Restored `configRef` pattern | |
35 | | -| **Document Listener Leaks** | Chrome tab memory growth | `cleanupRef` tracking | |
36 | | -| **Missing HTTP Error Checks** | Unhandled promise rejections | `response.ok` validation | |
37 | | -| **Silent WASM Failures** | Tools silently break | `wasmError` state + user feedback | |
38 | | -| **Scan Double-Submit** | Duplicate Celery tasks | `isScanning` guard | |
39 | | -| **Missing Imports** | Runtime ReferenceErrors | Added `useRef`, `useEffect` | |
40 | | -| **Infinite Loop (Post-Fix)** | Max update depth exceeded | Removed `runAnalysis` from deps | |
41 | | -| **Model Selection** | Changing propagation model doesn't recalculate | Added `propagationSettings` to deps | |
42 | | - |
43 | | -### WASM/C++ (1 fix) |
44 | | - |
45 | | -| Issue | Impact | Fix | |
46 | | -| ------------------------------ | -------------------------------------------- | --------------------------------------------------------- | |
47 | | -| **LinkParameters Constructor** | "Module.LinkParameters is not a constructor" | Changed `value_object` → `class_` with `.constructor<>()` | |
48 | | - |
49 | | ---- |
50 | | - |
51 | | -## 📦 Deployment |
52 | | - |
53 | | -### Updated Files |
54 | | - |
55 | | -- **Backend**: `server.py`, `rf_physics.py`, `core/algorithms.py`, `tile_manager.py` |
56 | | -- **Frontend**: `useViewshedTool.js`, `LinkLayer.jsx`, `LinkAnalysisPanel.jsx`, `rfService.js`, `useRFCoverageTool.js`, `useSimulationStore.js` |
57 | | -- **WASM**: `libmeshrf/src/bindings.cpp`, `meshrf.wasm` (109KB), `meshrf.js` (48KB) |
58 | | - |
59 | | -### Verification |
60 | | - |
61 | | -- ✅ Frontend build successful |
62 | | -- ✅ Python syntax validated |
63 | | -- ✅ WASM module compiled (100%) |
64 | | -- ✅ Runtime errors resolved |
65 | | - |
66 | | ---- |
67 | | - |
68 | | -## 🚀 Upgrade Instructions |
69 | | - |
70 | | -### Development |
71 | | - |
72 | | -```bash |
73 | | -# Frontend (uses Vite HMR - no restart needed) |
74 | | -# Code changes already live via volume mount |
75 | | - |
76 | | -# Backend - restart to reload Python modules |
77 | | -docker restart rf_engine_dev |
78 | | - |
79 | | -# Hard refresh browser to load new WASM |
80 | | -Ctrl + Shift + R (Windows/Linux) |
81 | | -Cmd + Shift + R (Mac) |
82 | | -``` |
83 | | - |
84 | | -### Production |
85 | | - |
86 | | -```bash |
87 | | -# Pull latest code |
88 | | -git pull origin main |
89 | | - |
90 | | -# Rebuild containers |
91 | | -docker-compose build |
92 | | - |
93 | | -# Restart stack |
94 | | -docker-compose up -d |
95 | | -``` |
96 | | - |
97 | | ---- |
98 | | - |
99 | | -## 🔍 Testing Recommendations |
100 | | - |
101 | | -1. **Link Analysis**: Test ITM (Longley-Rice) propagation model - should no longer throw constructor errors |
102 | | -2. **Long-Running Scans**: Verify SSE endpoints timeout gracefully after 5 minutes |
103 | | -3. **Memory Monitoring**: Check thread count and Redis tile cache remain bounded |
104 | | -4. **Error Visibility**: Confirm viewshed errors appear in logs instead of being silently swallowed |
105 | | -5. **Multi-Click Protection**: Spam-click "Start Scan" button - should only run once |
106 | | - |
107 | | ---- |
108 | | - |
109 | | -## 📊 Impact Summary |
110 | | - |
111 | | -| Category | Fixes | Severity | |
112 | | -| ------------------- | ----- | ----------- | |
113 | | -| **Infinite Loops** | 1 | 🔴 Critical | |
114 | | -| **Memory Leaks** | 3 | 🔴 Critical | |
115 | | -| **Silent Failures** | 4 | 🟠 High | |
116 | | -| **Race Conditions** | 2 | 🟠 High | |
117 | | -| **Error Handling** | 4 | 🟡 Medium | |
118 | | -| **Import Errors** | 3 | 🟡 Medium | |
119 | | - |
120 | | -**Total**: 18 issues resolved |
| 26 | +- **API Routing**: `server.py` has been decomposed into dedicated FastAPI routers (`routers/analysis.py`, `routers/elevation.py`, etc.). |
| 27 | +- **Tile Manager Extraction**: Separated `tile_manager.py` logic into `cache_layer.py`, `elevation_client.py`, and `grid_processor.py`. |
121 | 28 |
|
122 | 29 | --- |
123 | 30 |
|
124 | | -## 🙏 Acknowledgments |
| 31 | +## 📊 Impact & Stability |
125 | 32 |
|
126 | | -All issues identified through systematic code review and production debugging. Special attention given to resource management (threads, listeners, locks) and React hook dependency management. |
| 33 | +- **Components Extracted/Created**: 25+ |
| 34 | +- **Lines of Code Relocated**: ~4,000+ |
| 35 | +- **Test Status**: All backend (`pytest`) and frontend (`vitest`) test suites are passing. |
| 36 | +- **Docker Containers**: Rebuilt and stable. |
127 | 37 |
|
128 | 38 | --- |
129 | 39 |
|
130 | 40 | **Full Changelog**: [CHANGELOG.md](CHANGELOG.md) |
131 | | -**Previous Release**: [v1.15.4](https://github.com/d3mocide/MeshRF/releases/tag/v1.15.4) |
| 41 | +**Previous Release**: [v1.15.5](https://github.com/d3mocide/MeshRF/releases/tag/v1.15.5) |
0 commit comments