Skip to main content

Practice

Authentication, retries and idempotency: agree them before integration

An interface that returns data is not ready for production. Trust boundaries, retry rules and duplicate handling belong in the interface list.

English summary. The full article is published in Chinese.

Agree the trust boundary

Signatures or static tokens for internal systems, OAuth or expiring tokens for external ones. Write down how keys are issued and rotated, the allowed clock skew, which fields are signed and what happens when a token expires.

Retry only what is retryable

Timeouts, dropped connections and 5xx responses may be retried; validation and authentication failures will fail the same way every time. Specify which codes are retryable, the backoff and maximum attempts, and whether the caller or the platform is responsible, so both sides do not retry at once.

Idempotency and reconciliation

Use a business-derived idempotency key with a unique index or deduplication table, rather than checking then inserting under concurrency. Add a reconciliation job that compares both sides and surfaces one-sided records before a user reports them.

Read the full article in Chinese

Have a question about this note?

Send the scenario you are working on and we will respond with a concrete view.