✨ feat: WP-03 三界归真作用域与消息版本谱系(ADR-020 落地)

- 迁移 5:conversation.realm(默认真界,检查约束);message.realm 快照、canonized_at、parent_message_id 自引用与 variant_kind(origin/revision/candidate)
- 界域端点:GET conversation(realm/当前分支)与 POST realm(入境/出境显式切换,留审计——ADR-020 切换必须可见)
- 归真端点 POST /v1/messages/{id}/canonizations:scope 必须与消息界域一致(不一致 422);幂等(重复归真 200 原状态);境界归真产出 world.canonized Outbox 事件(世界知识候选入口,WP-04 消费);幻境归真仅标记试演记录
- 编辑版本 POST /v1/messages/{id}/revisions:新消息 variant=revision 引用原消息(markdown 修订同样经灵台引擎规范化),原消息永不修改
- 测试 44 项全绿(+8):界域快照、归真正/反/幂等、幻境试演、revision 原消息不变、跨域 401/403/404 fail-closed
This commit is contained in:
chenxin committed 2026-09-10 13:28:25 +08:00
1 parent 37c53862c4
commit 603a683c14
6 files changed
+432 -6

No files matched your search

+2 -1
View File
@@ -3,8 +3,8 @@
from fastapi import FastAPI
from app.auth.routes import router as auth_router
from app.conversations.routes import message_router, run_router
from app.conversations.routes import router as conversations_router
from app.conversations.routes import run_router
from app.core.config import get_settings
from app.core.errors import install_error_handlers
from app.core.middleware import RequestContextMiddleware, configure_logging
@@ -27,6 +27,7 @@ def create_app() -> FastAPI:
app.include_router(auth_router)
app.include_router(conversations_router)
app.include_router(run_router)
app.include_router(message_router)
@app.get("/healthz", tags=["ops"])
async def healthz() -> dict[str, str]: