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

@@ -106,8 +106,9 @@ void main() {
test('a genuine hub hold stays blocked — the logistics guard', () {
// The guard the brief requires be kept: a consignment inside the hub's
// half of the network is not this rider's to hand over.
//
// `Created` is deliberately NOT in this list — see the test below.
for (final s in const [
ConsignmentState.created,
ConsignmentState.inwardedAtHub,
ConsignmentState.tripsheetLoaded,
ConsignmentState.inTransit,
@@ -118,6 +119,36 @@ void main() {
}
});
test('`Created` is the rider\'s own parcel, not a hub hold', () {
// The bug this pins: `Created` was in the hub list, so sliding **Start
// ride** on a freshly converted consignment answered "This parcel is
// with the hub — it will be delivered from there, not by you" about a
// bag on the rider's own back, and nothing on that screen cleared it.
//
// The backend writes `Created` at the pivot for hub-routed work
// (`next_action: inward_at_hub`) and holds it there transiently while
// hyperlocal work is routed. The hub has not taken it in either way.
const s = ConsignmentState.created;
expect(s.awaitsHub, isFalse, reason: 'the hub has never seen it');
expect(s.awaitsHubInward, isTrue);
expect(ConsignmentGate.gateFor(s), DeliverGate.awaitingInward);
// Still not deliverable: `deliver` only accepts `Out_for_Delivery`. The
// fix changes which sentence the rider is shown, never what is claimed.
expect(s.isDeliverable, isFalse);
expect(s.needsRelease, isFalse);
// And no other state may drift into the new rung.
for (final other in ConsignmentState.values) {
if (other == ConsignmentState.created) continue;
expect(
other.awaitsHubInward,
isFalse,
reason: '${other.name} is not the pre-inward rung',
);
}
});
test('closed work is refused without blaming the rider', () {
for (final s in const [
ConsignmentState.cancelled,