Complete the server trip when the operator discards it locally - #725
Complete the server trip when the operator discards it locally#725patrickrb wants to merge 2 commits into
Conversation
Discard local trip was local-only: it dropped the queue and forgot the trip, but a row already created on roadsontheair.com stayed active forever — the site called the rover live for a day (the heard-from window) and badged the trip active after that, and with the app's local state gone no client could ever complete it. Exactly this stranded K1AF 2026-08-03 in production. abandonTrip now snapshots the trip id and credentials before clearTrip wipes them and fires one best-effort completeTrip. Fire-and-forget is deliberate: the button also serves the broken cases (bad key, deleted trip) where the call fails and the row was unreachable anyway. A trip still pending creation, or an install with no key, skips the doomed attempt — shouldCompleteAbandonedTrip covers the decision. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #725 +/- ##
============================================
- Coverage 35.91% 35.90% -0.02%
Complexity 289 289
============================================
Files 248 248
Lines 30419 30433 +14
Branches 4018 4023 +5
============================================
+ Hits 10926 10927 +1
- Misses 19142 19155 +13
Partials 351 351
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Not ready to approve
There’s a correctness issue in shouldCompleteAbandonedTrip (whitespace trip IDs) and the updated discard description string appears to be unused, so the UI text change likely won’t take effect.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR addresses a production issue where “Discard local trip” cleared local state but left an already-created trip row on roadsontheair.com stuck as active indefinitely by adding a best-effort server-side completion attempt during local discard.
Changes:
- Snapshot trip identity/config before
clearTrip(), then fire a one-shotcompleteTripcall after local teardown inabandonTrip(). - Add
shouldCompleteAbandonedTrip(pure helper) plus a new unit test to gate when the best-effort completion should run. - Update the “Discard local trip” description string to say it ends the trip on the server.
File summaries
| File | Description |
|---|---|
| ft8af/app/src/main/kotlin/radio/ks3ckc/ft8af/rota/RotaTripManager.kt | Snapshots trip settings before clearing local state and conditionally triggers a best-effort server completion; adds shouldCompleteAbandonedTrip. |
| ft8af/app/src/test/kotlin/radio/ks3ckc/ft8af/rota/RotaAbandonTest.kt | Adds unit coverage for the abandon eligibility decision logic. |
| ft8af/app/src/main/res/values/strings_compose.xml | Updates the discard-trip description text to mention server-side ending. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
A whitespace-only trip id now counts as no id (isNotBlank, matching the key check), and rota_abandon_desc — which was defined but rendered nowhere — is wired up as a caption under the active-trip buttons, since Discard destroying undelivered data deserves saying before the tap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Discard local trip dropped the phone's queue and forgot the trip, but never touched the server — so a trip row already created on roadsontheair.com stayed
activeforever. The site (correctly, per its heard-from-recently rule) called the rover Live for 24 hours and badged the trip active indefinitely after that, and with the app's local state gone there was no client left that could complete it. This strandedK1AF 2026-08-03in production last night.abandonTripnow snapshots the trip id, base URL and API key beforeclearTrip()wipes them, finishes the local teardown exactly as before, then fires one best-effortcompleteTrip:tripPendingCompletepath, not here.shouldCompleteAbandonedTrip(pure, tested) skips the doomed attempt when the trip was never created server-side or no API key is stored.Companion site PR (patrickrb/road-trips-on-the-air-site#30) adds an owner-facing "End this trip" on the trip page for rows already stranded.
Testing
New
RotaAbandonTestcovers the eligibility decision. FulltestDebugUnitTestpasses.ktlintCheck/detektremain red on cleandevin untouched files (Wsjtx*, DebugInject.kt) — no new issues from this change (verified against the reports).🤖 Generated with Claude Code