Skip to content

重做到期通知的逐项处置与忽略语义 - #78

Merged
amazing-fish merged 3 commits into
mainfrom
codex/issue-55-notification-actions
Aug 6, 2026
Merged

重做到期通知的逐项处置与忽略语义#78
amazing-fish merged 3 commits into
mainfrom
codex/issue-55-notification-actions

Conversation

@amazing-fish

@amazing-fish amazing-fish commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Refs #55

本 PR 取代冲突的 #59#59 不应继续合入,并应在本 PR 完成后关闭。

目的

把多任务同时到期时的通知改为完全逐项处置:每条任务只在自己的行内完成、独立推迟或忽略,移除复选框和底部批量区,避免用户在到期瞬间维护额外选择状态。

行为变化

  • 每行只提供“完成”“推迟”“忽略”三个入口;完成和忽略各一次点击,推迟在第二次点击选择该行独立时长。
  • 行内推迟统一提供 15 分钟后、1 小时后、晚上 8 点、明天上午 9 点四个选项,单元素列表沿用现有 signal/handler 边界。
  • 通知窗口不再创建复选框,也没有底部“完成选中”“选中推迟”“清除所选截止时间”批量区;窗口布局只保留标题和可滚动任务区。
  • “忽略”按钮的 tooltip 明确说明:保留任务、清除截止时间、不标记完成,重新设置截止时间前不再提醒。
  • 每行同时显示本地绝对截止时间和持续刷新的“已超时/还有”相对量。
  • 保留单一非模态通知窗口、提醒音效、定位与 _adjust_size_and_position 策略,不改变主列表、托盘、主题切换或存储结构。

行内控件形态

使用紧凑的行内按钮组:完成是单击按钮,推迟是带四项菜单的按钮,忽略是单击按钮。任何单条处置不超过两次点击,也不存在需要提前维护的选择状态。移除底部区后,视觉层级与行为入口统一集中在对应任务行。

“忽略”字段语义

字段 处理 理由
dueDate 置为 None 移除时间约束与超时显示
snoozeUntil 置为 None 清除已失去截止时间语境的推迟状态
notifiedForReminder 置为 False 重设截止时间后可重新提醒
notifiedForDue 置为 False 同上
reminderOffset 保留 它是提醒偏好,重设截止时间后继续生效
completed 保持不变 忽略不等于完成
lastNotifiedAt 保留 保存最近提醒的历史事实

数据变更仍只由 main_window.py handler 执行;dialogs.py 只发出单元素 ID 列表。处理后统一保存、刷新主列表并从通知窗口移除对应行,清空时复用现有关闭行为。

相对时间格式化与刷新

主列表 formatter 是 TodoItemWidget 的私有实例方法,且 widgets.py 不在本 Issue 范围;本 PR 在 NotificationDialog 内保留最小时长 formatter,严格沿用主列表的天/时/分/秒单位、向下取整和最多两段规则。对话框持有 1 秒 QTimer,每轮以同一个 UTC 当前时刻刷新全部可见行,不调用 _adjust_size_and_position

修改过的现有断言

未删除覆盖场景,按最终交互替换旧断言:

  1. test_actions_emit_only_selected_tasks_and_keep_remaining_rows 重命名为 test_dialog_has_only_inline_actions_and_keeps_remaining_rows。旧的默认勾选、批量按钮 enable/no-op 和批量 signal 断言已不再适用,替换为:对话框根布局只有标题与任务区、没有任何 QCheckBox、旧四个批量控件属性与 batchIgnoreButton 均不存在。
  2. 该测试继续保留逐行移除、剩余任务保持窗口打开、最后一项移除后关闭并释放对象的原覆盖。
  3. test_inline_actions_target_only_their_own_task 保留完成/独立推迟/忽略只发送自己的 ID,并新增“忽略”文案和 tooltip 中“清除截止时间”的断言。
  4. 两个 handler 测试只重命名以移除已不存在的 batch/selected UI 术语,字段与保存次数断言保持不变。

新增与既有测试继续覆盖行内单条完成/推迟/忽略、四个推迟菜单项、绝对+相对时间、1 秒全行刷新、不同任务不同推迟时长,以及忽略字段语义和后续 tick。

本地验证

解释器:D:\Develop\Tool\Miniconda\envs\try\python.exe,PySide6 6.9.0;仓库锁定 PySide6 6.11.1 由 CI 验证。

  • python -m unittest discover -s tests -v:Ran 74 tests,OK,0 failure、0 error、0 skip。
  • python -m unittest tests.test_notifications -v:16 项通过。
  • python -m compileall todo_app:通过。
  • git diff --check:通过。
  • git diff --name-status origin/main...HEAD -- tests/M tests/test_notifications.py
  • 既有套件继续通过:layout 5、storage 10、widgets 25、dialogs 7、fonts 5。

Windows Qt 手工/视觉验证

使用 Windows 原生 Qt 构造三个相近到期任务:

  • 根布局 count 为 2,复选框数量为 0,底部批量区不存在。
  • 三行均显示“完成”“推迟”“忽略”;行内菜单和相对时间可辨识。
  • 浅色、深色主题均已渲染并目检;窗口实测为 499×296 px。
  • 原有行为回归继续覆盖:完成只影响该条、不同任务独立推迟、忽略后无截止日期且不再提醒、重新设置截止时间后提醒恢复。

截图已在本地交付环境生成;CLI 无法直接把本地二进制作为 PR 附件上传。

CI 根因与新 HEAD

  • 旧 HEAD e48f2ce 的 run 31119608056 三次尝试均在执行仓库代码前失败:两个 job 15 分钟未获 hosted runner;一个 job 获得 Ubuntu runner后,在下载官方 action 元数据时连续收到 Service Unavailable 与 HTTP timeout。
  • 旧 run 从未进入 checkout、依赖安装、compileallunittest,因此失败与本地代码或断言无关,修改 workflow/业务代码无法修复 GitHub runner/下载服务。
  • 当前 HEAD:b82516952fbec122b9d10a49f3c9d2ed9609e767。已推送并等待 GitHub 为 synchronize 事件创建新的 tests.yml check;创建后将回写实际运行结果与用例总数。

Codex review closure

  • 首轮 review 在 1d95ab3 指出相对时间不持续刷新,已在 e48f2ce 修复并解决 thread。
  • 当前 b825169 包含新的 UI 精简,需以该 HEAD 的后续 Codex review 结论为最终依据。

文档与锚点

  • README 已更新为纯行内“完成/推迟/忽略”,明确没有复选框或底部批量操作。
  • 锚点已更新:提醒流程和最近约定变更反映最终交互;本次仍属于同一未发布 feature,版本保持 v2.1.0

已知风险

  • 忽略会丢弃原设定截止时间,本次不提供撤销或历史恢复。
  • 移除批量区后,多条任务必须逐项处理,这是本次明确选择的交互语义。
  • 行内三个控件占用横向空间;窄窗口继续使用现有滚动行为,未修改定位或尺寸策略。
  • 本地 PySide6 为 6.9.0,与锁定的 6.11.1 不同;最终兼容性仍以新 HEAD 的绿色 tests.yml 为准。

2026-08-07 02:23(UTC+8)补充:GitHub 官方状态页正将 Actions 标记为 major outage,并明确说明 workflow run 仍可能启动失败或延迟、queued job 可能超时;这也解释了当前 HEAD 尚未创建 Actions run。事故链接:https://www.githubstatus.com/incidents/qcvjkzcs7j74

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d95ab3a96

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread todo_app/dialogs.py
@amazing-fish

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: b82516952f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

2 participants