-
Notifications
You must be signed in to change notification settings - Fork 0
feat(notify): urgent priority alert for assigned admins #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -732,6 +732,24 @@ describe("conversation service", () => { | |
| const empty = service.listByAssignee("999", 20); | ||
| assert.equal(empty.length, 0); | ||
| }); | ||
|
|
||
| it("supports urgent priority with assignee for alert trigger", async () => { | ||
| const service = new ConversationService(handle.db, 30); | ||
| const bundle = await service.getOrCreateConversation({ | ||
| platform: "telegram", | ||
| externalUserId: "700", | ||
| displayName: "UrgentUser", | ||
| }); | ||
| service.setPriority(bundle.conversation.id, "urgent"); | ||
| service.assign(bundle.conversation.id, "500"); | ||
|
|
||
| const conv = await service.getConversation(bundle.conversation.id); | ||
| assert.ok(conv); | ||
| assert.equal(conv!.priority, "urgent"); | ||
| assert.equal(conv!.assignedAdminId, "500"); | ||
| // Alert condition: priority === "urgent" && assignedAdminId is truthy | ||
| assert.ok(conv!.priority === "urgent" && conv!.assignedAdminId !== null); | ||
| }); | ||
|
Comment on lines
+736
to
+752
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win 这个用例没有覆盖新增的 Telegram 紧急提醒行为。 它只验证了 🤖 Prompt for AI Agents |
||
| }); | ||
|
|
||
| describe("permissions and rate limits", () => { | ||
|
|
@@ -824,6 +842,9 @@ describe("telegram helpers", () => { | |
| assert.ok(adminBotCommands.some((command) => command.command === "ai_on")); | ||
| assert.ok(adminBotCommands.some((command) => command.command === "ai_off")); | ||
| assert.ok(adminBotCommands.some((command) => command.command === "help")); | ||
| assert.ok(adminBotCommands.some((command) => command.command === "search")); | ||
| assert.ok(adminBotCommands.some((command) => command.command === "mine")); | ||
| assert.ok(adminBotCommands.some((command) => command.command === "audit")); | ||
| assert.ok(adminBotCommands.every((command) => !command.command.startsWith("/"))); | ||
| }); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
把紧急提醒放到“投递成功”分支里,而不是放在整个
try/catch之后。现在这段代码有两个相反但都错误的结果:如果
copyWithDelivery()失败并走了 Line 280-Line 299 的错误处理,这里仍会继续发提醒;而如果首个 Topic 失效并走了 Line 220-Line 265 的重建成功路径,这里又永远执行不到。这样既不满足“成功投递后再提醒”,也会漏掉重建 Topic 后的成功投递。建议用deliveredToManagement标记,或把提醒抽到每个成功投递分支里,在任何早退之前执行。🤖 Prompt for AI Agents