feat(v2): T-309 SQLite fall-event persistence (mattn/go-sqlite3)
Persist confirmed fall events to a local SQLite DB under artifacts/: camera host/port/channel + event id/track/source/config version/state/ latency/screenshot path/confirmed-at. Schema stores no password (guarded by test). Wire openRecorder/saveRecord into the alerts loop; failures are non-fatal. Re-applied the SILVER-POSE vendored os_windows.go patch that go mod vendor reverted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -648,3 +648,12 @@
|
||||
- 阻塞:③测试连接、⑥SQLite 未做。
|
||||
- 决策:抢前台只能靠 patch vendored Gio(无 API);已加显著标记并在此记录,便于 re-vendor 后重打。
|
||||
- 下一步:③测试连接摄像头按钮+弹窗;⑥SQLite(mattn) 记录(config 保留 host/端口/通道 + internal/store + 接线)。
|
||||
|
||||
## 【2026-07-23】T-309 ⑥:SQLite 摔倒记录持久化(mattn/go-sqlite3, cgo)
|
||||
|
||||
- 状态:CODE-DONE(待 Windows 目视/DB 核验)
|
||||
- 变更:⑥ 新增 `v2/internal/store`(`store.go` + `store_test.go`),用 `mattn/go-sqlite3 v1.14.48`(cgo)落 `fall_events` 表:主机/端口/通道 + 事件ID/轨迹/来源/config 版本/状态/延迟/截图路径/确认 UTC 时间。**schema 无 password 列**(`TestSchemaHasNoPasswordColumn` 守卫)。`config.SourceConfig` 保留 Host/Port/Channel 供落库。`cmd/silver-pose/main.go`:`openRecorder(cfg)` 在 `artifacts/fall-events.db` 建库(`MkdirAll` 后打开,失败仅记日志不阻断监控),alerts 循环内 `saveRecord` 落每条确认事件。
|
||||
- re-vendor 注意:`go get mattn + go mod vendor` **还原了** os_windows.go 的 SILVER-POSE 补丁;已按标记重打(`grep -c SILVER-POSE PATCH` = 1)。
|
||||
- 验证:`CGO_ENABLED=1 go build -mod=vendor ./internal/store/...` 退出码 0(WSL gcc 编译 sqlite3.c);`go test ./internal/store/... ./internal/config/...` 全 ok(含无密码列守卫);`GOOS=windows CGO_ENABLED=0 go build -mod=vendor ./internal/ui/... ./cmd/ui-spike/...` 退出码 0。DB 路径 `v2/artifacts/fall-events.db` 已被 gitignore。
|
||||
- 阻塞:无(T-309 六项代码全部完成)。
|
||||
- 下一步:用户在 Windows 侧目视核验(窗口不抢前台、2×3 截图墙、Esc 关弹窗、按钮灰化、测试连接弹窗、弹窗 5 秒自动关、SQLite 落库)。
|
||||
|
||||
Reference in New Issue
Block a user