feat(chat): cut over to single SSE endpoint

This commit is contained in:
zhuyongxin
2026-07-22 10:01:12 +08:00
parent f8809cb7dd
commit bc36248cd8
36 changed files with 2187 additions and 945 deletions
@@ -0,0 +1,49 @@
# Acceptance: single-react-chat-sse-cutover
## Result
- Status: archived
- OpenSpec tasks: 14/14 complete
- Interface impact: L4 breaking HTTP/frontend contract
- Public Chat protocol: unique named-event SSE `POST /api/chat`
## Static Verification
- 组合路由保持 `/api/chat`、`/api/ai_ops`、`/api/chat/clear`、`/api/chat/session/{sessionId}` 和 `/runs`;`/api/chat_stream` 已删除。
- 生产 Controller/前端 legacy Chat token scan:0。
- `ChatController` forbidden dependency scan:0;结构测试固定其三个 protocol/application dependencies。
- SSE payload 只包含固定 metadata/status/content/failure/done fields,`CANCELLED` 不作为公开 done outcome。
- mode selector DOM、state、consumer 和 CSS 已删除。
## Script Verification
- `mvn -q -DskipTests compile`:通过。
- Stage 2-6B + AiOps regression selection:24 suites / 101 tests,0 failure/error/skipped。
- `openspec validate single-react-chat-sse-cutover --strict`:通过。
- `node --check src/main/resources/static/app.js`:通过。
- `git diff --check`:通过,仅有仓库既存 LF/CRLF 提示。
## Browser or Manual Verification
- 本阶段未运行浏览器人工验证;前端协议由静态 contract test 和 JavaScript syntax check 覆盖。
## Not Verified
- 未运行 live 模型、Redis、日志和 MySQL E2E;按 ISS-014 阶段门禁统一留到阶段 7。
- 未验证外部第三方 Chat API consumer;L4 变更不提供兼容分支,外部消费者必须同步迁移到 named-event SSE。
## Migration and Rollback
- 部署必须将后端 SSE endpoint 与 bundled frontend consumer 作为同一版本原子发布。
- 回滚必须同时回滚 Controller 和 frontend 到阶段 6A commit;V012 additive nullable migration 可保留。
- 不允许通过恢复 `/api/chat_stream`、同步 JSON consumer 或旧 message wrapper 形成双轨兼容。
## Remaining Work
- 阶段 7:物理删除旧 Agent/Graph/Hook/ThreadLocal/ChatService 路径和过时测试,更新文档并完成最终 live E2E、日志与数据库核验。
## Archive
- `.archive-ready`: created
- OpenSpec archive: `openspec/changes/archive/2026-07-22-single-react-chat-sse-cutover`
- Main spec sync: `openspec/specs/single-react-chat-sse-cutover/spec.md` (10 requirements added)