docs: use the run ID as the idempotency key for external services - #4953
Conversation
The run ID is stable across every attempt of a run, so it is the natural key to hand to a payment provider when the task has no business ID to use. The refund example now keys Stripe on ctx.run.id and notes when a payload ID is the better choice.
|
WalkthroughThe refund documentation now uses Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to The example can lead users to rely on provider-side keys for long-lived refund deduplication, risking duplicate refunds after the retention window. Document the limit and durable-state alternative before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkResolution Add the required template sections. Include the issue reference, complete the checklist, describe testing or state that no code testing was required, add a short changelog entry, and provide screenshots or state that they are not applicable.
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 2c39028b-6b01-4be1-871a-76896fecdd50
📒 Files selected for processing (1)
docs/idempotency.mdx
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (1)
MDX documentation pages must include frontmatter with title (required), description (required), and sidebarTitle (optional) in YAML format Use Mintlify components for structured content: , , , , ,
📄 CodeRabbit inference engine (docs/CLAUDE.md)
Files:
docs/idempotency.mdx
docs/idempotency.mdx
Summary
Follow-up to #4952. The new "Side effects inside
run()" section told readers to derive the provider's idempotency key from a payload ID, but the more general answer is the run ID:ctx.run.idis stable across every attempt of a run, is always available, and is the same value the defaultrunscope already mixes into a Trigger.dev idempotency key.The Stripe refund example now keys the provider call on
ctx.run.id, and a short paragraph explains when a business ID from the payload is the better choice (when the same task can be triggered more than once for the same order and you want deduplication across separate runs).Docs only.