import type { FlowPath, FlowStep } from "./types"; // Reusable step builders const tripCreatedStep: FlowStep = { id: "trip-created", title: "Rider Requests Scheduled Trip", description: "Rider creates a new scheduled trip via the mobile app. Backend schedules a confirmation job in BullMQ.", actor: "rider", status: "PENDING", bookingStatus: "BOOK_PENDING", trigger: "Trip creation via POST /b2c/rider/trips", handler: "scheduleBookingJobs.js", activeComponents: ["rider-app", "backend-api", "bullmq", "database"], messages: [ { id: "tc-1", from: "rider-app", to: "backend-api", label: 'POST /trips', type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "tc-2", from: "backend-api", to: "database", label: "Create trip", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "tc-3", from: "backend-api", to: "bullmq", label: "Schedule rider confirmation job", type: "job", color: "#f59e0b", delay: 1600, duration: 700, }, { id: "tc-4", from: "backend-api", to: "rider-app", label: "Trip created (PENDING)", type: "response", color: "#06b6d4", delay: 2400, duration: 800, }, ], sideEffects: { jobs: "Schedule pre-trip-rider-confirmation (delay: booked_for - preBookingRiderConfirmationMinutes)", }, }; const riderConfirmationJobStep: FlowStep = { id: "rider-confirmation-job", title: "Pre-trip Rider Confirmation Job Fires", description: "BullMQ fires the pre-trip-rider-confirmation job. Backend updates booking status and sends push notification to rider.", actor: "system", status: "PENDING", bookingStatus: "BOOK_RIDER_CONFIRMATION_PENDING", trigger: "BullMQ pre-trip-rider-confirmation job fires", handler: "processPreTripRiderConfirmation() in booking-jobs-worker.js", activeComponents: ["bullmq", "backend-api", "rider-app", "database"], messages: [ { id: "rcj-1", from: "bullmq", to: "backend-api", label: "pre-trip-rider-confirmation fires", type: "job", color: "#f59e0b", delay: 0, duration: 700, }, { id: "rcj-2", from: "backend-api", to: "database", label: "Update booking_status", type: "request", color: "#7b59e6", delay: 800, duration: 600, }, { id: "rcj-3", from: "backend-api", to: "bullmq", label: "Schedule rider-confirmation-timeout", type: "job", color: "#f59e0b", delay: 1500, duration: 700, }, { id: "rcj-4", from: "backend-api", to: "rider-app", label: "Push: confirm booking", type: "notification", color: "#fb2576", delay: 2300, duration: 800, }, ], sideEffects: { jobs: "Schedule rider-confirmation-timeout (delay: riderConfirmationTimeoutMinutes)", notifications: "Push to Rider — BOOKING_PRE_TRIP_RIDER_CONFIRMATION", }, }; const riderConfirmsStep: FlowStep = { id: "rider-confirms", title: "Rider Confirms", description: "Rider confirms the booking via the app. Confirmation timeout job is cleaned up.", actor: "rider", status: "BOOK_CONFIRMED", bookingStatus: "BOOK_RIDER_CONFIRMED", trigger: "Rider PUT /b2c/rider/trips/:tripId/booking-status → BOOK_CONFIRMED", handler: "booking-status-update.js", activeComponents: ["rider-app", "backend-api", "bullmq", "database"], messages: [ { id: "rc-1", from: "rider-app", to: "backend-api", label: "PUT booking-status: BOOK_CONFIRMED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "rc-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "rc-3", from: "backend-api", to: "bullmq", label: "Remove rider-confirmation-timeout", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "rc-4", from: "backend-api", to: "rider-app", label: "Confirmed", type: "response", color: "#06b6d4", delay: 2400, duration: 800, }, ], sideEffects: { jobs: "Cleanup rider-confirmation-timeout job", }, }; const opsAssignsDriverStep: FlowStep = { id: "ops-assigns-driver", title: "Ops Assigns Driver", description: "Operations team assigns a driver to the trip. Driver receives notification and DAC card is created.", actor: "ops", status: "BOOK_ASSIGNED", bookingStatus: "BOOK_RIDER_CONFIRMED", trigger: "Ops PUT /trips/:tripId/status → BOOK_ASSIGNED + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "oad-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: BOOK_ASSIGNED + driver info", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "oad-2", from: "backend-api", to: "database", label: "Update status, assign driver", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "oad-3", from: "backend-api", to: "bullmq", label: "Cleanup old driver jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 500, }, { id: "oad-4", from: "backend-api", to: "bullmq", label: "Schedule pre-trip-driver-confirmation", type: "job", color: "#f59e0b", delay: 2200, duration: 700, }, { id: "oad-5", from: "backend-api", to: "driver-app", label: "Push: driver assignment", type: "notification", color: "#fb2576", delay: 3000, duration: 800, }, { id: "oad-6", from: "backend-api", to: "dac", label: "Publish scheduled ride DAC", type: "event", color: "#10b981", delay: 3900, duration: 700, }, { id: "oad-7", from: "backend-api", to: "pubsub", label: "Ride dispatch: BOOK_ASSIGNED", type: "event", color: "#10b981", delay: 4700, duration: 700, }, ], sideEffects: { jobs: "cleanupDriverBookingJobs() + Schedule pre-trip-driver-confirmation", notifications: "Booking-specific driver assignment notification", dac: "publishScheduledRideAction()", pubsub: "RIDE_STATUS_UPDATES_TOPIC: BOOK_ASSIGNED", }, }; const driverConfirmationJobStep: FlowStep = { id: "driver-confirmation-job", title: "Pre-trip Driver Confirmation Job Fires", description: "BullMQ fires the pre-trip-driver-confirmation job. Backend sends push notification asking driver to confirm.", actor: "system", status: "BOOK_ASSIGNED", bookingStatus: "BOOK_DRIVER_CONFIRMATION_PENDING", trigger: "BullMQ pre-trip-driver-confirmation job fires", handler: "processPreTripDriverConfirmation() in booking-jobs-worker.js", activeComponents: ["bullmq", "backend-api", "driver-app", "database"], messages: [ { id: "dcj-1", from: "bullmq", to: "backend-api", label: "pre-trip-driver-confirmation fires", type: "job", color: "#f59e0b", delay: 0, duration: 700, }, { id: "dcj-2", from: "backend-api", to: "database", label: "Update booking_status", type: "request", color: "#7b59e6", delay: 800, duration: 600, }, { id: "dcj-3", from: "backend-api", to: "bullmq", label: "Schedule driver-confirmation-timeout", type: "job", color: "#f59e0b", delay: 1500, duration: 700, }, { id: "dcj-4", from: "backend-api", to: "driver-app", label: "Push: confirm driver booking", type: "notification", color: "#fb2576", delay: 2300, duration: 800, }, ], sideEffects: { jobs: "Schedule driver-confirmation-timeout", notifications: "Push to Driver — BOOKING_PRE_TRIP_DRIVER_CONFIRMATION", }, }; const driverConfirmsStep: FlowStep = { id: "driver-confirms", title: "Driver Confirms", description: "Driver accepts the booking. Rider is notified that driver is on the way.", actor: "driver", status: "BOOK_ACCEPTED", bookingStatus: "BOOK_DRIVER_CONFIRMED", trigger: "Driver PUT /b2c/driver/trips/:tripId/booking-status → BOOK_ACCEPTED", handler: "driver-booking-status-update.js", activeComponents: [ "driver-app", "backend-api", "bullmq", "rider-app", "pubsub", "database", ], messages: [ { id: "dc-1", from: "driver-app", to: "backend-api", label: "PUT booking-status: BOOK_ACCEPTED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "dc-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "dc-3", from: "backend-api", to: "bullmq", label: "Remove driver-confirmation-timeout", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "dc-4", from: "backend-api", to: "rider-app", label: "Push: driver accepted", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "dc-5", from: "backend-api", to: "pubsub", label: "Ride dispatch: BOOK_ACCEPTED", type: "event", color: "#10b981", delay: 3300, duration: 700, }, ], sideEffects: { jobs: "Cleanup driver-confirmation-timeout", notifications: "Push to Rider — driver accepted", pubsub: "RIDE_STATUS_UPDATES_TOPIC: BOOK_ACCEPTED", }, }; const tripCompletionStep: FlowStep = { id: "trip-completion", title: "Trip Progresses to Completion", description: "Trip progresses through DRIVER_ARRIVED → STARTED → FINISHED. DAC card is deleted.", actor: "driver", status: "FINISHED", bookingStatus: "BOOK_FINISHED", trigger: "Driver/system updates via /trips/:tripId/status (DRIVER_ARRIVED → STARTED → FINISHED)", handler: "TRIP_UPDATE_MWS + fnUpdateBookingStatus", activeComponents: [ "driver-app", "backend-api", "dac", "pubsub", "database", ], messages: [ { id: "tc2-1", from: "driver-app", to: "backend-api", label: "DRIVER_ARRIVED → STARTED → FINISHED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "tc2-2", from: "backend-api", to: "database", label: "Update trip status + BOOK_FINISHED", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "tc2-3", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "tc2-4", from: "backend-api", to: "pubsub", label: "Trip status events", type: "event", color: "#10b981", delay: 2400, duration: 700, }, ], sideEffects: { dac: "fnDeleteScheduledRideDac on STARTED/FINISHED", pubsub: "Normal trip status events", }, }; const riderCancelsStep = ( stepId: string, _fromState: string, hasDriver: boolean ): FlowStep => ({ id: stepId, title: "Rider Cancels", description: hasDriver ? "Rider cancels the trip after a driver has been assigned. Driver is notified and DAC is cleaned up." : "Rider cancels the trip. All pending jobs are cleaned up.", actor: "rider", status: "RIDER_CANCELED", bookingStatus: "BOOK_RIDER_CANCELED", trigger: "Rider PUT /b2c/rider/trips/:tripId/booking-status → RIDER_CANCELED", handler: "booking-status-update.js", activeComponents: [ "rider-app", "backend-api", "bullmq", ...(hasDriver ? ["driver-app", "dac"] : []), "database", ], messages: [ { id: `${stepId}-1`, from: "rider-app", to: "backend-api", label: "PUT booking-status: RIDER_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: `${stepId}-2`, from: "backend-api", to: "database", label: "Update status + cancel_date_time", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: `${stepId}-3`, from: "backend-api", to: "bullmq", label: "Cleanup all booking jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, ...(hasDriver ? [ { id: `${stepId}-4`, from: "backend-api", to: "driver-app", label: "Push: booking_canceled_by_rider", type: "notification" as const, color: "#fb2576", delay: 2400, duration: 800, }, { id: `${stepId}-5`, from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup" as const, color: "#ef4444", delay: 3300, duration: 700, }, ] : []), ], sideEffects: { jobs: "cleanupBookingJobs()", ...(hasDriver ? { notifications: "Push to Driver — BOOKING_RIDER_CANCELED_DRIVER_NOTIFICATION", dac: "deleteScheduledRideAction()", } : {}), }, }); // Condensed setup step for paths that skip through early phases const condensedSetupStep: FlowStep = { id: "condensed-setup", title: "Trip Created → Rider Confirmed → Driver Assigned", description: "Condensed: Trip is created, rider confirms, and ops assigns a driver.", actor: "system", status: "BOOK_ASSIGNED", bookingStatus: "BOOK_RIDER_CONFIRMED", trigger: "Setup phase (condensed)", handler: "Various handlers", activeComponents: [ "rider-app", "backend-api", "bullmq", "ops-dashboard", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "cs-1", from: "rider-app", to: "backend-api", label: "POST /trips → Confirm → Assign", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "cs-2", from: "backend-api", to: "database", label: "Create & update trip", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "cs-3", from: "ops-dashboard", to: "backend-api", label: "Assign driver", type: "request", color: "#7b59e6", delay: 1600, duration: 800, }, { id: "cs-4", from: "backend-api", to: "driver-app", label: "Push: driver assignment", type: "notification", color: "#fb2576", delay: 2500, duration: 800, }, { id: "cs-5", from: "backend-api", to: "dac", label: "Create DAC card", type: "event", color: "#10b981", delay: 3400, duration: 700, }, ], sideEffects: { jobs: "Schedule pre-trip-driver-confirmation", notifications: "Driver assignment notification", dac: "publishScheduledRideAction()", pubsub: "RIDE_STATUS_UPDATES_TOPIC: BOOK_ASSIGNED", }, }; export const PATHS: FlowPath[] = [ // Path 1: Happy Path { id: 1, label: "Happy Path", icon: "✅", color: "#10b981", description: "PENDING → BOOK_CONFIRMED → BOOK_ASSIGNED → BOOK_ACCEPTED → FINISHED", category: "success", steps: [ tripCreatedStep, riderConfirmationJobStep, riderConfirmsStep, opsAssignsDriverStep, driverConfirmationJobStep, driverConfirmsStep, tripCompletionStep, ], }, // Path 2: Rider Cancels Early { id: 2, label: "Rider Cancels Early", icon: "🚫", color: "#ef4444", description: "PENDING → RIDER_CANCELED", category: "rider-cancel", steps: [ { ...tripCreatedStep, id: "p2-trip-created" }, riderCancelsStep("p2-rider-cancels", "PENDING", false), ], }, // Path 3: Rider Timeout → System Cancel { id: 3, label: "Rider Timeout → System Cancel", icon: "⏰", color: "#f59e0b", description: "PENDING → BOOK_RIDER_CONFIRMATION_PENDING → RIDER_CANCELED (System)", category: "timeout", steps: [ { ...tripCreatedStep, id: "p3-trip-created" }, { ...riderConfirmationJobStep, id: "p3-rider-conf-job" }, { id: "p3-rider-timeout", title: "Rider Confirmation Timeout Fires", description: "Rider did not confirm in time. Ops team is alerted with HIGH priority and given a window to intervene.", actor: "system", status: "PENDING", bookingStatus: "BOOK_OPERATION_RIDER_CONFIRMATION_PENDING", trigger: "BullMQ rider-confirmation-timeout job fires", handler: "processRiderConfirmationTimeout() in booking-jobs-worker.js", activeComponents: [ "bullmq", "backend-api", "rider-app", "ops-dashboard", "database", ], messages: [ { id: "p3rt-1", from: "bullmq", to: "backend-api", label: "rider-confirmation-timeout fires", type: "job", color: "#f59e0b", delay: 0, duration: 700, }, { id: "p3rt-2", from: "backend-api", to: "database", label: "Update booking_status", type: "request", color: "#7b59e6", delay: 800, duration: 600, }, { id: "p3rt-3", from: "backend-api", to: "bullmq", label: "Schedule ops-rider-confirmation-window-timeout", type: "job", color: "#f59e0b", delay: 1500, duration: 700, }, { id: "p3rt-4", from: "backend-api", to: "rider-app", label: "Push: booking_timeout", type: "notification", color: "#fb2576", delay: 2300, duration: 800, }, { id: "p3rt-5", from: "backend-api", to: "ops-dashboard", label: "HIGH: booking_rider_confirmation_timeout", type: "event", color: "#10b981", delay: 3200, duration: 800, }, ], sideEffects: { jobs: "Schedule ops-rider-confirmation-window-timeout", notifications: "Push to Rider + Dashboard alert (high priority)", }, }, { id: "p3-ops-window-timeout", title: "Ops Window Timeout → System Cancel", description: "Ops window expired without intervention. System auto-cancels the trip.", actor: "system", status: "RIDER_CANCELED", bookingStatus: "BOOK_SYSTEM_CANCELED", trigger: "BullMQ ops-rider-confirmation-window-timeout job fires", handler: "processOpsConfirmationWindowTimeout() in booking-jobs-worker.js", activeComponents: [ "bullmq", "backend-api", "rider-app", "ops-dashboard", "database", ], messages: [ { id: "p3owt-1", from: "bullmq", to: "backend-api", label: "ops-rider-confirmation-window-timeout fires", type: "job", color: "#f59e0b", delay: 0, duration: 700, }, { id: "p3owt-2", from: "backend-api", to: "database", label: "RIDER_CANCELED + BOOK_SYSTEM_CANCELED", type: "request", color: "#7b59e6", delay: 800, duration: 600, }, { id: "p3owt-3", from: "backend-api", to: "rider-app", label: "Push: booking_cancelled", type: "notification", color: "#fb2576", delay: 1500, duration: 800, }, { id: "p3owt-4", from: "backend-api", to: "ops-dashboard", label: "booking_ops_confirmation_window_timeout", type: "event", color: "#10b981", delay: 2400, duration: 800, }, ], sideEffects: { notifications: "Push to Rider + Dashboard alert", }, }, ], }, // Path 4: Rider Cancels During Confirmation Pending { id: 4, label: "Rider Cancels During Confirmation", icon: "🚫", color: "#ef4444", description: "PENDING → BOOK_RIDER_CONFIRMATION_PENDING → RIDER_CANCELED", category: "rider-cancel", steps: [ { ...tripCreatedStep, id: "p4-trip-created" }, { ...riderConfirmationJobStep, id: "p4-rider-conf-job" }, riderCancelsStep("p4-rider-cancels", "BOOK_RIDER_CONFIRMATION_PENDING", false), ], }, // Path 5: Rider Cancels After Confirming { id: 5, label: "Rider Cancels After Confirming", icon: "🚫", color: "#ef4444", description: "PENDING → BOOK_CONFIRMED → RIDER_CANCELED", category: "rider-cancel", steps: [ { ...tripCreatedStep, id: "p5-trip-created" }, { ...riderConfirmationJobStep, id: "p5-rider-conf-job" }, { ...riderConfirmsStep, id: "p5-rider-confirms" }, riderCancelsStep("p5-rider-cancels", "BOOK_RIDER_CONFIRMED", false), ], }, // Path 6: Rider Cancels After Driver Assignment { id: 6, label: "Rider Cancels After Assignment", icon: "🚫", color: "#ef4444", description: "PENDING → BOOK_CONFIRMED → BOOK_ASSIGNED → RIDER_CANCELED", category: "rider-cancel", steps: [ { ...tripCreatedStep, id: "p6-trip-created" }, { ...riderConfirmationJobStep, id: "p6-rider-conf-job" }, { ...riderConfirmsStep, id: "p6-rider-confirms" }, { ...opsAssignsDriverStep, id: "p6-ops-assigns" }, { id: "p6-rider-cancels-after-assign", title: "Rider Cancels After Assignment", description: "Rider cancels the trip after a driver has been assigned. All jobs are cleaned up and driver is notified.", actor: "rider", status: "RIDER_CANCELED", bookingStatus: "BOOK_RIDER_CANCELED", trigger: "Via /b2c/rider/trips/:tripId/booking-status or /trips/:tripId/status", handler: "booking-status-update.js / fnUpdateBookingStatus", activeComponents: [ "rider-app", "backend-api", "bullmq", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "p6rc-1", from: "rider-app", to: "backend-api", label: "PUT booking-status: RIDER_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p6rc-2", from: "backend-api", to: "database", label: "Update status + cancel_date_time", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p6rc-3", from: "backend-api", to: "bullmq", label: "Cleanup all rider + driver jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p6rc-4", from: "backend-api", to: "driver-app", label: "Push: booking_canceled_by_rider", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p6rc-5", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 3300, duration: 700, }, { id: "p6rc-6", from: "backend-api", to: "pubsub", label: "Trip status update", type: "event", color: "#10b981", delay: 4100, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Push to Driver — BOOKING_RIDER_CANCELED_DRIVER_NOTIFICATION", dac: "deleteScheduledRideAction()", pubsub: "Trip status update", }, }, ], }, // Path 7: Driver Cancels { id: 7, label: "Driver Cancels", icon: "🚗", color: "#8b5cf6", description: "BOOK_ASSIGNED → BOOK_DRIVER_CONFIRMATION_PENDING → DRIVER_CANCELED", category: "driver-cancel", steps: [ { ...condensedSetupStep, id: "p7-setup" }, { ...driverConfirmationJobStep, id: "p7-driver-conf-job" }, { id: "p7-driver-cancels", title: "Driver Cancels", description: "Driver declines the booking. DAC is deleted and dispatch event is published.", actor: "driver", status: "DRIVER_CANCELED", bookingStatus: "BOOK_DRIVER_CANCELED", trigger: "Driver PUT /b2c/driver/trips/:tripId/booking-status → BOOK_DRIVER_CANCELED", handler: "driver-booking-status-update.js", activeComponents: [ "driver-app", "backend-api", "bullmq", "dac", "pubsub", "database", ], messages: [ { id: "p7dc-1", from: "driver-app", to: "backend-api", label: "PUT booking-status: BOOK_DRIVER_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p7dc-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p7dc-3", from: "backend-api", to: "bullmq", label: "Cleanup driver jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p7dc-4", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 2400, duration: 700, }, { id: "p7dc-5", from: "backend-api", to: "pubsub", label: "Ride dispatch: BOOK_DRIVER_CANCELED", type: "event", color: "#10b981", delay: 3200, duration: 700, }, ], sideEffects: { jobs: "Cleanup driver confirmation + timeout jobs", dac: "deleteScheduledRideAction()", pubsub: "RIDE_STATUS_UPDATES_TOPIC: BOOK_DRIVER_CANCELED", }, }, ], }, // Path 8: Driver Timeout → Ops Cancel { id: 8, label: "Driver Timeout → Ops Cancel", icon: "⏰", color: "#f59e0b", description: "BOOK_ASSIGNED → BOOK_DRIVER_CONFIRMATION_PENDING → DRIVER_CANCELED (via timeout)", category: "timeout", steps: [ { ...condensedSetupStep, id: "p8-setup" }, { ...driverConfirmationJobStep, id: "p8-driver-conf-job" }, { id: "p8-driver-timeout", title: "Driver Timeout → Ops Escalation", description: "Driver did not confirm in time. Trip is canceled and ops team is alerted.", actor: "system", status: "DRIVER_CANCELED", bookingStatus: "BOOK_OPERATION_DRIVER_CONFIRMATION_PENDING", trigger: "BullMQ driver-confirmation-timeout job fires", handler: "processDriverConfirmationTimeout() in booking-jobs-worker.js", activeComponents: [ "bullmq", "backend-api", "driver-app", "ops-dashboard", "database", ], messages: [ { id: "p8dt-1", from: "bullmq", to: "backend-api", label: "driver-confirmation-timeout fires", type: "job", color: "#f59e0b", delay: 0, duration: 700, }, { id: "p8dt-2", from: "backend-api", to: "database", label: "DRIVER_CANCELED + booking_status", type: "request", color: "#7b59e6", delay: 800, duration: 600, }, { id: "p8dt-3", from: "backend-api", to: "bullmq", label: "Schedule ops-driver-confirmation-window-timeout", type: "job", color: "#f59e0b", delay: 1500, duration: 700, }, { id: "p8dt-4", from: "backend-api", to: "driver-app", label: "Push: driver_booking_timeout", type: "notification", color: "#fb2576", delay: 2300, duration: 800, }, { id: "p8dt-5", from: "backend-api", to: "ops-dashboard", label: "HIGH: booking_driver_confirmation_timeout", type: "event", color: "#10b981", delay: 3200, duration: 800, }, ], sideEffects: { jobs: "Schedule ops-driver-confirmation-window-timeout", notifications: "Push to Driver + Dashboard alert (high priority)", }, }, { id: "p8-ops-window-timeout", title: "Ops Window Timeout → Cancel", description: "Ops window expired. System cancels the driver assignment and cleans up.", actor: "system", status: "DRIVER_CANCELED", bookingStatus: "BOOK_OPERATION_DRIVER_CANCELED", trigger: "BullMQ ops-driver-confirmation-window-timeout job fires", handler: "processOpsDriverConfirmationWindowTimeout() in booking-jobs-worker.js", activeComponents: [ "bullmq", "backend-api", "driver-app", "ops-dashboard", "dac", "database", ], messages: [ { id: "p8owt-1", from: "bullmq", to: "backend-api", label: "ops-driver-confirmation-window-timeout fires", type: "job", color: "#f59e0b", delay: 0, duration: 700, }, { id: "p8owt-2", from: "backend-api", to: "database", label: "BOOK_OPERATION_DRIVER_CANCELED", type: "request", color: "#7b59e6", delay: 800, duration: 600, }, { id: "p8owt-3", from: "backend-api", to: "driver-app", label: "Push: driver_booking_ops_cancelled", type: "notification", color: "#fb2576", delay: 1500, duration: 800, }, { id: "p8owt-4", from: "backend-api", to: "ops-dashboard", label: "booking_driver_ops_window_timeout", type: "event", color: "#10b981", delay: 2400, duration: 800, }, { id: "p8owt-5", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 3300, duration: 700, }, ], sideEffects: { notifications: "Push to Driver + Dashboard alert", dac: "deleteScheduledRideAction()", }, }, ], }, // Path 9: Ops Cancels (Various) — with sub-paths { id: 9, label: "Ops Cancels (Various)", icon: "🛠️", color: "#06b6d4", description: "Ops-initiated cancellations at various stages", category: "ops", steps: [], subPaths: [ { id: "9a", label: "Ops Cancels Before Assignment", steps: [ { id: "p9a-starting-state", title: "Trip at Pre-Assignment Stage", description: "Trip is in PENDING or BOOK_CONFIRMED state, no driver assigned.", actor: "system", status: "PENDING / BOOK_CONFIRMED", bookingStatus: "BOOK_PENDING / BOOK_RIDER_CONFIRMED", trigger: "Starting state", handler: "N/A", activeComponents: [ "rider-app", "backend-api", "database", ], messages: [], sideEffects: {}, }, { id: "p9a-ops-cancels", title: "Ops Cancels Before Assignment", description: "Operations cancels the trip before any driver is assigned. Rider is notified.", actor: "ops", status: "RIDER_CANCELED", bookingStatus: "BOOK_OPERATION_RIDER_CANCELED", trigger: "Ops PUT /trips/:tripId/status → RIDER_CANCELED + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "rider-app", "pubsub", "database", ], messages: [ { id: "p9a-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: RIDER_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p9a-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p9a-3", from: "backend-api", to: "bullmq", label: "Cleanup rider + driver jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p9a-4", from: "backend-api", to: "rider-app", label: "Push: RIDER_CANCELED", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p9a-5", from: "backend-api", to: "pubsub", label: "Trip status + dispatch events", type: "event", color: "#10b981", delay: 3300, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Generic ConfiguredPn: RIDER_CANCELED", pubsub: "fnProduceTripStatusUpdate + publishRideDispatchGenericStatusMW", }, }, ], }, { id: "9b", label: "Ops Cancels Rider After Assignment", steps: [ { id: "p9b-starting-state", title: "Trip With Driver Assigned", description: "Trip has a driver assigned (BOOK_ASSIGNED state).", actor: "system", status: "BOOK_ASSIGNED", bookingStatus: "BOOK_RIDER_CONFIRMED", trigger: "Starting state", handler: "N/A", activeComponents: [ "rider-app", "backend-api", "driver-app", "database", ], messages: [], sideEffects: {}, }, { id: "p9b-ops-cancels-rider", title: "Ops Cancels Rider After Assignment", description: "Operations cancels the rider side. Both rider and driver are notified, DAC deleted, driver goes ONLINE.", actor: "ops", status: "RIDER_CANCELED", bookingStatus: "BOOK_OPERATION_RIDER_CANCELED", trigger: "Ops PUT /trips/:tripId/status → RIDER_CANCELED + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "rider-app", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "p9b-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: RIDER_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p9b-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p9b-3", from: "backend-api", to: "bullmq", label: "Cleanup rider + driver jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p9b-4", from: "backend-api", to: "rider-app", label: "Push: RIDER_CANCELED", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p9b-5", from: "backend-api", to: "driver-app", label: "Push: booking_canceled_by_rider", type: "notification", color: "#fb2576", delay: 3300, duration: 800, }, { id: "p9b-6", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 4200, duration: 700, }, { id: "p9b-7", from: "backend-api", to: "pubsub", label: "Trip status + dispatch events", type: "event", color: "#10b981", delay: 5000, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Push to Rider + Push to Driver — booking_canceled_by_rider", dac: "deleteScheduledRideAction()", pubsub: "Trip status + dispatch events", }, }, ], }, { id: "9c", label: "Ops Cancels Driver After Assignment", steps: [ { id: "p9c-starting-state", title: "Trip With Driver Assigned", description: "Trip has a driver assigned (BOOK_ASSIGNED state).", actor: "system", status: "BOOK_ASSIGNED", bookingStatus: "BOOK_RIDER_CONFIRMED", trigger: "Starting state", handler: "N/A", activeComponents: [ "rider-app", "backend-api", "driver-app", "database", ], messages: [], sideEffects: {}, }, { id: "p9c-ops-cancels-driver", title: "Ops Cancels Driver After Assignment", description: "Operations cancels the driver assignment. Driver goes ONLINE, rider notified of reassignment/cancel.", actor: "ops", status: "DRIVER_CANCELED", bookingStatus: "BOOK_OPERATION_DRIVER_CANCELED", trigger: "Ops PUT /trips/:tripId/status → DRIVER_CANCELED + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "rider-app", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "p9c-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: DRIVER_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p9c-2", from: "backend-api", to: "database", label: "Update status, clear driver refs", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p9c-3", from: "backend-api", to: "bullmq", label: "Cleanup all rider + driver jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p9c-4", from: "backend-api", to: "rider-app", label: "Push: driver canceled, reassigning", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p9c-5", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 3300, duration: 700, }, { id: "p9c-6", from: "backend-api", to: "pubsub", label: "Trip status + dispatch events", type: "event", color: "#10b981", delay: 4100, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Push to Rider — driver canceled, being reassigned", dac: "deleteScheduledRideAction()", pubsub: "Trip status + dispatch events", }, }, ], }, { id: "9d", label: "No Driver Available", steps: [ { id: "p9d-starting-state", title: "Trip Awaiting Driver", description: "Trip is confirmed but no driver can be found.", actor: "system", status: "BOOK_CONFIRMED", bookingStatus: "BOOK_RIDER_CONFIRMED", trigger: "Starting state", handler: "N/A", activeComponents: [ "rider-app", "backend-api", "database", ], messages: [], sideEffects: {}, }, { id: "p9d-no-driver", title: "No Driver Available", description: "System determines no driver is available for the scheduled ride. Trip is canceled.", actor: "system", status: "NO_DRIVER_AVAILABLE", bookingStatus: "BOOK_SYSTEM_CANCELED", trigger: "Ops PUT /trips/:tripId/status → NO_DRIVER_AVAILABLE + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "rider-app", "dac", "pubsub", "database", ], messages: [ { id: "p9d-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: NO_DRIVER_AVAILABLE", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p9d-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p9d-3", from: "backend-api", to: "bullmq", label: "Cleanup all jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p9d-4", from: "backend-api", to: "rider-app", label: "Push: no driver found", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p9d-5", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 3300, duration: 700, }, { id: "p9d-6", from: "backend-api", to: "pubsub", label: "Trip status events", type: "event", color: "#10b981", delay: 4100, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Push to Rider — no driver found for scheduled ride", dac: "deleteScheduledRideAction()", pubsub: "Trip status events", }, }, ], }, ], }, // Path 10: Driver Re-assignment { id: 10, label: "Driver Re-assignment", icon: "🔄", color: "#8b5cf6", description: "DRIVER_CANCELED → BOOK_ASSIGNED (new driver) → continues Happy Path", category: "ops", steps: [ { id: "p10-canceled-state", title: "Previous State — Driver Canceled", description: "Trip is in DRIVER_CANCELED state. Previous driver has been removed.", actor: "system", status: "DRIVER_CANCELED", bookingStatus: "BOOK_DRIVER_CANCELED", trigger: "Previous driver cancellation", handler: "N/A", activeComponents: ["backend-api", "database"], messages: [], sideEffects: {}, }, { id: "p10-reassign", title: "Ops Re-assigns New Driver", description: "Ops assigns a new driver. Booking status is reset to BOOK_RIDER_CONFIRMED to re-enable driver confirmation flow.", actor: "ops", status: "BOOK_ASSIGNED", bookingStatus: "BOOK_RIDER_CONFIRMED", trigger: "Ops PUT /trips/:tripId/status → BOOK_ASSIGNED (new driver) + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "p10-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: BOOK_ASSIGNED (new driver)", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p10-2", from: "backend-api", to: "database", label: "Reset booking_status, assign new driver", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p10-3", from: "backend-api", to: "bullmq", label: "Cleanup old driver jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p10-4", from: "backend-api", to: "bullmq", label: "Schedule new pre-trip-driver-confirmation", type: "job", color: "#f59e0b", delay: 2400, duration: 700, }, { id: "p10-5", from: "backend-api", to: "driver-app", label: "New driver assignment notification", type: "notification", color: "#fb2576", delay: 3200, duration: 800, }, { id: "p10-6", from: "backend-api", to: "dac", label: "Publish new scheduled ride DAC", type: "event", color: "#10b981", delay: 4100, duration: 700, }, { id: "p10-7", from: "backend-api", to: "pubsub", label: "Ride dispatch event", type: "event", color: "#10b981", delay: 4900, duration: 700, }, ], sideEffects: { jobs: "Cleanup old driver jobs + Schedule new pre-trip-driver-confirmation", notifications: "New driver assignment notification", dac: "publishScheduledRideAction()", pubsub: "Ride dispatch event", }, }, ], }, // Path 11: Active Trip Cancellations — with sub-paths { id: 11, label: "Active Trip Cancellations", icon: "⚠️", color: "#ef4444", description: "Cancellations during active trips (post-acceptance)", category: "active-cancel", steps: [], subPaths: [ { id: "11a", label: "Driver Cancels While Coming", steps: [ { id: "p11a-active-state", title: "Trip Accepted & Driver Coming", description: "Trip has been accepted by driver and driver is en route.", actor: "system", status: "ACCEPTED", bookingStatus: "BOOK_DRIVER_CONFIRMED", trigger: "Active trip state", handler: "N/A", activeComponents: [ "rider-app", "driver-app", "backend-api", "database", ], messages: [], sideEffects: {}, }, { id: "p11a-driver-cancels", title: "Driver Cancels While Coming", description: "Driver cancels while en route. Re-dispatch is triggered. Driver goes ONLINE.", actor: "ops", status: "DRIVER_COMING_CANCELED", bookingStatus: "BOOK_OPERATION_DRIVER_CANCELED", trigger: "Ops PUT /trips/:tripId/status → DRIVER_COMING_CANCELED + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "rider-app", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "p11a-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: DRIVER_COMING_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p11a-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p11a-3", from: "backend-api", to: "bullmq", label: "Cleanup all jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p11a-4", from: "backend-api", to: "rider-app", label: "Push: driver canceled while coming", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p11a-5", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 3300, duration: 700, }, { id: "p11a-6", from: "backend-api", to: "pubsub", label: "Trip status events", type: "event", color: "#10b981", delay: 4100, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Push to Rider — driver canceled while coming", dac: "deleteScheduledRideAction()", pubsub: "fnReDispatchAfterDriverCancels triggers re-dispatch", }, }, ], }, { id: "11b", label: "Rider Cancels While Driver Coming", steps: [ { id: "p11b-active-state", title: "Trip Accepted & Driver Coming", description: "Trip has been accepted by driver and driver is en route.", actor: "system", status: "ACCEPTED", bookingStatus: "BOOK_DRIVER_CONFIRMED", trigger: "Active trip state", handler: "N/A", activeComponents: [ "rider-app", "driver-app", "backend-api", "database", ], messages: [], sideEffects: {}, }, { id: "p11b-rider-cancels", title: "Rider Cancels While Driver Coming", description: "Rider cancels while driver is en route. Driver is notified and goes ONLINE.", actor: "ops", status: "DRIVER_COMING_RIDER_CANCELED", bookingStatus: "BOOK_OPERATION_RIDER_CANCELED", trigger: "Ops PUT /trips/:tripId/status → DRIVER_COMING_RIDER_CANCELED + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "rider-app", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "p11b-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: DRIVER_COMING_RIDER_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p11b-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p11b-3", from: "backend-api", to: "bullmq", label: "Cleanup all jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p11b-4", from: "backend-api", to: "driver-app", label: "Push: rider canceled", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p11b-5", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 3300, duration: 700, }, { id: "p11b-6", from: "backend-api", to: "pubsub", label: "Trip status events", type: "event", color: "#10b981", delay: 4100, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Push to Driver — rider canceled", dac: "deleteScheduledRideAction()", pubsub: "Trip status events", }, }, ], }, { id: "11c", label: "Driver Cancels After Arrival", steps: [ { id: "p11c-active-state", title: "Trip — Driver Has Arrived", description: "Driver has arrived at pickup location.", actor: "system", status: "DRIVER_ARRIVED", bookingStatus: "BOOK_DRIVER_CONFIRMED", trigger: "Active trip state", handler: "N/A", activeComponents: [ "rider-app", "driver-app", "backend-api", "database", ], messages: [], sideEffects: {}, }, { id: "p11c-driver-cancels", title: "Driver Cancels After Arrival", description: "Driver cancels after arriving at pickup. Rider is notified and driver goes ONLINE.", actor: "ops", status: "DRIVER_ARRIVED_CANCELED", bookingStatus: "BOOK_OPERATION_DRIVER_CANCELED", trigger: "Ops PUT /trips/:tripId/status → DRIVER_ARRIVED_CANCELED + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "rider-app", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "p11c-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: DRIVER_ARRIVED_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p11c-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p11c-3", from: "backend-api", to: "bullmq", label: "Cleanup all jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p11c-4", from: "backend-api", to: "rider-app", label: "Push: driver canceled after arrival", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p11c-5", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 3300, duration: 700, }, { id: "p11c-6", from: "backend-api", to: "pubsub", label: "Trip status events", type: "event", color: "#10b981", delay: 4100, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Push to Rider — driver canceled after arrival", dac: "deleteScheduledRideAction()", pubsub: "Trip status events", }, }, ], }, { id: "11d", label: "Rider Cancels After Driver Arrived", steps: [ { id: "p11d-active-state", title: "Trip — Driver Has Arrived", description: "Driver has arrived at pickup location.", actor: "system", status: "DRIVER_ARRIVED", bookingStatus: "BOOK_DRIVER_CONFIRMED", trigger: "Active trip state", handler: "N/A", activeComponents: [ "rider-app", "driver-app", "backend-api", "database", ], messages: [], sideEffects: {}, }, { id: "p11d-rider-cancels", title: "Rider Cancels After Driver Arrived", description: "Rider cancels after driver has arrived at pickup. Driver is notified and goes ONLINE.", actor: "ops", status: "DRIVER_ARRIVED_RIDER_CANCELED", bookingStatus: "BOOK_OPERATION_RIDER_CANCELED", trigger: "Ops PUT /trips/:tripId/status → DRIVER_ARRIVED_RIDER_CANCELED + internal-access-key", handler: "fnUpdateBookingStatus", activeComponents: [ "ops-dashboard", "backend-api", "bullmq", "rider-app", "driver-app", "dac", "pubsub", "database", ], messages: [ { id: "p11d-1", from: "ops-dashboard", to: "backend-api", label: "PUT status: DRIVER_ARRIVED_RIDER_CANCELED", type: "request", color: "#7b59e6", delay: 0, duration: 800, }, { id: "p11d-2", from: "backend-api", to: "database", label: "Update status + booking_status", type: "request", color: "#7b59e6", delay: 900, duration: 600, }, { id: "p11d-3", from: "backend-api", to: "bullmq", label: "Cleanup all jobs", type: "cleanup", color: "#ef4444", delay: 1600, duration: 700, }, { id: "p11d-4", from: "backend-api", to: "driver-app", label: "Push: rider canceled after arrival", type: "notification", color: "#fb2576", delay: 2400, duration: 800, }, { id: "p11d-5", from: "backend-api", to: "dac", label: "Delete scheduled ride DAC", type: "cleanup", color: "#ef4444", delay: 3300, duration: 700, }, { id: "p11d-6", from: "backend-api", to: "pubsub", label: "Trip status events", type: "event", color: "#10b981", delay: 4100, duration: 700, }, ], sideEffects: { jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()", notifications: "Push to Driver — rider canceled after arrival", dac: "deleteScheduledRideAction()", pubsub: "Trip status events", }, }, ], }, ], }, ];