test(repository): 救回 dropoff 座標測試(清理殘留分支時撈到的未合併內容) - #50
Merged
Conversation
清理殘留分支時發現 `claude/determined-shannon-17f4ac`(從未開過 PR)帶了一份 `ride_dropoff_integration_test.go`,內容從未進 main。原檔測的 `GetDropoffCoords` 在 main 已不存在,故改寫成對現有 API(Create → GetByID)的等價覆蓋。 兩案的價值不同: - 正向 round-trip:service 層 ride_create_customer_test 已間接覆蓋,此處補 repository 層直接覆蓋——Create 有/無 dropoff 是兩條不同的 SQL,走錯會被上層邏輯掩蓋。 - **未指定目的地 → DropoffPoint 必須是 nil**:main 完全沒有這條。這守的是踩過的 GeoPoint.Scan 坑(NULL 被當成掃描成功而留下零值座標,導航與計費會把 (0,0) 當真目的地且不報錯)。正向案例校準了同一條取值路徑,故此負向斷言不會永遠 PASS。 驗證:真 PostGIS(testcontainers)實跑 2/2 PASS;gofmt/go vet 乾淨。 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
在做 fleet-app TODO 的維護項「清開發殘留 worktree 與舊分支」時,刪之前逐條驗證每條本地分支的內容是否真的在 main。三個 repo 共 72 條本地分支中,只有 4 條不是「PR 已合併且本地 tip = 合併時 tip」,其中
claude/determined-shannon-17f4ac(從未開過 PR)帶著一份 main 沒有的internal/repository/ride_dropoff_integration_test.go。改了什麼
原檔測的
RideRepository.GetDropoffCoords在 main 已不存在,所以不是原樣還原,而是改寫成對現有 API(Create→GetByID)的等價覆蓋:ride_create_customer_test(service 層)已間接覆蓋;此處補 repository 層直接覆蓋——Create對「有/無 dropoff」是兩條不同的 SQL,走錯會被上層邏輯掩蓋。DropoffPoint必須是 nil:main 完全沒有這條。守的是踩過的GeoPoint.Scan坑——NULL 被當成掃描成功而留下(0, 0),導航與計費會把幾內亞灣外海當成真目的地,而且不會有任何錯誤。驗證
go test ./internal/repository/ -run TestRideDropoff -v→ 2/2 PASS(47s)。gofmt -l無輸出、go vet ./internal/repository/乾淨。GetByID → DropoffPoint取值路徑,有值時確實非 nil,路徑已被校準。另外驗過但不需要救回的三條
claude/driver-phone-profile(dispatch,PR #42 CLOSED)internal/service/driver_phone_test.go的每一條都已被 main 的handler/driver_profile_test.go(真 DB)覆蓋,含「改電話不重置 O5 審核」。且「空字串=清除電話」語意在 main 已改成 400 拒絕,原測拿到 main 會 FAIL——屬已被取代。claude/todo-review-priority-54ffe7(app,PR #40 CLOSED)tool/watch_driver_location.sh已由 app PR #48 救回,功能碼由 app PR #41 落地。claude/project-planning-docs-803c8e(app,PR #37 CLOSED)🤖 Generated with Claude Code