feat: checkout retry + idempotency key (v14)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start with backend/bin/server.dart and the checkout cubit and service tests described in the issue. Reproduce the lost-response case with the fake service and FlightServer().handler, then trace how checkout sends requests and records orders. Done when retries with the same key replay the original booking reference, cart changes produce a new key, and the listed cubit, service, and backend tests pass.
Written by the indexing model from the issue text.
Description
Problem
Checkout'ta ağ koparsa sunucu siparişi oluşturur ama istemci hata görür. Kullanıcı retry'a basınca ikinci sipariş yaratılır (çift rezervasyon). Bugün backend/bin/server.dart siparişi 1 sn'lik delay'den önce kaydediyor ve idempotency desteği yok.
Hedef (v14: Checkout retry + idempotency key)
Aynı ödeme niyeti kaç kez denenirse denensin tek sipariş oluşsun.
Kapsam (IN)
- Önce repro: başarısız cubit testi (fake servis: ilk çağrı hata, ikinci başarı) + in-process backend testi (
FlightServer().handler) ile 2 sipariş gösterimi. Demo için backend'deX-Simulate-Drop: after-commitanahtarı. Uygulama koduna debug header eklenmez, sunucu tarafında env var / flag /POST /debug/drop-nextile açılır. - Key, uygulama genelindeki
CartCubitiçinde tutulur.CartStateEquatable olduğu için lazy set emit'te düşer, bu yüzden state dışında private alan +String ensureCheckoutKey().add/removeAt/restore/clearile sıfırlanır.Random.secure()ile 128-bit hex,uuidpaketi yok. -
IProductNetworkManager.sendRequestiçinMap<String, String>? headers(Options(headers:)).IFlightService.checkoutiçinidempotencyKey→Idempotency-Keyheader'ı. - Backend: key → orderId haritası
orders.addanında yazılır (delay'den önce), tekrarda 200 +Idempotent-Replayed: trueve ilkbookingReference. Sadece commit edilmiş siparişler saklanır. CORSallowHeadersiçineIdempotency-Key. - Testler: cubit (error→retry aynı key; ikinci
CartCheckoutCubitaynıCartCubitile aynı key; başarı veya sepet değişiminde yeni key; replay aynı referansı gösterir;clear()yalnızca onaylı başarıdan sonra), servis unit testi (fake network manager header'ı yakalar), backend (aynı key iki kez = 1 sipariş). -
docs/video/v14_*.md(v12 stilinde) + README satırı.
Kapsam dışı
Otomatik retry/backoff (sonraki bölümün teaser'ı), 409 in-flight, key'i ICacheManager ile kalıcı yapma (bilinen sınırlama, sepet de bellekte), TTL, 422 body-mismatch testi (tek cümle anlatılır).
- Dominant language
- Dart
- Stars
- 32
- Forks
- 5
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from VB10/flight_booking
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
VB10/flight_booking#18 · 1 comment ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
VB10/flight_booking#17 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
VB10/flight_booking#14 ·
All issues in VB10/flight_booking
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
JGeek00/adguard-home-manager#189 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
macos needs testing
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
awais-amjed/rift#15 ·
-
android area: player bug issue
Difficulty 2/5 1-3 hours Newbie friendliness 67/100