From cb25f1331518ee33196a410f167dafe244388c89 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 20 Oct 2026 14:19:27 +0000 Subject: [PATCH] fix(alerts): widen the moved-while-parked margin to 1.5 km A parked car's GPS fix strayed 0.7 km off its spot and set off the moved-while-parked warning. 300 m was too tight a margin for a fix from a garage, a multi-storey or between tall buildings; a tow or a ferry still takes the car well past 1.5 km. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DLTcMx62JokM16L66SSM5i --- README.md | 2 +- .../PushNotificationCheckServiceTests.cs | 12 ++++++++++++ .../Services/PushNotificationCheckService.cs | 6 ++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1d18b744..d38e4e2d 100644 --- a/README.md +++ b/README.md @@ -363,7 +363,7 @@ GarageStack checks your vehicle's state every 5 minutes and sends both a browser | Car left unlocked | `doors/locked = false` while engine is off | | Door left open | Any door, boot, or bonnet open while engine is off | | Window left open | Any window open while engine is off | -| Moved while parked | The car reports a position more than 300 m from where it parked, with the engine off: towed, lifted onto a truck, or taken on a ferry. Sent once per parking, with the car's first report after the move (a sleeping car only reports now and then) | +| Moved while parked | The car reports a position more than 1.5 km from where it parked, with the engine off: towed, lifted onto a truck, or taken on a ferry. Sent once per parking, with the car's first report after the move (a sleeping car only reports now and then) | | Arrived home or at work | The car parks at a home or work place with **Notify on arrival and departure** switched on (Trip log > Home and work), judged by the position of the poll it parked in. Not sent for a drive that never left the place it started in | | Left home or work | The car drives out of such a place: sent on its first position outside the place's radius, so starting the engine to warm the car up sends nothing | | Charging complete | Charging stops while the cable is still connected (plug-in vehicles) | diff --git a/src/GarageStack.Tests/PushNotificationCheckServiceTests.cs b/src/GarageStack.Tests/PushNotificationCheckServiceTests.cs index 0974b370..f4d474d1 100644 --- a/src/GarageStack.Tests/PushNotificationCheckServiceTests.cs +++ b/src/GarageStack.Tests/PushNotificationCheckServiceTests.cs @@ -695,6 +695,18 @@ public void CheckMovedWhileParked_GpsWanderingNearby_StaysQuiet() Assert.Empty(alerts); } + // A fix that strayed further still, as one from under a roof can: 0,7 km. + [Fact] + public void CheckMovedWhileParked_GpsStrayingUnderAKilometre_StaysQuiet() + { + var alerts = new List<(string, string, string)>(); + + CreateService().CheckMovedWhileParked( + ParkedInAmsterdam(), Parked(s => { s.Latitude = 52.3763; s.Longitude = 4.8900; }), alerts); + + Assert.Empty(alerts); + } + [Fact] public void CheckMovedWhileParked_NoParkedPositionOrNoFix_StaysQuiet() { diff --git a/src/GarageStack.Worker/Services/PushNotificationCheckService.cs b/src/GarageStack.Worker/Services/PushNotificationCheckService.cs index a78f0235..cd332c70 100644 --- a/src/GarageStack.Worker/Services/PushNotificationCheckService.cs +++ b/src/GarageStack.Worker/Services/PushNotificationCheckService.cs @@ -145,8 +145,10 @@ internal async Task CheckParkedAsync( await SendAsync(vehicle, moved, notifications, ct, onceSince: vehicle.LastParkedAt); } - // Further than GPS wanders in a car park or a garage, nearer than a tow truck takes a car. - internal const double MovedWhileParkedMeters = 300; + // Further than a parked car's fix strays, nearer than a tow truck or a ferry takes it. A fix + // from a garage, a multi-storey or between tall buildings has put a car standing still 700 m + // off its spot, so the margin is wide. + internal const double MovedWhileParkedMeters = 1500; /// /// Warns when the car reports a position well away from where it parked while the engine stayed