feat(v1): add temporal fall state machine

This commit is contained in:
ila
2026-07-21 09:59:53 +08:00
parent 3c0e11f811
commit 1f6bbd8f98
8 changed files with 231 additions and 26 deletions
+5 -5
View File
@@ -293,7 +293,7 @@ git commit -m "feat(v1): add pose quality evidence"
- Create: `v1/fall_state.py`
- Create: `v1/tests/test_fall_state.py`
- [ ] **Step 1: Write event timing tests**
- [x] **Step 1: Write event timing tests**
```python
def test_confirmed_event_is_emitted_once_after_persistence():
@@ -318,12 +318,12 @@ def test_confirmed_person_recovers_before_new_event_is_allowed():
assert machine.state_of("7") is FallState.NORMAL
```
- [ ] **Step 2: Run tests to verify failure**
- [x] **Step 2: Run tests to verify failure**
Run: `python -m pytest v1/tests/test_fall_state.py -v`
Expected: FAIL because `FallStateMachine` is missing.
- [ ] **Step 3: Implement the four-state contract**
- [x] **Step 3: Implement the four-state contract**
```python
from dataclasses import dataclass
@@ -399,12 +399,12 @@ class FallStateMachine:
Use per-ID state, not global `frame_has_fall`. A source error and a rejected pose must not advance the machine.
- [ ] **Step 4: Run tests**
- [x] **Step 4: Run tests**
Run: `python -m pytest v1/tests/test_fall_state.py -v`
Expected: PASS.
- [ ] **Step 5: Commit**
- [x] **Step 5: Commit**
```powershell
git add v1/fall_state.py v1/tests/test_fall_state.py docs progress.md