feat(websockets): implement WebSockets V3 with granular Redis Pub/Sub

- Introduced WS_Message_V3 standardized Pydantic model and WS_Manager_V3.
- Implemented /v3/ws/ endpoint with granular Redis routing to solve "noisy neighbor" scaling issues.
- Added presence tracking using Redis Sets for group coordination.
- Comprehensive test suite added (unit and integration) covering models, manager, and routing logic.
- Documentation: Created V3 Frontend WebSocket Guide and Project design spec.
- Updated main Frontend API guide and tests README with new standards.
This commit is contained in:
Scott Idem
2026-01-30 14:44:02 -05:00
parent a02abbbe4f
commit 48c3ce76f0
10 changed files with 818 additions and 2 deletions

View File

@@ -29,6 +29,8 @@ This directory contains the automated and manual test scripts for the Aether Fas
| `test_unit_payload_sanitization.py` | **Primary Logic Test**: Verifies payload stripping and ID resolution. |
| `test_unit_router_stripping.py` | Simulates automatic removal of random IDs during updates. |
| `test_unit_schema_logic.py` | Verifies V3 schema metadata extraction logic with mocked DB rows. |
| `test_unit_websockets_v3.py` | Unit tests for the V3 WebSocket manager and message models. |
| `test_unit_websockets_v3_router.py` | Verifies the V3 WebSocket endpoint logic and message routing. |
### Integration Tests (`tests/integration/`)
| Script | Description |
@@ -70,3 +72,17 @@ This directory contains the automated and manual test scripts for the Aether Fas
### Path Requirements
Always run test scripts from the **project root** directory. Most scripts include `sys.path.append(os.getcwd())` to ensure local imports work correctly.
---
## 💡 Best Practices & Reminders
1. **Check Before Creating**: Always check the **Script Inventory** above to see if a test for your logic already exists, or find a similar one to use as a reference/template.
2. **Docker & Service Restarts**: Remember that the Aether Platform runs in Docker. If you modify core application code (e.g., in `app/`), you must restart the FastAPI service for changes to take effect:
```bash
docker restart aether_container_env-ae_api-2
```
(Note: Restarts are NOT necessary if you are only modifying the test scripts themselves).
3. **Clean Up**: Clean up any temporary or debug files created during testing. However, **keep your test scripts**! Refactor them slightly for future use and clarity so they remain valuable assets for the project.
4. **Stay Current**: Update this `README.md` when you add new tests or learn something that could help others. This is a living document; keep the **Script Inventory** and tips up to date.
5. **Commit Often**: Don't forget to commit your working code and tests before moving on to the next task!