idempotent-redundancy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIdempotent Redundancy
幂等冗余
When adding redundant paths (fallbacks, belt-and-suspenders), make them idempotent.
在添加冗余路径(降级方案、双重保障)时,需确保它们具备幂等性。
Pattern
模式
Redundancy without idempotency causes loops, churn, or data corruption.
不具备幂等性的冗余会导致循环、资源消耗或数据损坏。
DO
建议做法
- Use for Braintrust updates
_is_merge: true - Check if value exists before writing (fallback only if missing)
- Use atomic write/rename for file operations
- Make reconciliation steps safe to run repeatedly
- 在Braintrust更新中使用
_is_merge: true - 写入前检查值是否存在(仅当值缺失时使用降级方案)
- 文件操作使用原子写入/重命名
- 确保对账步骤可安全重复执行
DON'T
禁止做法
- Write unconditionally in fallback paths
- Allow multiple writers to overwrite each other
- Fire "repair" actions that can trigger more repairs
- 在降级路径中无条件写入
- 允许多个写入者互相覆盖
- 触发可能引发更多修复操作的“修复”动作
Source Sessions
来源会话
- a541f08a: "Redundancy is good only if idempotent"
- 1c21e6c8: "Belt-and-suspenders, but make it idempotent"
- 6a9f2d7a: "Idempotent repair hooks"
- a541f08a: "只有具备幂等性的冗余才是有效的"
- 1c21e6c8: "双重保障,但要确保幂等性"
- 6a9f2d7a: "幂等修复钩子"