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

@@ -121,12 +121,40 @@ extension ConsignmentStateX on ConsignmentState {
/// Still inside the hub's half of the network. **This is the case the
/// "not released yet" guard is for** — a logistics consignment sitting at a
/// hub genuinely cannot be delivered by this rider, and must stay blocked.
///
/// ── `Created` is not one of these, and treating it as one stranded riders ──
///
/// It was listed here, and it is the wrong half of the network. The backend's
/// own contract for the pivot is:
///
/// ```
/// hyperlocal pickup-complete → Out_for_Delivery (compatibility mode)
/// → Collected_By_Miler (flag on)
/// hub-routed pickup-complete → Created + next_action: inward_at_hub
/// ```
///
/// So `Created` means *the consignment exists and nothing has happened to it
/// yet* — the parcel is *in the rider's own hands*, waiting either on his
/// release or on him carrying it to the hub. The hub has never seen it. The
/// rider slid **Start ride**, and the app answered "This parcel is with the
/// hub — it will be delivered from there, not by you" about a bag on his own
/// back, with no way forward from that screen.
///
/// Genuine hub custody starts at [ConsignmentState.inwardedAtHub] — the state
/// whose name says the hub took it in. See [awaitsHubInward] for `Created`.
bool get awaitsHub =>
this == ConsignmentState.created ||
this == ConsignmentState.inwardedAtHub ||
this == ConsignmentState.tripsheetLoaded ||
this == ConsignmentState.inTransit;
/// Converted, and not yet moved anywhere by anyone.
///
/// The parcel is with **this rider**. On a hyperlocal run this is a state the
/// release moves out of; on a hub-routed one his next act is to inward it at
/// the hub, which is not something this app does yet. Either way it is not a
/// reason to tell him the parcel is somebody else's — see [awaitsHub].
bool get awaitsHubInward => this == ConsignmentState.created;
/// After a successful `skip`, whether the stop is **still the rider's
/// problem**.
///
@@ -167,6 +195,13 @@ enum DeliverGate {
/// A real hub-side hold. Block, and say so.
awaitingHub,
/// `Created` — converted, never released, never inwarded. The parcel is in
/// this rider's hands, so the hub-hold wording is a lie; but it is not
/// `Out_for_Delivery` either, so `deliver` will refuse it. Blocked, with the
/// one sentence that is actually true about it. See
/// [ConsignmentStateX.awaitsHubInward].
awaitingInward,
/// Closed some other way (cancelled, returned). Not deliverable, not an
/// error the rider caused.
closed,
@@ -306,6 +341,7 @@ class ConsignmentGate {
if (state.isDelivered) return DeliverGate.alreadyDelivered;
if (state.needsRelease) return DeliverGate.needsRelease;
if (state.awaitsHub) return DeliverGate.awaitingHub;
if (state.awaitsHubInward) return DeliverGate.awaitingInward;
if (state.isClosed) return DeliverGate.closed;
return DeliverGate.unknown;
}