Skip to content

docs: 补齐告警中心 P0 基线与契约 - #1301

Merged
ZhuLinsen merged 2 commits into
ZhuLinsen:mainfrom
massif-01:feat/1202-alert-center-p0-baseline
May 15, 2026
Merged

docs: 补齐告警中心 P0 基线与契约#1301
ZhuLinsen merged 2 commits into
ZhuLinsen:mainfrom
massif-01:feat/1202-alert-center-p0-baseline

Conversation

@massif-01

Copy link
Copy Markdown
Collaborator

PR Type

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

Background And Problem

Issue #1202 的 P0 需要先收口告警中心基线、数据契约、存储评估和 legacy 配置兼容边界,方便后续 P1/P2 在不改变现有 EventMonitor / AGENT_EVENT_ALERT_RULES_JSON 行为的前提下继续实现。

当前仓库已有 EventMonitor、三类 runtime alert rule 和 schedule mode 后台任务入口,但缺少专题文档说明 Phase 边界、后续实体契约和存储落点评估,也缺少 focused tests 锁住这些 P0 契约。

Scope Of Change

  • 新增 docs/alerts.md,说明 EventMonitor 当前基线、三类 runtime rule、legacy JSON 兼容关系、四类告警实体契约、存储方案评估、Phase 边界和 P0 non-goals。
  • 更新 docs/INDEX.md / docs/INDEX_EN.md,在文档索引加入告警中心入口,英文索引按现有惯例标注 Chinese-only。
  • 更新 docs/CHANGELOG.md[Unreleased] 段,按仓库规则追加一条扁平 [文档] 条目。
  • 新增 tests/test_alerts_docs.py,对告警中心文档做结构性契约检查,并校验存储评估引用的 src/storage.py 当前存在。
  • 扩展 tests/test_multi_agent.py::TestEventMonitor,覆盖三类 runtime rule 的序列化 key、status 值和 unsupported placeholder rule skip 行为。
  • 扩展 tests/test_main_schedule_mode.py,覆盖 schedule mode 下 EventMonitor background task 注册,以及无有效 monitor 时不注册 task。

Issue Link

Refs #1202

Verification Commands And Results

.venv/bin/python -m pytest tests/test_alerts_docs.py tests/test_main_schedule_mode.py tests/test_multi_agent.py::TestEventMonitor -q
.venv/bin/python -m pytest tests/test_multi_agent.py::TestEventMonitorConfigIntegration tests/test_system_config_service.py::SystemConfigServiceTestCase::test_validate_accepts_blank_optional_json tests/test_system_config_service.py::SystemConfigServiceTestCase::test_validate_accepts_price_change_percent_event_rule tests/test_system_config_service.py::SystemConfigServiceTestCase::test_validate_rejects_unsupported_event_rule_type -q
.venv/bin/python -m py_compile tests/test_alerts_docs.py tests/test_main_schedule_mode.py tests/test_multi_agent.py
git diff --check
PATH=.venv/bin:$PATH ./scripts/ci_gate.sh

关键输出/结论:

  • Targeted tests: 31 passed, 4 warnings
  • Config integration tests: 9 passed
  • py_compile: passed
  • git diff --check: passed
  • ci_gate.sh: 1933 passed, 2 deselected, 42 warnings, 166 subtests passed; backend-gate: all checks passed

Compatibility And Risk

  • 兼容性影响:None。本 PR 不修改运行时代码路径、API、数据库 schema、.env.example、Web 页面或通知发送实现。
  • legacy 配置:不自动迁移、删除或覆盖 AGENT_EVENT_ALERT_RULES_JSON;文档明确 P0 只定义契约和边界。
  • 风险:主要风险是后续 P1/P2 实现与本文档契约漂移;本 PR 通过文档结构测试、EventMonitor 序列化契约测试和 schedule mode 回归测试降低该风险。

Rollback Plan

Revert this PR 即可回滚;本 PR 不包含数据库迁移、配置迁移或运行时状态写入,不需要额外数据/配置回滚。

EXTRACT_PROMPT Change (if applicable)

未修改 src/services/image_stock_extractor.pyEXTRACT_PROMPT

展开 / Expand: Full EXTRACT_PROMPT
N/A

Checklist

  • 本 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 added ai documentation Improvements or additions to documentation size/L testing labels May 14, 2026
@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown

🤖 自动审查报告

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

📁 修改的文件

  • 📝 docs/CHANGELOG.md (+1/-0)
  • 📝 docs/INDEX.md (+1/-0)
  • 📝 docs/INDEX_EN.md (+1/-0)
  • 🆕 docs/alerts.md (+148/-0)
  • 🆕 tests/test_alerts_docs.py (+88/-0)
  • 📝 tests/test_main_schedule_mode.py (+90/-0)
  • 📝 tests/test_multi_agent.py (+58/-0)

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

@massif-01 massif-01 changed the title 文档:补齐告警中心 P0 基线与契约 docs: 补齐告警中心 P0 基线与契约 May 14, 2026
@massif-01
massif-01 marked this pull request as ready for review May 14, 2026 17:35
@massif-01
massif-01 requested a review from ZhuLinsen as a code owner May 14, 2026 17:35
@massif-01

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

ℹ️ 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".

@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.

评审结论

  • 必要性:通过,Issue #1202 P0 需要先固化告警中心基线、契约和兼容边界,本 PR 的文档与契约测试覆盖该目标。
  • 是否有对应 issue:有,Refs #1202
  • PR 类型:docs/test,主要新增 docs/alerts.md 与文档索引/CHANGELOG,同时补充 focused tests 锁定 EventMonitor、schedule mode 和文档结构契约。
  • description 完整性:完整,已包含背景、范围、issue、验证命令与结果、兼容性风险、回滚方案,并符合 AGENTS.md 对 CHANGELOG 扁平条目和 README 克制更新的要求。
  • 是否可直接合入:可,当前 CI 为 success,改动未触及运行时代码、API、数据库 schema、.env.example、Web 或通知实现;mergeable_state=blocked 不单独构成代码阻断,按仓库分支保护由具备权限的维护者合入即可。

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

@ZhuLinsen
ZhuLinsen merged commit 39ab374 into ZhuLinsen:main May 15, 2026
4 checks passed
Anyone878 pushed a commit to Anyone878/daily_stock_analysis that referenced this pull request May 17, 2026
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
EchoingFootsteps pushed a commit to EchoingFootsteps/daily_stock_analysis that referenced this pull request Jul 4, 2026
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
bmwu pushed a commit to bmwu/daily_stock_analysis that referenced this pull request Aug 24, 2026
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai documentation Improvements or additions to documentation size/L testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants