Idempotent Processing Of At-Least-Once Mailbox Change Notifications
Last updated: November 29, 2026
Quick Overview
Mailbox providers deliver message-created notifications at least once and sometimes retry the same notification minutes later. Write a component that guarantees each (tenant, message, change type) is handled once within a time window, using bounded memory, and that does not lose a notification whose handler failed.
Abnormal Security
November 29, 20260
0
0 solved
Mailbox providers deliver message-created notifications at least once and sometimes retry the same notification minutes later. Write a component that guarantees each (tenant, message, change type) is handled once within a time window, using bounded memory, and that does not lose a notification whose handler failed.
Abnormal ingests mail through Microsoft 365 and Google Workspace APIs rather than sitting in the mail flow, so duplicate and retried notifications are an everyday reality. The interviewer checks whether you understand at-least-once semantics, pick a sensible idempotency key, bound memory, and avoid the classic bug of marking work done before it succeeds.
What the Interviewer Expects
- Chooses an idempotency key that includes tenant and change type
- Bounds memory with both TTL and max size
- Evicts in insertion order with an OrderedDict or equivalent
- Removes the key when the handler fails so the retry is processed
- Makes time injectable for testing
- Explains how this moves to a shared store across many workers
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- Many workers process notifications in parallel. How do you dedupe across them?
- What happens if the process crashes after the handler succeeds but before anything is persisted?
- How do you choose the TTL relative to the provider's retry behavior?
- Why is making the remediation action itself idempotent still necessary?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Duplicates of the same notification must be dropped for ttl_seconds. Memory must stay under max_keys. If the handler throws, the next delivery of that notification must run again. Different change...
High-Level Design
An OrderedDict keyed by (tenant_id, message_id, change_type) stores first-seen time in insertion order, so the oldest key is always at the front. Each call first evicts expired or overflow keys fr...
Submit Your Answer
Abnormal Security Software Engineer Interview Guide
Interview process, tips, and preparation timeline