Files
nana-story/docs/adr/0002-player-view-boundary.md
T
2026-07-28 12:51:00 +08:00

30 lines
829 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ADR 0002RuntimeState 与 PlayerView 是安全边界
- 状态:已接受
- 日期:2026-07-28
## 决策
前端永远不接收完整 `RuntimeState`。所有界面通过 Rust 生成的 `PlayerView` 或同等
脱敏 DTO 读取数据。
`PlayerView` 只包含:
- 当前演出节拍和建议;
- 玩家当前可访问的持有物;
- 玩家已经获得的知识;
- 已接受且允许展示的许诺;
- 模糊化关系阶段;
- 可回溯节点摘要。
## 原因
这条边界从结构上阻止 NPC 隐藏物品、未揭示事实、精确关系数值、骰点和剧情节点泄漏。
仅靠前端“不要显示”不足以形成安全保证。
## 后果
- Vue 不允许导入或缓存 `RuntimeState`
- PlayerView 泄密测试属于跨模块硬门槛。
- 新界面字段必须先证明玩家有权知道。