feat(pr): PR 列表未读标记 + 状态目录临时文件清理#128
Merged
Merged
Conversation
跟踪的 PR 在以下情况标未读圆点,打开即清除:新进入待审列表(新分配 / 请求评审)、源分支推新 commit、或有人 @你 / 回复你。 - poller 在 PR 内容变更时拉评论扫描「@我 / 回复我」,维护 lastMentionAt 游标;commit 未读由 head sha 比对在读取时派生,零额外 API。 - 已读水位独立成 read-state.json,仅 markRead(用户打开 PR)写,与 poll 周期性重写 index.json 解耦,避免覆盖竞态。 - 早期开发版不做升级兼容(未打开过即未读,不抑制旧存量泛红)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
markRead 此前用 setState 更新器的副作用判断「是否未读」来决定要不要发 IPC,但更新器在渲染阶段才执行、同步读其副作用恒为初值 → 提前 return → prs:markRead 从未发出、read-state 从未落盘,重启后又判为未读。改为选中即 发 IPC 持久化已读水位。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
原子写「tmp → rename」中,进程在两步之间被强杀 / 退出(如关窗瞬间仍有 in-flight 的异步窗口状态写)会留下 *.tmp 孤儿,跨会话持续累积。新增 sweepStaleTmpFiles,在启动早期、任何写入之前删掉全部 *.tmp——单写者前提下 此刻无 in-flight 写,凡 tmp 皆是上次会话孤儿;绝不在运行期清扫,以免误删 并发写 / rename 重试正在用的 tmp(冲突场景不误删多余文件)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为 PR 列表加「未读」标记,并顺带修复状态目录残留临时文件累积的问题。
改动
Added — PR 列表未读标记
跟踪的 PR 在以下情况标一个亮蓝未读圆点,打开 PR 即清除:
实现要点:
pr.sourceRef.sha已在 poll payload 里,与已读 head 比对);mention 仅在 PR 内容变更时拉评论扫描「@我 / 回复我」,成本随活动量。read-state.json、仅markRead(打开 PR)写,与 poll 周期性重写index.json解耦,避开覆盖竞态。Fixed
markRead用 setState 更新器的副作用判断「是否未读」来决定是否发 IPC,更新器在渲染阶段才跑、同步读其副作用恒为初值 → IPC 从未发出、read-state 未落盘,重启后又判未读。改为选中即发 IPC。*.tmp孤儿、跨会话累积。新增sweepStaleTmpFiles,启动早期、任何写入之前清扫全部*.tmp;单写者前提下此刻无 in-flight 写,凡 tmp 皆是上次会话孤儿,绝不在运行期清扫以免误删并发写 / rename 重试正在用的 tmp。验证
四步全绿:
nx test poller(113 例,含 unread 扫描 + computeUnread 矩阵)、typecheck/lint(shared / ipc / poller / state-store / desktop)、build desktop。🤖 Generated with Claude Code