Refactor into modular app structure

Split monolithic files into focused modules:
- app/core: settings, logging, lifecycle
- app/signaling: websocket server, ICE parser, message models
- app/webrtc: peer session, video receiver, frame source
- app/vision: pose landmarker wrapper, model config, pose types
- app/exercises/dead_bug: detector, metrics, rules, state machine, types
- app/rendering: skeleton renderer, status overlay, window display
- app/audio: rep announcer
- app/diagnostics: perf timer, crash handler
- configs: environment-based settings
- tests: unit tests for rules, state machine, ICE parser
- run.py: entry point
This commit is contained in:
2026-06-10 10:14:43 +08:00
parent 8b878cb9e5
commit 4485cbf702
44 changed files with 1230 additions and 648 deletions
+35
View File
@@ -0,0 +1,35 @@
from __future__ import annotations
from app.signaling.ice_parser import parse_ice
class TestIceParser:
def test_parse_valid_ice(self):
data = {
"candidate": "1234567890 1 UDP 2130706431 192.168.1.1 12345 typ host",
"sdpMid": "0",
"sdpMLineIndex": 0,
}
cand = parse_ice(data)
assert cand is not None
assert cand.foundation == "1234567890"
assert cand.component == 1
assert cand.protocol == "udp"
assert cand.ip == "192.168.1.1"
assert cand.port == 12345
assert cand.type == "host"
def test_parse_invalid_ice(self):
assert parse_ice({"candidate": "invalid"}) is None
def test_parse_srflx(self):
data = {
"candidate": "abcdef 1 UDP 1686052607 203.0.113.1 50000 typ srflx raddr 192.168.1.1 rport 12345",
"sdpMid": "0",
"sdpMLineIndex": 0,
}
cand = parse_ice(data)
assert cand is not None
assert cand.type == "srflx"
assert cand.relatedAddress == "192.168.1.1"
assert cand.relatedPort == 12345