Repository navigation
docs(app): 回填救回三項的模擬器實跑閉環(兩項通過、心跳這層驗不到) - #68
Merged
Merged
Conversation
司機端跨裝置停靠點同步:API 標記到達後手機未觸碰,5 秒內下一站自動前移、地圖重畫。 乘客端建單 409 接手:畫面直接切到配對中;ride_events 只有兩筆 ride.requested (都是 curl 建的)=App 那次按下沒有產生新訂單,交叉證明走的是接手路徑。 WS 心跳:客戶端 ping 在後端沒有可觀察痕跡,維持單元測試層證據並寫明原因。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
thothawei
added a commit
that referenced
this pull request
Jul 30, 2026
第十七輪把逾時對帳整族清完時,唯一剩下的就是聊天送出,並刻意沒做: 訊息在後端沒有唯一狀態,「同內容再送一次」本來就合法,所以 App 無法只靠 afterId 補讀分辨「上一次其實送出了」與「使用者真的想再說一次」。 這一輪把那個跨端決策做掉——後端收客戶端產生的冪等鍵(dispatch #68)。 App 端: - RideMessage 多 clientMsgId;兩端 sendMessage 多具名參數 clientMsgId, 用 null-aware element 帶欄位(沒帶鍵時請求形狀不變)。 - ride_chat_screen:這一則的鍵在第一次送出時產生,**失敗時留著**——重試沿用 同一個鍵才不會在後端變成兩則;確認落地才清掉,下一則拿新的鍵。 - 逾時(statusCode == null)→ 補讀 afterId 之後的訊息並用鍵比對:找到=其實 送出了(泡泡出現、輸入框清空、不報錯);找不到留著錯誤與內容讓他重試。 補讀到的其他訊息(對方同時說的話)一併顯示。明確拒絕(有狀態碼)不對帳。 驗收:flutter analyze 無 issue、flutter test 361 passed(356 +新 5); 反向確認兩層——關掉補讀對帳 → 2 案 FAIL、重試不沿用同一個鍵 → 1 案 FAIL。 模擬器實跑(blackhole messages + ws_block、WS 全程被擋):代理 log 上游回 200 不交還 App → 逾時後出現對帳那次 GET messages → 綠色泡泡出現、輸入框清空、 沒有錯誤橫幅;DB 只有一則,client_msg_id = customer-1785385960604-0。 真後端 curl 另驗:同鍵重送回既有那筆(連 created_at 都是原本的)、DB 沒新增; 不同鍵的同內容仍是兩則。 需要後端 dispatch #68 一起上(dev DB 已跑 migration 24)。 Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
thothawei
added a commit
that referenced
this pull request
Jul 31, 2026
1. 造大量測試行程改用 tool/seed_customer_rides.sh:叫車限流(5 次/分)、 「已有進行中訂單」、建單回應是 ride_id 不是 id——三個都不會讓迴圈停下來, 自己寫 for 迴圈會整批靜默失敗還印得像成功。腳本建單失敗直接 exit 1 並印回應。 已用 seed_customer_rides.sh 3 實跑驗過(ride #66-#68,全部已取消)。 2. 本機後端跑法更正為 REDIS_ADDR=127.0.0.1:6380:6379 會靜默連到 Mac 本機的 redis-server(已用 raw socket 對兩台寫 whoami 鍵驗死)。容器改發布 6380 見 dispatch PR #72。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
為什麼
PR #66 合併時誠實標記了「這三項都沒有模擬器實跑」。同日補跑,把該閉環的閉掉、驗不到的說清楚。
環境:
m6_pixel雙 flavor(driver/customer debug APK 由本次 maince46879建出)+ dispatch docker compose 三服務。✅ 司機端跨裝置停靠點同步(救自 #61 + dispatch#53)
司機
sim29drv(driver 10)登入 → 上線(Redisdrivers:geo含 10、driver:10:loc存在=真的在派單池)→ 乘客以 API 建 2 乘客 4 站的 ride #16 → 全螢幕接單卡(帶「多乘客行程(4 站)」chip)→ 接單 → 行程卡列出全程、下一站「1. 乘客 A上車」帶操作鈕。接著用 API 標記 stop 7 到達(=第二台裝置/LINE 路徑),手機全程未觸碰:
POST /api/rides/16/stops/7/arrive→{"ok":true}修正前這台會永遠停在第 1 站(#61 當時實測 8 分鐘沒動)。
✅ 乘客端建單 409 接手(救自 #60)
乘客
sim29cust(customer 9)登入、畫面上沒有任何進行中訂單(此時 App 也不輪詢)→ 以 API 建 ride #17(=另一台裝置/LINE)→ 立刻在 App 按「叫車」 → 後端回 409 → 畫面直接切到「正在為您配對司機」,不是錯誤 SnackBar。交叉驗證(決定性):
ride_events裡 customer 9 的ride.requested只有兩筆(feat(auth): 登入後即拉未結案協尋清單(乘客 banner/司機角標免下拉) #16、feat(map): 地圖引擎改用 flutter_map + OpenStreetMap(完全免 API key) #17,都是 curl 建的)——App 那次按下沒有產生任何新訂單。GET /customer/rides回[(17,1),(16,9)],沒有第三張單。pickup_address是「API建的上車點」,不是 App 表單裡的值 → 畫面上的行程來自後端。ride.assigned在_activeRide == null時會早退。客戶端 ping 由 dart:io 直接送控制幀,gorilla 的預設 PingHandler 自動回 pong 但不寫 log,後端也沒有可觀察的計數器——要證明只能封包擷取。維持單元測試層的證據(在真 socket 上斷言
pingInterval從null變成 20 秒);半開連線的實機重現需要斷網卡層級的手法。純文件,不動任何程式碼。
🤖 Generated with Claude Code