test(v1): lock reconnect and disconnect-no-alarm behavior; close T-203

Adds a mid-stream drop recovery test and a pipeline test proving a
disconnected frame yields no events and interrupts a pending suspect
(stream loss never alarms). Live preview and fall detection on the real
Hikvision stream were confirmed on Windows. 74 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ila
2026-07-21 23:49:21 +08:00
co-authored by Claude Opus 4.8
parent b35082a643
commit f1a8d0ea47
5 changed files with 70 additions and 3 deletions
+9
View File
@@ -334,3 +334,12 @@
- 阻塞:无。截图像素级观感需 Windows 目视确认,但乱码根因(非 ASCII 送入 Hershey 字体)已在逻辑层修掉。
- 决策:截图标注限定 ASCII;若需中文标注(如"确认摔倒")另立任务用 Pillow+TTF 绘制。
- 下一步:用户 Windows 复测截图文字是否正常;继续 T-203/T-204。
## 【2026-07-21】T-203 接入海康 RTSP 与断流恢复(完成)
- 状态:DONE
- 变更:本任务无新增生产代码(重连逻辑在 T-102/T-106 已实现),补齐断流/重连的确定性测试并据现场结果验收。
- 验证:真实海康流已连通并在 Windows 现场跑通实时预览、骨架、状态与摔倒确认(用户确认,T-208/T-209 期间)。断流与重连以确定性测试锁定:`test_reconnect_waits_then_reopens_with_bounded_backoff`(不可达→有界退避→恢复 CONNECTED)、`test_stream_recovers_after_mid_stream_drop`(连接中→途中断→重连恢复)、`test_stream_source_uses_read_clock`(实时流用收帧单调时钟)、`test_disconnect_interrupts_suspect_without_alarm`(断流帧使管线返回 0 人 0 事件并把疑似打断回 NORMAL,即断流不报警)。WSL 对真实流的冒烟:STREAM 首读即 connected 解出 1920×1080;对不可达地址进入 retrying、不崩溃、空帧、不报警。`python3 -m pytest v1/tests -q` 为 74 passed;`python3 -m compileall -q v1` 退出码 0。
- 阻塞:无。真实"拔网→正在重连→恢复自动接上"的可视化观察由用户在 Windows 现场做一次目视核对(步骤见下一步),逻辑侧已测。
- 决策:断流只表达来源状态、绝不触发或推进摔倒事件;实时流以收帧单调时钟计时;重连用有界指数退避。
- 下一步:用户可选做一次现场断网核对(拔网线/停流→画面显示"正在重连…"、不出红色告警→恢复后自动接上并继续检测)。继续 T-204:需经同意成年人的正反例录像做事件级验收(含放宽灵敏度后的不误报验证)。