cmux-shared-behavior
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecmux Shared Behavior
cmux 共享行为
Use one shared action/model path when behavior is exposed through multiple entrypoints.
当某一行为通过多个入口点暴露时,使用统一的共享操作/模型路径。
Shared entrypoints
共享入口点
When a behavior is exposed through multiple surfaces, implement one shared action/model path and verify every entrypoint that should invoke it.
Common entrypoints include:
- keyboard shortcut
- command palette
- context menu
- CLI/socket command
- settings UI
- debug menu
Do not patch one surface while leaving the others with duplicated logic.
当某一行为通过多个界面暴露时,实现一条统一的共享操作/模型路径,并验证所有应调用该路径的入口点。
常见入口点包括:
- 键盘快捷键
- 命令面板
- 上下文菜单
- CLI/套接字命令
- 设置UI
- 调试菜单
不要仅修复某一个界面,却让其他界面保留重复逻辑。
Optimistic updates
乐观更新
For optimistic UI or CLI updates:
- keep one mutation path
- record pending state with a request id or previous snapshot
- reconcile from the authoritative result
- handle failure with an explicit rollback or error state
Do not let each entrypoint maintain its own optimistic copy.
对于乐观UI或CLI更新:
- 保留单一变更路径
- 使用请求ID或先前快照记录待处理状态
- 根据权威结果进行协调
- 通过显式回滚或错误状态处理失败
不要让每个入口点维护各自的乐观副本。
Missed-bug coverage
遗漏Bug的覆盖
When a user says tests missed a bug, add or adjust behavior-level coverage around the exact repro path before claiming the fix is complete.
当用户反馈测试遗漏了某个bug时,在宣称修复完成前,针对确切的复现路径添加或调整行为层面的测试覆盖。