Repository navigation
fix(dispatch): 司機放棄訂單時也通知 App 乘客(先前只推 LINE) - #52
Merged
Merged
Conversation
跨端契約對帳(2026-07-28,真實服務 + WS 監聽)抓到:CancelByDriver 寫好了給乘客的 文案「司機取消了行程,正在為您重新派車」,但**只走 line.PushText**, 對 App 乘客一則 WS 事件都沒有——實測乘客端在司機放棄後收到零事件。 後果:App 乘客的司機卡片停在畫面上(含車牌與撥號按鈕),直到最多 15 秒後的輪詢 才無聲退回「配對中」。期間乘客可能打給一個已經不來的司機。 形狀與 O7 電話那次一樣:功能看起來做完了,實際在 App 這條路上一次都沒運作過。 補送 events.TypeRideRedispatched(這個型別本來就定義了,先前只用於 audit)。 **刻意不用 ride.cancelled**——行程並沒有取消,只是回到派單中; 送 cancelled 會讓 App 顯示「行程已取消」並清掉整筆訂單,比沒通知更糟。 驗收:新增 service 測試(真 PostGIS)驗證乘客收到 redispatched、不收到 cancelled、 訂單回 Requested、司機回待命;**反向驗證**拿掉 publish 後該測試 FAIL。 真實服務端到端:修前乘客 WS 零事件,修後序列為 [ride.accepted, ride.redispatched]。 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.
怎麼找到的
跨端契約對帳:起真實服務,用 WS 監聽同時接上司機與乘客,跑完整鏈路把後端實際送出的 payload 抓下來對 App 的解析。
大部分契約是乾淨的(事件型別無漏接、停靠點鍵完全對齊、
cancel_reason的 code 兩端一致、App 對巢狀pickup_point與扁平pickup_lat都有解析)。抓到的是這一個。Bug
CancelByDriver寫好了給乘客的文案「司機取消了行程,正在為您重新派車」,但只走line.PushText——對 App 乘客沒有任何 WS 發佈。實測:司機放棄 ride 2 時,乘客端的 WS 監聽收到零事件。
後果:App 乘客的司機卡片停在畫面上(含車牌與撥號按鈕),直到最多 15 秒後的輪詢才無聲退回「配對中」。期間乘客可能打給一個已經不來的司機。形狀與 O7 電話那次一樣——功能看起來做完了,但在 App 這條路上一次都沒運作過。
修法
補送
events.TypeRideRedispatched。這個型別本來就定義好了,先前只用在 audit 記錄。刻意不用
ride.cancelled:行程並沒有取消,只是回到派單中。送 cancelled 會讓 App 顯示「行程已取消」並清掉整筆訂單,比沒通知更糟——測試裡有一條斷言專門守這件事。驗收
ride.redispatched、不收到ride.cancelled、訂單回Requested、司機回Idle乘客沒收到 ride.redispatched 事件;實際發佈:[]),還原後 PASS[ride.accepted, ride.redispatched]go build ./...、gofmt乾淨App 端接住這個事件的 PR:fleet-app#53
🤖 Generated with Claude Code