返回顶部
i

idempotency

Deep idempotency workflow—identifying retry surfaces, idempotency keys, storage and TTL, exactly-once pitfalls, and testing duplicate delivery. Use when designing safe APIs, workers, and payment flows under at-least-once delivery.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
86
下载量
0
收藏
概述
安装方式
版本历史

idempotency

# Idempotency (Deep Workflow) Most distributed systems deliver work **at least once**. Idempotency makes **duplicate processing safe**—critical for payments, inventory, and message consumers. ## When to Offer This Workflow **Trigger conditions:** - Retries on HTTP, queues, or background jobs - Double charges, duplicate records, or “at-least-once” confusion - Product asks for “exactly-once” semantics **Initial offer:** Use **six stages**: (1) identify side effects, (2) choose keys, (3) storage & scope, (4) API patterns, (5) worker patterns, (6) testing). Confirm storage (Redis, SQL) and retention window. --- ## Stage 1: Identify Side Effects **Goal:** Classify operations: reads vs creates vs monetary transfers vs state transitions. **Exit condition:** List of mutations that must be idempotent under retries. --- ## Stage 2: Choose Keys **Goal:** Client-supplied `Idempotency-Key` header (Stripe-style) vs deterministic hash of normalized payload—trade UX vs collision risk. --- ## Stage 3: Storage & Scope **Goal:** Store key → outcome or result reference with TTL covering retry window; scope keys per tenant/user when needed. --- ## Stage 4: API Patterns **Goal:** Same key + same body → same outcome; reject or conflict if same key with different body. --- ## Stage 5: Worker Patterns **Goal:** Natural unique constraints in DB; dedupe table keyed by `event_id` or business idempotency key for consumers. --- ## Stage 6: Testing **Goal:** Chaos or integration tests that deliver duplicate messages; property tests for key behavior. --- ## Final Review Checklist - [ ] Mutating paths classified - [ ] Key strategy and scope documented - [ ] Storage, TTL, conflict rules defined - [ ] HTTP and async consumers aligned - [ ] Duplicate delivery tests ## Tips for Effective Guidance - True exactly-once end-to-end is rare—design for at-least-once + idempotent effects. - Pair with **message-queues** and **rest-best-practices** for HTTP idempotency keys. ## Handling Deviations - Financial flows: require stronger audit and longer key retention.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 idempotency-1776028691 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 idempotency-1776028691 技能

通过命令行安装

skillhub install idempotency-1776028691

下载 Zip 包

⬇ 下载 idempotency v1.0.0

文件大小: 1.78 KB | 发布时间: 2026-4-13 10:37

v1.0.0 最新 2026-4-13 10:37
- Initial release of the idempotency skill with a comprehensive, step-by-step workflow.
- Guides users through six practical stages: identifying side effects, choosing idempotency keys, configuring storage and TTL, defining API/worker patterns, and testing for duplicate delivery.
- Includes actionable triggers, review checklists, and practical tips to design robust, idempotent APIs and workflows.
- Tailored for safe operations under at-least-once delivery, with special considerations for high-stakes scenarios like payments.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部