Repository navigation
feat(admin): 派发日志卡片新增手动清空入口 - #31
Merged
Merged
Conversation
DELETE /api/plugins/{id}/logs 清空该插件在 hub 进程内环形缓冲里的派发条目,
响应带 cleared 计数,面板 toast 据此告诉操作员清掉了多少——「丢了什么」
是这种不可撤销动作值得多报一句话的那类。空管道也走 200 + cleared:0,
不存在的插件行号 404,与查看路径同门。
Co-Authored-By: Claude Sonnet 5 <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.
派发日志卡片新增「清空」按钮:操作员选中一个插件后点清空,弹确认框,确认后 hub 进程内环形缓冲里该插件的派发条目一次性清掉,响应体带
cleared计数,toast 据此告诉操作员清掉了多少——「丢了什么」是这种不可撤销动作值得多报一句话的那类。空管道也走同一条路返回 200 +cleared:0,不存在的插件行号 404,与查看路径同门。后端
Registry::clear_dispatch_log用VecDeque::retain按 plugin_id 过滤;DELETE /api/plugins/{id}/logs复用 GET 同名路由的 Admin 提取器与plugin_or_404404 门。push 与 clear 共用同一把dispatch_log互斥锁,清的过程中并发派发照常写,新条目都在锁释放之后落地,没有「边清边写丢一条」的窗口。前端在 Select 与 Refresh 之间加Trash2 + 清空按钮 + ConfirmDialog;cls-budget.mjs加清空marker 断言按钮渲染。cargo test全 229 个测试通过,新加deleting_a_plugins_dispatch_log_emits_count_and_clears覆盖「首次清空返回 cleared=1」、「空管道再清空返回 cleared=0」、不存在的行号 404。oxlint+tsc -b+vite build+ 真实 Chrome 跑cls-budget全 7 条路由绿。Post-Deploy Monitoring & Validation
无新 hub 日志或 metrics:派发记录的写入路径不变。验证由面板直连:任选一个插件 → 「派发日志」卡片 → 「清空」→ 确认 → expect toast「已清空 N 条记录」(空管道 expect「派发日志已是空的」)。未命中时 hub stderr 是否 panic 在
dispatch_log互斥锁路径。回滚:revert PR(环形缓冲是进程内数据,无持久化)。