docs: revise ADR 0001, risks, and architecture for accuracy
- ADR 0001: distinguish payment/OTP (sync by design) from notifications (fire-and-forget); correct misleading claim that notification failures surface to clients — they are silently absorbed as FAILED status - risks.md: upgrade USERNAME_FIELD entry with concrete breakage (admin, create_superuser, JWT lookup); add booking overlap race condition with root cause and fix (select_for_update) - architecture.md: document notification/OTP provider coupling as an MVP shortcut and note the Phase 2 fix (dedicated NotificationProvider) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,12 +16,17 @@ For the MVP, OTP sends, booking notifications, and payment gateway calls run syn
|
||||
|
||||
- Faster initial delivery with fewer moving parts.
|
||||
- Increased latency risk on endpoints that call external providers.
|
||||
- Failures are immediately visible to clients and logged for support.
|
||||
- Payment and OTP failures are surfaced to clients immediately (correct behaviour — clients need to know).
|
||||
- Notification failures are absorbed: `notifications/services.py` catches provider errors, stores them as `FAILED` status, and never surfaces them to the client. A failed booking SMS does not cause the booking request to fail. This means notification failures require active monitoring rather than appearing in client-facing error rates.
|
||||
|
||||
## Alternatives Considered
|
||||
|
||||
- Celery + Redis for all external calls: rejected for MVP due to infra overhead.
|
||||
- Hybrid async for notifications only: rejected to keep the execution model consistent.
|
||||
- Hybrid async for notifications only: not wrong in principle, deferred for operational simplicity. The three call types have genuinely different semantics:
|
||||
- **Payment creation**: synchronous by design — the client needs the Moyasar redirect URL before the response returns.
|
||||
- **OTP sends**: synchronous by design — users expect immediate confirmation that the code was sent.
|
||||
- **Booking notifications**: fire-and-forget by nature — the booking is already committed and the client does not wait for delivery confirmation.
|
||||
When notification latency becomes a problem (e.g. under load or with slow SMS providers), only notifications need to move off the request path. Payments and OTP sends should remain synchronous regardless.
|
||||
|
||||
## Related
|
||||
|
||||
|
||||
Reference in New Issue
Block a user