feat: stabilize cold display runtime deployment

This commit is contained in:
Yoilun
2026-05-29 14:48:01 +08:00
parent ea5f9b1b07
commit 8b5bbff364
32 changed files with 5050 additions and 241 deletions

View File

@@ -2,20 +2,20 @@
## Goal
Create an independent git project under `~/Code` for monitoring food batches in a refrigerated display cabinet. The system tracks each configured display zone, starts a batch timer when food appears, ends it when the zone clears, and raises compliance alerts for over-3-hour removal without trash disposal or for over-3-hour food being put back.
Create and evolve an independent git project under `~/Code` for monitoring food batches in a refrigerated display cabinet. The system tracks each configured food zone, starts a batch timer when food appears, raises a configurable time alarm, and escalates alarmed food to a warning if it is removed without a matching trash-bin deposit.
## Confirmed Decisions
- The trash bin is visible in the same camera frame.
- The display cabinet starts as a 4-column by 2-row layout, but zones must be configurable.
- Food zones are configurable; v1.1 supports 1 to 10 numeric zones.
- A zone may contain multiple food items.
- Items in the same zone are treated as one batch.
- Mixed batches are not allowed; a zone must clear before a new batch can start.
- The first implementation is a standalone project, not a modification of `store_dwell_alert`.
## Phases
## Original Milestones
| Phase | Status | Notes |
| Milestone | Status | Notes |
| --- | --- | --- |
| Create project skeleton | complete | Built under `~/Code/cold_display_guard`. |
| Write design and implementation plan | complete | Saved in `docs/plans/`. |
@@ -29,3 +29,50 @@ Create an independent git project under `~/Code` for monitoring food batches in
| Error | Attempt | Resolution |
| --- | --- | --- |
| Ended batches reported `0` dwell seconds | First `unittest` run | Calculate dwell seconds before assigning `ended_at`. |
## v1.1 优化改造
### Goal
正式支持 1 到 10 个自定义食品区域、阿拉伯数字区域标注、可编辑垃圾桶 ROI、自定义时间报警阈值以及“到达报警阈值先报警报警后移出但未丢垃圾桶则升级为警告”的事件链路。
本节所有需求属于同一个 `v1.1 优化改造` 批次;下方只是该批次内的工作项,不代表拆成多个独立批次或多个版本。
### Stop Conditions
- [x] v1.1 所有工作项完成。
- [x] 必要 Python 测试通过。
- [x] 前端构建通过。
- [x] `docs/project.md` 更新项目目标、架构、配置、运行方式和关键决策。
- [x] 没有 blocking bug 或未处理的高风险问题。
- [x] 如果同一问题连续 3 次修复失败,暂停并报告原因、已尝试方案和建议下一步。
### Workstreams Inside This Batch
| Workstream | Status | Goal | Acceptance Criteria |
| --- | --- | --- | --- |
| Batch setup and planning | complete | 建立 `v1.1 优化改造` 文件化计划和项目文档 | `task_plan.md``findings.md``progress.md``docs/project.md` 包含 v1.1 范围、工作项、验收标准和风险 |
| Backend event model | complete | 状态机支持数字区域、时间报警、报警升级警告 | TDD 覆盖 `time_alarm``warning_escalated`、数字区域元数据;目标测试和全量 Python 测试通过;代码审查通过 |
| Config and management API | complete | 配置/API 支持 1-10 区域、报警阈值、垃圾桶 ROI 保存 | 配置 round trip、校验、summary/events 字段测试通过;代码审查反馈已修复 |
| Frontend management console | complete | 管理页支持动态区域标定、垃圾桶 ROI 标点、报警阈值配置和新事件显示 | `web/src/main.js``web/src/styles.css` 实现交互;`pnpm build` 通过;前端复审通过 |
| Homepage demo runtime display | complete | 首页在无真实事件时也展示完整原型样例,并清空旧事件数据 | 首页默认进入运行页演示态包含运行摘要、计时进度、事件表和清晰演示标识真实事件优先前端测试和构建通过Docker web 已重建 |
| Documentation and final review | complete | 更新 README/project docs执行最终代码审查和验证 | README 与命令/字段一致;代码审查无 blocking验证证据记录到 `progress.md` |
### v1.1 Decisions
- 食品区域使用数字字符串 ID`"1"``"10"`;事件中同时输出 `zone_index``zone_label`
- 垃圾桶 ROI 保持在 `[trash] roi`,不占用食品区域编号。
- `max_dwell_seconds` 继续作为主要时间报警阈值;默认可保持 10800 秒,用户可以改成 1200 秒等。
- 到达阈值时先发 `time_alarm`,批次继续处于活跃区域。
- 已报警批次从区域移出后进入垃圾桶确认窗口;若窗口内没有垃圾桶动作,发 `warning_escalated`
- 首页运行页在事件为空或运行数据不完整时显示标记为演示的数据,避免空白页面;真实事件数据存在时优先展示真实数据。
- 后续每次派发智能体任务,都必须在任务正文开头加入标准上下文头:
```text
[项目: /Users/yoilun/Code/cold_display_guard]
[工作流批次: v1.1 优化改造]
[阶段: 阶段 x]
[角色: 对应智能体角色]
```
其中 `阶段 x` 表示同一 `v1.1 优化改造` 批次内的工作阶段,不代表拆分成独立批次。