Files
tick-stock-panel/frontend
shy3130 da4ed64707 fix(data): busy 降级期间 storage 为 null 不再使数据页整页崩溃
用户反馈桌面客户端数据页 "Unexpected Application Error! Cannot read
properties of null (reading 'total_size_mb')"。根因: /api/data/status 在
预热/同步/修复期间 (busy) 不重算存储统计, 冷启动缓存从未热过时
_get_storage 返回 None — 前端存储卡片 s.storage.total_size_mb 只判了 s
没判 s.storage, 6 处访问全部抛 TypeError, 整页被错误边界接管。与此前
"立即获取数据"误判同族 (busy 降级契约: 空值不代表无数据)。

- DataStatus.storage 类型改为 {...} | null 诚实反映降级契约, 编译期
  强制所有消费点判空
- 数据页取安全别名 const storage = s?.storage, 总大小与表统计/扩展数据
  全部 storage?. 判空, 缺值降级显示 — 或 0
- 后端补契约测试: 冷启动 busy 且缓存未热时 _get_storage 返回 None
  (原测试只覆盖缓存热过后清空仍留 stale 的路径)

验证: Data.status.test 修复前红 (错误与用户截图逐字一致) 修复后绿;
后端 test_data_status_busy 10 passed; 全量 vitest 338 passed; pnpm build。

Signed-off-by: shy3130 <shy3130@qq.com>
2026-10-29 13:09:56 +08:00
..
2026-06-18 17:18:23 +08:00
2026-06-18 17:18:23 +08:00
2026-06-18 17:18:23 +08:00
2026-06-18 17:18:23 +08:00