Skip to content

feat: 支持 P1 Web 通知渠道一键测试 (#1200) - #1218

Merged
ZhuLinsen merged 1 commit into
mainfrom
feat/1200-p1-web-notification-test
May 7, 2026
Merged

feat: 支持 P1 Web 通知渠道一键测试 (#1200)#1218
ZhuLinsen merged 1 commit into
mainfrom
feat/1200-p1-web-notification-test

Conversation

@massif-01

Copy link
Copy Markdown
Collaborator

PR 类型

  • fix
  • feat
  • refactor
  • docs
  • chore
  • test

背景与问题

Issue #1200 的 P0 配置基线已通过 #1205 合入。本 PR 继续实现 P1:Web 设置页需要支持对单个通知渠道执行一键真实测试,测试应使用当前页面草稿值,不保存 .env,并返回成功/失败、耗时、错误摘要;自定义 Webhook 需要展示逐 URL attempts。

具体改动

  • 后端新增 POST /api/v1/system/config/notification/test-channel 与请求/响应 schema。
  • SystemConfigService.test_notification_channel() 中合成临时通知配置,并直接实例化目标 sender 发送测试消息。
  • 各通知 sender 增加测试路径可选 timeout_seconds 参数,默认发送行为保持不变。
  • 自定义 Webhook 增加 test_custom_webhooks(),按 URL 顺序返回 attempts。
  • Web 设置页通知分类新增 NotificationTestPanel,接入渠道选择、标题、正文、timeout、结果和 attempts 展示。
  • 补充后端/API/sender/Web 单元测试。
  • 更新 docs/notifications.mddocs/full-guide.mddocs/full-guide_EN.mddocs/CHANGELOG.md

关联 Issue

Refs #1200

验证命令与结果

git fetch upstream main --prune
git checkout -b feat/1200-p1-web-notification-test upstream/main
git cherry-pick 8323b36
./scripts/ci_gate.sh
cd apps/dsa-web && npm run lint
cd apps/dsa-web && npm run build
cd apps/dsa-web && npm run test -- src/api/__tests__/systemConfig.test.ts src/components/settings/__tests__/NotificationTestPanel.test.tsx src/pages/__tests__/SettingsPage.test.tsx
git diff --check upstream/main...HEAD

关键输出/结论:

  • ./scripts/ci_gate.sh1731 passed, 2 deselected, 47 warnings, 139 subtests passed,backend gate 全部通过。
  • npm run lint:通过。
  • npm run build:通过;Vite 仍提示既有的大 chunk warning。
  • npm run test -- ...3 passed (3)26 passed (26)
  • git diff --check upstream/main...HEAD:通过。

兼容性与风险

  • 向后兼容:不会重写或迁移现有 .env
  • 默认通知发送行为保持不变;sender 新增的 timeout 参数均为 keyword-only 可选参数,未传入时沿用既有默认值。
  • 新增 Web 测试只在用户显式点击测试按钮时发送真实外部通知。
  • 测试响应返回给 Web 前已统一脱敏;token、secret、password、Bearer、query 参数、URL userinfo 和疑似 path token 均会被 mask。
  • 剩余风险:第三方通知服务可能返回不同格式的 provider-specific 错误体,本期 P1 仅承诺通用错误摘要。

回滚方案

回滚本 PR 即可。该功能不持久化测试请求,也不重写现有 .env,因此无需配置 migration 或数据回滚。

EXTRACT_PROMPT 变更(如适用)

不适用。

展开:完整 EXTRACT_PROMPT
未修改。

检查清单

  • 本 PR 有明确动机和业务价值 / This PR has a clear motivation and value
  • 已提供可复现的验证命令与结果 / Reproducible verification commands and results are included
  • 已评估兼容性与风险 / Compatibility and risk have been assessed
  • 已提供回滚方案 / A rollback plan is provided
  • 若涉及用户可见变更,已同步更新相关文档与 docs/CHANGELOG.mdREADME.md 仅在首页级信息变化时更新,细节优先写入 docs/*.md / If user-visible changes are included, relevant docs and docs/CHANGELOG.md are updated; README.md is updated only for homepage-level changes, with details kept in docs/*.md

@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown

🤖 自动审查报告

项目 结果
📊 变更文件 29 个
➕ 新增行数 1424 行
➖ 删除行数 65 行
🔍 静态检查 ✅ 通过
🧠 AI 审查 ✅ 已完成

📁 修改的文件

  • 📝 api/v1/endpoints/system_config.py (+46/-0)
  • 📝 api/v1/schemas/system_config.py (+50/-0)
  • 📝 apps/dsa-web/src/api/__tests__/systemConfig.test.ts (+50/-0)
  • 📝 apps/dsa-web/src/api/systemConfig.ts (+24/-0)
  • 🆕 apps/dsa-web/src/components/settings/NotificationTestPanel.tsx (+195/-0)
  • 🆕 apps/dsa-web/src/components/settings/__tests__/NotificationTestPanel.test.tsx (+60/-0)
  • 📝 apps/dsa-web/src/components/settings/index.ts (+1/-0)
  • 📝 apps/dsa-web/src/pages/SettingsPage.tsx (+8/-0)
  • 📝 apps/dsa-web/src/pages/__tests__/SettingsPage.test.tsx (+34/-1)
  • 📝 apps/dsa-web/src/types/systemConfig.ts (+44/-0)
  • 📝 docs/CHANGELOG.md (+1/-0)
  • 📝 docs/full-guide.md (+1/-1)
  • 📝 docs/full-guide_EN.md (+1/-1)
  • 📝 docs/notifications.md (+12/-2)
  • 📝 src/notification_sender/astrbot_sender.py (+6/-4)
  • 📝 src/notification_sender/custom_webhook_sender.py (+106/-1)
  • 📝 src/notification_sender/discord_sender.py (+9/-7)
  • 📝 src/notification_sender/email_sender.py (+8/-3)
  • 📝 src/notification_sender/feishu_sender.py (+5/-5)
  • 📝 src/notification_sender/pushover_sender.py (+34/-10)

... 还有 9 个文件


💡 提示: 请确保代码已通过本地测试,并遵循项目代码规范。

@ZhuLinsen ZhuLinsen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

评审结论

  • 必要性:通过,PR 直接实现 #1200 P1 Web 通知渠道一键真实测试,业务动机明确。
  • 是否有对应 issue:有,Refs #1200
  • PR 类型:feat,新增后端 API、服务层测试发送能力和 Web 设置页交互。
  • description 完整性:完整,已覆盖背景、改动范围、验证命令与结果、兼容性风险、回滚方案和 EXTRACT_PROMPT 说明;符合 AGENTS.md 对用户可见变更同步文档与 docs/CHANGELOG.md 的要求,README 未更新也符合首页级信息克制原则。
  • 是否可直接合入:可,当前 CI 为 success,代码/文档/测试覆盖与改动面匹配;mergeable_state=blocked 更像分支保护/权限状态,不构成本次代码审查阻断。

🤖 此回复由 OpenReview Bot 自动生成,仅供参考。如有疑问请 @维护者。

@ZhuLinsen
ZhuLinsen merged commit a4a619d into main May 7, 2026
10 checks passed
cwjyu pushed a commit to cwjyu/daily_stock_analysis that referenced this pull request May 10, 2026
zbl-96 pushed a commit to zbl-96/daily_stock_analysis that referenced this pull request May 10, 2026
EchoingFootsteps pushed a commit to EchoingFootsteps/daily_stock_analysis that referenced this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants