修复 ComponentUpdate schema 缺 positioning 字段(PATCH 静默丢弃)
优先级
P1
类型
Bug 修复
状态
已完成
负责人
@小敏
📝 描述
根因:backend/app/schemas.py:ComponentUpdate schema 缺 positioning 字段。复现:curl PATCH /api/v1/components/{name} body={"positioning": "..."} → 200 + 旧数据,Pydantic 静默丢弃未知字段。影响:任何反向更新 component positioning 的需求(如 REQ-968b1c99 P2.4)都失败,CLI 报告 ✓ 但实际未生效。同类历史:FB-38f2024f + REQ-f8fa2992(缺 composed_of 字段,2026-06-22 修)。修复:ComponentUpdate 加 positioning: Optional[str] = Field(None, min_length=10, max_length=500),加 4 个单测覆盖(PATCH 改 positioning 成功 + 不传不改保留原值 + 10 字符下限 + 500 字符上限)。回归影响:0 风险(纯加可选字段),LayeringCheck 不受影响。
👤 用户故事
作为 架构师,我希望 ComponentUpdate schema 包含 positioning 字段,以便 PATCH 能反向更新 component 定位描述(对齐 CLAUDE.md 一致性原则);不修会导致任何 '组件能力变化后反向更新 positioning' 的需求都失败,例如 REQ-968b1c99 (核心思想实体) 的 P2.4 步骤。
✅ 验收标准 (4 项)
-
Given ComponentUpdate schema 当前缺 positioning 字段
When 客户端 PATCH /api/v1/components/{name} body={"positioning": "new text"}
Then 返回 200 + 新 positioning,DB 持久化
-
Given ComponentUpdate 修复后
When 客户端 PATCH 不传 positioning
Then 原 positioning 保留,不影响其他字段
-
Given ComponentUpdate 修复后
When 客户端 PATCH positioning 长度 < 10 或 > 500
Then 返回 422 + Pydantic ValidationError
-
Given 修复后
When 运行 arch-platform-backend 全部 pytest
Then 所有现有测试通过,无回归
🔄 推进状态
创建于 2026-06-27 05:21
· 决策于 2026-06-27 08:10
· 关闭于 2026-06-27 08:15