← Back to Pull requests

fix(android): close the remaining End Locally gaps from #149 #154

Closed
unknown closed this pull request without merging on Oct 15, 2026 18:23 UTC
View on GitHub
unknown unknown commented on Oct 13, 2026 12:28 UTC
Author

Part of #149

Fixes the three Android gaps left after #148, one commit each. iOS endLocally is not in this PR; it stays open on #149.

What I changed:

  • Retry on the end dialog now treats a 404 as already ended, the same rule the leftover end uses, through one sendEnd helper. Before, a Retry after a lost reply kept failing and pushed the driver to End Locally for a trip that was already closed.

  • When the leftover end fails, the start now fails with its own message: "Your previous trip could not be ended yet. Check your connection and try again." The generic "Could not start the trip." didn't tell the driver it was the previous trip that was stuck.

  • The pending end now stores the driver who ended it, read from the sub of the signed-in JWT, and only that driver's start sends it. Before, if another driver signed in on the same phone, their start sent the end, got a 404 for the user mismatch, and cleared the key, leaving the first driver's trip open for good.
  • Why it works this way:

  • The driver id comes from the token the app already stores, so sign-in and stored sessions don't change. The signature isn't checked on the phone; this only decides whose trip a stored id is, and the server still checks the user on /trips/end.

  • Another driver's pending end is left alone rather than cleared, and doesn't block their own start. It goes out the next time its driver starts a trip on this phone.

  • A pending end saved by #148's build has no driver, so it is still sent under whoever signs in, as before. Otherwise a driver mid-upgrade could be stuck.

  • The leftover end returns its own Result because the start's catch maps everything through mapHttpError, which would turn the new error into Other.
  • Tested: unit tests for each item, and each new test fails with its part of the fix reverted (10 mutations in all). assembleDebug builds. No emulator run, since sign-in didn't change.

    Diff: 239 lines (+179 / -60) across 2 files Reviewer: aaronbrethorst Review duration: 3234m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 239 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.328
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #154"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.7% · Safe to merge
    14.7%