production

This commit is contained in:
2026-08-28 11:13:15 +05:30
parent d7348e253f
commit 5723d373b2
162 changed files with 17924 additions and 7026 deletions

View File

@@ -7,19 +7,22 @@ import 'package:miler/controllers/pickups_controller.dart';
///
/// [kGeofenceEnforced] decides whether "Picked up" means the rider was standing
/// at the door or merely pressed a button, and it has already been wrong in
/// both directions: it was `kDebugMode` — so every debug build had no fence and
/// the fence was therefore never tested — and then a hard `false`, so the flow
/// could not be walked at a desk at all.
/// three directions: it was `kDebugMode` — so every debug build had no fence
/// and the fence was therefore never tested — then a hard `false`, so the flow
/// could not be walked at a desk at all, then a define defaulting to off.
///
/// **It is currently OFF**, decided on 2026-08-19 because the fence was
/// refusing real work: riders pressing *Picked up* at a counter were told they
/// were kilometres away, most often because the booking's own coordinates were
/// wrong rather than the rider. See the declaration for the full reasoning and
/// for how to restore it.
/// **It is OFF, decided 2026-08-25.** It was turned on that morning with a
/// radius of [kGeofenceRadiusMeters] and turned off again the same day, at the
/// founder's call. Nothing was found wrong with it — this is a decision about
/// *when* to switch it on.
///
/// So this file no longer guards a direction. It guards the two properties that
/// made the old defaults dangerous: that the state is *deliberate*, and that
/// every gate reads the same switch.
/// So the direction this file guards has flipped twice in a day, which is
/// exactly the pattern that made the old defaults dangerous, and it is why the
/// three tests below are not all about the direction. The measurement work is
/// unchanged and still asserted: a `best` fix with a shelf life, the phone's
/// error credited to the rider, and one radius rather than three. All of it is
/// dormant while [kGeofenceEnforced] is false and none of it needs revisiting
/// on the day it goes back on.
void main() {
test('there is one switch, and the legacy name derives from it', () {
// Two constants that could disagree is exactly how a build ends up with
@@ -33,8 +36,8 @@ void main() {
// If this fails, one of two things happened, and both should be read rather
// than silenced:
//
// • the default was changed back to enforced — which is the intended
// end state, so update this test with the date and the reason; or
// • the default was turned back on — record the date and the reason here,
// as the previous flips did; or
// • this run passed `--dart-define=ENFORCE_GEOFENCE=true`, in which case
// the failure is correct and is telling you this build has the fence on.
expect(
@@ -46,4 +49,19 @@ void main() {
'--dart-define=ENFORCE_GEOFENCE=true.',
);
});
test('the radius is one number, and it is the tight one', () {
// Asserted while the fence is off, deliberately. The app used to hold
// three — a configured `pickupradius` defaulting to 100 in the controller,
// a hardcoded 500 in Home's bulk gate, and no agreement between them — so
// which fence a rider met depended on whether he ticked boxes or slid a
// sheet. Whichever way the switch above is set, that must not come back.
expect(kGeofenceRadiusMeters, 10);
});
test('a cached fix has a shelf life', () {
// On a round, a stale position is reliably the *previous* stop. Anything
// much longer than this and the fence starts measuring from the last door.
expect(kGeofenceFixMaxAge, const Duration(seconds: 30));
});
}