Skip to content

✨ feat(im): 接入语音提醒动作状态同步 - #356

Open
JunLang-7 wants to merge 10 commits into
1024XEngineer:mainfrom
JunLang-7:dev/214-voice-status-sync
Open

✨ feat(im): 接入语音提醒动作状态同步#356
JunLang-7 wants to merge 10 commits into
1024XEngineer:mainfrom
JunLang-7:dev/214-voice-status-sync

Conversation

@JunLang-7

@JunLang-7 JunLang-7 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

目标

完成 #214 的最后一个跨入口展示缺口:当设备已通过语音完成提醒动作时,用户首次打开或刷新微信公众号 H5 不应再看到可操作按钮,而应看到语音终态及最终结果。

实现

  • H5 查询会先按 deviceId + reminderTriggerId 查询设备侧最新动作事实。
  • 若该事实已成功,H5 直接返回只读终态:提醒已通过语音处理;acknowledge 与 snooze 均不再渲染操作按钮,snooze 同时展示设备上报的 nextTriggerAt
  • 终态来源只暴露安全枚举 voice,不暴露设备 Token、Action token 或语音原文。
  • 删除冲突合并后遗留的重复 SQLite 迁移和重复 SparkBot Profile 配置。

需求对照

  • 设备本地事实优先、稳定 eventId/operationId、网络恢复重试、Gateway 认证与幂等、跨入口冲突收口、correlationId 链路:已由 ✨ feat(schedule): 完成提醒动作精确执行与持久化重放 #353 提供。
  • 本 PR 补齐语音先发生时 H5 首次打开/刷新仍可能显示按钮的问题,并明确展示语音终态。
  • 自动化覆盖语音先完成、H5 查询终态、H5 页面无可重用控件、snooze 下一次触发时间、重复上报、并发与乱序冲突。

验证

  • npm testservices/im-gateway):355 通过,5 个依赖 PostgreSQL 的测试按环境跳过。
  • python3 scripts/firmware.py validate:7 个 Firmware Profile 全部通过。
  • cmake -S tests/host -B build/host -DCMAKE_BUILD_TYPE=Debug && cmake --build build/host -j 4 && ctest --test-dir build/host --output-on-failure:94/94 通过。

待验

真机断网恢复、公众号投递与脱敏关联日志仍需按 #214 的实板验收步骤执行。

Refs #214

按 reminderTriggerId 执行 IM 动作,避免最近提醒窗口误操作其他提醒链。
持久化 operationId、动作终态和 nextTriggerAt,使设备任务重启后复用已提交结果。

主机测试、Gateway 门禁和 SparkBot 固件构建已通过;acknowledge 多仓储写入仍沿用现有非事务边界。

Closes 1024XEngineer#179
Linx 启动与提醒到点时,TLS、MCP 和音频初始化可能让内部 RAM 不再有连续任务栈空间。将唤醒控制、串口测试及提醒动作任务栈迁移到已启用的 PSRAM,并保持 WithCaps 创建与删除配对。

Refs 1024XEngineer#179
WakeTask 会在加载本地模型时调用关闭 cache 的分区映射,不能使用 PSRAM 栈。保持其内部栈属性,并在 VoiceSession 启动 TLS、MCP 与音频初始化前完成分配。

Refs 1024XEngineer#179
IM 与语音同时启用后,I2S 播放任务创建时内部堆最大连续块可能不足 16 KiB,导致 VoiceSession 启动失败。
将播放任务栈迁移到 PSRAM,并配对使用 WithCaps 创建和删除接口;ESP-IDF 6.0 构建已通过,真机复测继续进行。

Refs 1024XEngineer#179
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
services/im-gateway/src/application/services.ts 94.73% 1 Missing ⚠️
@@           Coverage Diff           @@
##             main     #356   +/-   ##
=======================================
  Coverage   88.70%   88.71%           
=======================================
  Files         215      215           
  Lines       27129    27151   +22     
  Branches     8577     8533   -44     
=======================================
+ Hits        24066    24087   +21     
- Misses       1434     1435    +1     
  Partials     1629     1629           
Flag Coverage Δ
cpp 88.71% <95.65%> (+<0.01%) ⬆️
typescript 91.20% <95.65%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
services/im-gateway/src/application/api.ts 100.00% <100.00%> (ø)
...m-gateway/src/infrastructure/http/action-ui-api.ts 98.17% <100.00%> (+<0.01%) ⬆️
services/im-gateway/src/application/services.ts 93.93% <94.73%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review conclusion

本次变更的契约解析、本地动作持久化与既有 H5 命令归并路径整体一致,但语音直达的主场景和断网恢复仍存在阻断性缺口;另外成功归并时丢失了来源与关联信息。聚焦的 schedule_reminder_action_execution_test 已构建并通过,git diff --check 通过。

Comment thread services/im-gateway/src/application/services.ts Outdated
Comment thread components/voicelife_mcp/src/tools/schedule_mcp_tools.cc Outdated
Comment thread services/im-gateway/src/application/services.ts Outdated
@JunLang-7
JunLang-7 force-pushed the dev/214-voice-status-sync branch from 0c0c0d3 to 046c4f1 Compare August 24, 2026 10:07
@jing-gou

Copy link
Copy Markdown
Collaborator

标题不符合规范

@JunLang-7 JunLang-7 changed the title feat(im): 接入语音提醒动作状态同步 ✨ feat(im): 接入语音提醒动作状态同步 Aug 25, 2026
@JunLang-7
JunLang-7 force-pushed the dev/214-voice-status-sync branch from 28a2a78 to b48d819 Compare August 26, 2026 14:52
@JunLang-7

Copy link
Copy Markdown
Collaborator Author

@fennoai /review

@fennoai

fennoai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Complete

  • Reviewed the locked b85f3f50f72b86cb519463b9f2409514dde38736...30287d977981b7ad9484d69a5aa2a61b2845c33e diff
  • Checked voice-first lookup, terminal rendering, source redaction, and snooze timing
  • Submitted a non-blocking PR review: no actionable findings

git diff --check passed. Build/tests and lint/format checks were not runnable because the workspace has no installed dependencies (tsc unavailable).

View job run

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the fixed b85f3f50f72b86cb519463b9f2409514dde38736...30287d977981b7ad9484d69a5aa2a61b2845c33e diff. The voice-first H5 lookup correctly uses the device/trigger fact, exposes only the voice source enum, preserves nextTriggerAt, and routes succeeded voice actions to a read-only terminal page without reusable controls. I found no actionable correctness, security, or compatibility issue introduced by this PR.

Validation: git diff --check passed. The gateway build/tests and lint/format checks could not run because dependencies are not installed and tsc is unavailable in the workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants