yadflow 2.6.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -11
- package/README.md +30 -5
- package/bin/yad.mjs +36 -1
- package/cli/docs.mjs +298 -0
- package/cli/manifest.mjs +6 -1
- package/cli/roster.mjs +164 -0
- package/cli/setup.mjs +128 -2
- package/package.json +3 -4
- package/skills/sdlc/config.yaml +19 -0
- package/skills/sdlc/install.sh +1 -1
- package/skills/sdlc/module-help.csv +4 -0
- package/skills/yad-connect-docs/SKILL.md +132 -0
- package/skills/yad-connect-docs/references/docs-registry.md +74 -0
- package/skills/yad-connect-repos/SKILL.md +4 -0
- package/skills/yad-connect-repos/references/hub-config.md +3 -1
- package/skills/yad-docs/SKILL.md +159 -0
- package/skills/yad-docs/references/data-mapping.md +75 -0
- package/skills/yad-docs/references/theme-map.md +69 -0
- package/skills/yad-docs/templates/app/README.md +31 -0
- package/skills/yad-docs/templates/app/eslint.config.js +23 -0
- package/skills/yad-docs/templates/app/index.html +17 -0
- package/skills/yad-docs/templates/app/package-lock.json +4030 -0
- package/skills/yad-docs/templates/app/package.json +35 -0
- package/skills/yad-docs/templates/app/public/favicon.svg +28 -0
- package/skills/yad-docs/templates/app/public/logo.svg +39 -0
- package/skills/yad-docs/templates/app/public/vite.svg +1 -0
- package/skills/yad-docs/templates/app/src/App.tsx +98 -0
- package/skills/yad-docs/templates/app/src/components/Auth/LoginPage.tsx +101 -0
- package/skills/yad-docs/templates/app/src/components/Canvas/AnimatedMessage.tsx +101 -0
- package/skills/yad-docs/templates/app/src/components/Canvas/ConnectionLine.tsx +90 -0
- package/skills/yad-docs/templates/app/src/components/Canvas/FlowCanvas.tsx +216 -0
- package/skills/yad-docs/templates/app/src/components/Canvas/SystemComponent.tsx +153 -0
- package/skills/yad-docs/templates/app/src/components/Controls/PlaybackBar.tsx +284 -0
- package/skills/yad-docs/templates/app/src/components/Controls/StepDetail.tsx +167 -0
- package/skills/yad-docs/templates/app/src/components/DetailPanel/HandlerLogicSnippet.tsx +41 -0
- package/skills/yad-docs/templates/app/src/components/DetailPanel/RequestPayloadPreview.tsx +46 -0
- package/skills/yad-docs/templates/app/src/components/DetailPanel/RightPanel.tsx +88 -0
- package/skills/yad-docs/templates/app/src/components/DetailPanel/StatusCard.tsx +76 -0
- package/skills/yad-docs/templates/app/src/components/DetailPanel/TriggerEventCard.tsx +45 -0
- package/skills/yad-docs/templates/app/src/components/DocLayout/DocPageShell.tsx +80 -0
- package/skills/yad-docs/templates/app/src/components/DocLayout/DocSectionCard.tsx +55 -0
- package/skills/yad-docs/templates/app/src/components/DocLayout/DocTableOfContents.tsx +79 -0
- package/skills/yad-docs/templates/app/src/components/DocLayout/RoleCard.tsx +67 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/ApiReferenceSection.tsx +108 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/CancelabilitySection.tsx +73 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/CriticalRunbookSection.tsx +177 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/DataMigrationSection.tsx +102 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/DbSchemaSection.tsx +98 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/DeploymentGuideSection.tsx +104 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/DriverIntegrationSection.tsx +127 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/ExecutiveSummarySection.tsx +69 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/FlowOverviewSection.tsx +73 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/FlowPathsChecklistSection.tsx +96 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/MiddlewareChainSection.tsx +107 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/MonitoringAlertingSection.tsx +106 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/NotificationLocalizationSection.tsx +102 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/PMRoadmapSection.tsx +133 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/PerformanceTestingSection.tsx +91 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/RiderIntegrationSection.tsx +99 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/SecuritySection.tsx +74 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/StatusMachineSection.tsx +90 -0
- package/skills/yad-docs/templates/app/src/components/DocSections/TestPlanSection.tsx +163 -0
- package/skills/yad-docs/templates/app/src/components/Logs/SystemLogsTerminal.tsx +126 -0
- package/skills/yad-docs/templates/app/src/components/Navigation/TopNavBar.tsx +90 -0
- package/skills/yad-docs/templates/app/src/components/Reference/BullMQJobsList.tsx +60 -0
- package/skills/yad-docs/templates/app/src/components/Reference/DecisionTreeView.tsx +49 -0
- package/skills/yad-docs/templates/app/src/components/Reference/DeeplinkActionsChips.tsx +69 -0
- package/skills/yad-docs/templates/app/src/components/Reference/DriverUIStatesTable.tsx +61 -0
- package/skills/yad-docs/templates/app/src/components/Reference/FeatureFlagMatrix.tsx +73 -0
- package/skills/yad-docs/templates/app/src/components/Reference/RiderUIStatesTable.tsx +61 -0
- package/skills/yad-docs/templates/app/src/components/Reference/RulesLegendPanel.tsx +217 -0
- package/skills/yad-docs/templates/app/src/components/Reference/StakeholderToggle.tsx +41 -0
- package/skills/yad-docs/templates/app/src/components/Reference/TroubleshootingSection.tsx +93 -0
- package/skills/yad-docs/templates/app/src/components/Sidebar/PathSelector.tsx +148 -0
- package/skills/yad-docs/templates/app/src/components/Sidebar/SidebarFooter.tsx +40 -0
- package/skills/yad-docs/templates/app/src/components/Sidebar/StepList.tsx +234 -0
- package/skills/yad-docs/templates/app/src/components/shared/Badge.tsx +28 -0
- package/skills/yad-docs/templates/app/src/components/shared/CommandPalette.tsx +213 -0
- package/skills/yad-docs/templates/app/src/components/shared/Icon.tsx +21 -0
- package/skills/yad-docs/templates/app/src/components/shared/Tooltip.tsx +42 -0
- package/skills/yad-docs/templates/app/src/data/components.ts +74 -0
- package/skills/yad-docs/templates/app/src/data/docSections.ts +231 -0
- package/skills/yad-docs/templates/app/src/data/paths.ts +2319 -0
- package/skills/yad-docs/templates/app/src/data/referenceData.ts +392 -0
- package/skills/yad-docs/templates/app/src/data/roles.ts +145 -0
- package/skills/yad-docs/templates/app/src/data/types.ts +79 -0
- package/skills/yad-docs/templates/app/src/hooks/useAnimationQueue.ts +41 -0
- package/skills/yad-docs/templates/app/src/hooks/usePlayback.ts +100 -0
- package/skills/yad-docs/templates/app/src/hooks/useStakeholderFilter.ts +10 -0
- package/skills/yad-docs/templates/app/src/index.css +121 -0
- package/skills/yad-docs/templates/app/src/main.tsx +13 -0
- package/skills/yad-docs/templates/app/src/pages/RoleSelectPage.tsx +34 -0
- package/skills/yad-docs/templates/app/src/pages/StakeholderDocPage.tsx +98 -0
- package/skills/yad-docs/templates/app/src/pages/SubPathDetailPage.tsx +282 -0
- package/skills/yad-docs/templates/app/src/store/useAuthStore.ts +42 -0
- package/skills/yad-docs/templates/app/src/store/useFlowStore.ts +197 -0
- package/skills/yad-docs/templates/app/src/utils/iconMap.ts +46 -0
- package/skills/yad-docs/templates/app/tsconfig.app.json +28 -0
- package/skills/yad-docs/templates/app/tsconfig.json +7 -0
- package/skills/yad-docs/templates/app/tsconfig.node.json +26 -0
- package/skills/yad-docs/templates/app/vite.config.ts +10 -0
- package/skills/yad-docs-overview/SKILL.md +131 -0
- package/skills/yad-docs-overview/references/pipeline-model.md +102 -0
- package/skills/yad-docs-sync/SKILL.md +99 -0
- package/skills/yad-docs-sync/references/staleness.md +81 -0
- package/skills/yad-hub-bridge/references/login-roster.md +1 -0
- package/docs/index.html +0 -1323
|
@@ -0,0 +1,2319 @@
|
|
|
1
|
+
import type { FlowPath, FlowStep } from "./types";
|
|
2
|
+
|
|
3
|
+
// Reusable step builders
|
|
4
|
+
const tripCreatedStep: FlowStep = {
|
|
5
|
+
id: "trip-created",
|
|
6
|
+
title: "Rider Requests Scheduled Trip",
|
|
7
|
+
description:
|
|
8
|
+
"Rider creates a new scheduled trip via the mobile app. Backend schedules a confirmation job in BullMQ.",
|
|
9
|
+
actor: "rider",
|
|
10
|
+
status: "PENDING",
|
|
11
|
+
bookingStatus: "BOOK_PENDING",
|
|
12
|
+
trigger: "Trip creation via POST /b2c/rider/trips",
|
|
13
|
+
handler: "scheduleBookingJobs.js",
|
|
14
|
+
activeComponents: ["rider-app", "backend-api", "bullmq", "database"],
|
|
15
|
+
messages: [
|
|
16
|
+
{
|
|
17
|
+
id: "tc-1",
|
|
18
|
+
from: "rider-app",
|
|
19
|
+
to: "backend-api",
|
|
20
|
+
label: 'POST /trips',
|
|
21
|
+
type: "request",
|
|
22
|
+
color: "#7b59e6",
|
|
23
|
+
delay: 0,
|
|
24
|
+
duration: 800,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "tc-2",
|
|
28
|
+
from: "backend-api",
|
|
29
|
+
to: "database",
|
|
30
|
+
label: "Create trip",
|
|
31
|
+
type: "request",
|
|
32
|
+
color: "#7b59e6",
|
|
33
|
+
delay: 900,
|
|
34
|
+
duration: 600,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "tc-3",
|
|
38
|
+
from: "backend-api",
|
|
39
|
+
to: "bullmq",
|
|
40
|
+
label: "Schedule rider confirmation job",
|
|
41
|
+
type: "job",
|
|
42
|
+
color: "#f59e0b",
|
|
43
|
+
delay: 1600,
|
|
44
|
+
duration: 700,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "tc-4",
|
|
48
|
+
from: "backend-api",
|
|
49
|
+
to: "rider-app",
|
|
50
|
+
label: "Trip created (PENDING)",
|
|
51
|
+
type: "response",
|
|
52
|
+
color: "#06b6d4",
|
|
53
|
+
delay: 2400,
|
|
54
|
+
duration: 800,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
sideEffects: {
|
|
58
|
+
jobs: "Schedule pre-trip-rider-confirmation (delay: booked_for - preBookingRiderConfirmationMinutes)",
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const riderConfirmationJobStep: FlowStep = {
|
|
63
|
+
id: "rider-confirmation-job",
|
|
64
|
+
title: "Pre-trip Rider Confirmation Job Fires",
|
|
65
|
+
description:
|
|
66
|
+
"BullMQ fires the pre-trip-rider-confirmation job. Backend updates booking status and sends push notification to rider.",
|
|
67
|
+
actor: "system",
|
|
68
|
+
status: "PENDING",
|
|
69
|
+
bookingStatus: "BOOK_RIDER_CONFIRMATION_PENDING",
|
|
70
|
+
trigger: "BullMQ pre-trip-rider-confirmation job fires",
|
|
71
|
+
handler: "processPreTripRiderConfirmation() in booking-jobs-worker.js",
|
|
72
|
+
activeComponents: ["bullmq", "backend-api", "rider-app", "database"],
|
|
73
|
+
messages: [
|
|
74
|
+
{
|
|
75
|
+
id: "rcj-1",
|
|
76
|
+
from: "bullmq",
|
|
77
|
+
to: "backend-api",
|
|
78
|
+
label: "pre-trip-rider-confirmation fires",
|
|
79
|
+
type: "job",
|
|
80
|
+
color: "#f59e0b",
|
|
81
|
+
delay: 0,
|
|
82
|
+
duration: 700,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "rcj-2",
|
|
86
|
+
from: "backend-api",
|
|
87
|
+
to: "database",
|
|
88
|
+
label: "Update booking_status",
|
|
89
|
+
type: "request",
|
|
90
|
+
color: "#7b59e6",
|
|
91
|
+
delay: 800,
|
|
92
|
+
duration: 600,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "rcj-3",
|
|
96
|
+
from: "backend-api",
|
|
97
|
+
to: "bullmq",
|
|
98
|
+
label: "Schedule rider-confirmation-timeout",
|
|
99
|
+
type: "job",
|
|
100
|
+
color: "#f59e0b",
|
|
101
|
+
delay: 1500,
|
|
102
|
+
duration: 700,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "rcj-4",
|
|
106
|
+
from: "backend-api",
|
|
107
|
+
to: "rider-app",
|
|
108
|
+
label: "Push: confirm booking",
|
|
109
|
+
type: "notification",
|
|
110
|
+
color: "#fb2576",
|
|
111
|
+
delay: 2300,
|
|
112
|
+
duration: 800,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
sideEffects: {
|
|
116
|
+
jobs: "Schedule rider-confirmation-timeout (delay: riderConfirmationTimeoutMinutes)",
|
|
117
|
+
notifications:
|
|
118
|
+
"Push to Rider — BOOKING_PRE_TRIP_RIDER_CONFIRMATION",
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const riderConfirmsStep: FlowStep = {
|
|
123
|
+
id: "rider-confirms",
|
|
124
|
+
title: "Rider Confirms",
|
|
125
|
+
description:
|
|
126
|
+
"Rider confirms the booking via the app. Confirmation timeout job is cleaned up.",
|
|
127
|
+
actor: "rider",
|
|
128
|
+
status: "BOOK_CONFIRMED",
|
|
129
|
+
bookingStatus: "BOOK_RIDER_CONFIRMED",
|
|
130
|
+
trigger:
|
|
131
|
+
"Rider PUT /b2c/rider/trips/:tripId/booking-status → BOOK_CONFIRMED",
|
|
132
|
+
handler: "booking-status-update.js",
|
|
133
|
+
activeComponents: ["rider-app", "backend-api", "bullmq", "database"],
|
|
134
|
+
messages: [
|
|
135
|
+
{
|
|
136
|
+
id: "rc-1",
|
|
137
|
+
from: "rider-app",
|
|
138
|
+
to: "backend-api",
|
|
139
|
+
label: "PUT booking-status: BOOK_CONFIRMED",
|
|
140
|
+
type: "request",
|
|
141
|
+
color: "#7b59e6",
|
|
142
|
+
delay: 0,
|
|
143
|
+
duration: 800,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "rc-2",
|
|
147
|
+
from: "backend-api",
|
|
148
|
+
to: "database",
|
|
149
|
+
label: "Update status + booking_status",
|
|
150
|
+
type: "request",
|
|
151
|
+
color: "#7b59e6",
|
|
152
|
+
delay: 900,
|
|
153
|
+
duration: 600,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "rc-3",
|
|
157
|
+
from: "backend-api",
|
|
158
|
+
to: "bullmq",
|
|
159
|
+
label: "Remove rider-confirmation-timeout",
|
|
160
|
+
type: "cleanup",
|
|
161
|
+
color: "#ef4444",
|
|
162
|
+
delay: 1600,
|
|
163
|
+
duration: 700,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "rc-4",
|
|
167
|
+
from: "backend-api",
|
|
168
|
+
to: "rider-app",
|
|
169
|
+
label: "Confirmed",
|
|
170
|
+
type: "response",
|
|
171
|
+
color: "#06b6d4",
|
|
172
|
+
delay: 2400,
|
|
173
|
+
duration: 800,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
sideEffects: {
|
|
177
|
+
jobs: "Cleanup rider-confirmation-timeout job",
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const opsAssignsDriverStep: FlowStep = {
|
|
182
|
+
id: "ops-assigns-driver",
|
|
183
|
+
title: "Ops Assigns Driver",
|
|
184
|
+
description:
|
|
185
|
+
"Operations team assigns a driver to the trip. Driver receives notification and DAC card is created.",
|
|
186
|
+
actor: "ops",
|
|
187
|
+
status: "BOOK_ASSIGNED",
|
|
188
|
+
bookingStatus: "BOOK_RIDER_CONFIRMED",
|
|
189
|
+
trigger:
|
|
190
|
+
"Ops PUT /trips/:tripId/status → BOOK_ASSIGNED + internal-access-key",
|
|
191
|
+
handler: "fnUpdateBookingStatus",
|
|
192
|
+
activeComponents: [
|
|
193
|
+
"ops-dashboard",
|
|
194
|
+
"backend-api",
|
|
195
|
+
"bullmq",
|
|
196
|
+
"driver-app",
|
|
197
|
+
"dac",
|
|
198
|
+
"pubsub",
|
|
199
|
+
"database",
|
|
200
|
+
],
|
|
201
|
+
messages: [
|
|
202
|
+
{
|
|
203
|
+
id: "oad-1",
|
|
204
|
+
from: "ops-dashboard",
|
|
205
|
+
to: "backend-api",
|
|
206
|
+
label: "PUT status: BOOK_ASSIGNED + driver info",
|
|
207
|
+
type: "request",
|
|
208
|
+
color: "#7b59e6",
|
|
209
|
+
delay: 0,
|
|
210
|
+
duration: 800,
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: "oad-2",
|
|
214
|
+
from: "backend-api",
|
|
215
|
+
to: "database",
|
|
216
|
+
label: "Update status, assign driver",
|
|
217
|
+
type: "request",
|
|
218
|
+
color: "#7b59e6",
|
|
219
|
+
delay: 900,
|
|
220
|
+
duration: 600,
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: "oad-3",
|
|
224
|
+
from: "backend-api",
|
|
225
|
+
to: "bullmq",
|
|
226
|
+
label: "Cleanup old driver jobs",
|
|
227
|
+
type: "cleanup",
|
|
228
|
+
color: "#ef4444",
|
|
229
|
+
delay: 1600,
|
|
230
|
+
duration: 500,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
id: "oad-4",
|
|
234
|
+
from: "backend-api",
|
|
235
|
+
to: "bullmq",
|
|
236
|
+
label: "Schedule pre-trip-driver-confirmation",
|
|
237
|
+
type: "job",
|
|
238
|
+
color: "#f59e0b",
|
|
239
|
+
delay: 2200,
|
|
240
|
+
duration: 700,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
id: "oad-5",
|
|
244
|
+
from: "backend-api",
|
|
245
|
+
to: "driver-app",
|
|
246
|
+
label: "Push: driver assignment",
|
|
247
|
+
type: "notification",
|
|
248
|
+
color: "#fb2576",
|
|
249
|
+
delay: 3000,
|
|
250
|
+
duration: 800,
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: "oad-6",
|
|
254
|
+
from: "backend-api",
|
|
255
|
+
to: "dac",
|
|
256
|
+
label: "Publish scheduled ride DAC",
|
|
257
|
+
type: "event",
|
|
258
|
+
color: "#10b981",
|
|
259
|
+
delay: 3900,
|
|
260
|
+
duration: 700,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: "oad-7",
|
|
264
|
+
from: "backend-api",
|
|
265
|
+
to: "pubsub",
|
|
266
|
+
label: "Ride dispatch: BOOK_ASSIGNED",
|
|
267
|
+
type: "event",
|
|
268
|
+
color: "#10b981",
|
|
269
|
+
delay: 4700,
|
|
270
|
+
duration: 700,
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
sideEffects: {
|
|
274
|
+
jobs: "cleanupDriverBookingJobs() + Schedule pre-trip-driver-confirmation",
|
|
275
|
+
notifications: "Booking-specific driver assignment notification",
|
|
276
|
+
dac: "publishScheduledRideAction()",
|
|
277
|
+
pubsub: "RIDE_STATUS_UPDATES_TOPIC: BOOK_ASSIGNED",
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const driverConfirmationJobStep: FlowStep = {
|
|
282
|
+
id: "driver-confirmation-job",
|
|
283
|
+
title: "Pre-trip Driver Confirmation Job Fires",
|
|
284
|
+
description:
|
|
285
|
+
"BullMQ fires the pre-trip-driver-confirmation job. Backend sends push notification asking driver to confirm.",
|
|
286
|
+
actor: "system",
|
|
287
|
+
status: "BOOK_ASSIGNED",
|
|
288
|
+
bookingStatus: "BOOK_DRIVER_CONFIRMATION_PENDING",
|
|
289
|
+
trigger: "BullMQ pre-trip-driver-confirmation job fires",
|
|
290
|
+
handler: "processPreTripDriverConfirmation() in booking-jobs-worker.js",
|
|
291
|
+
activeComponents: ["bullmq", "backend-api", "driver-app", "database"],
|
|
292
|
+
messages: [
|
|
293
|
+
{
|
|
294
|
+
id: "dcj-1",
|
|
295
|
+
from: "bullmq",
|
|
296
|
+
to: "backend-api",
|
|
297
|
+
label: "pre-trip-driver-confirmation fires",
|
|
298
|
+
type: "job",
|
|
299
|
+
color: "#f59e0b",
|
|
300
|
+
delay: 0,
|
|
301
|
+
duration: 700,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "dcj-2",
|
|
305
|
+
from: "backend-api",
|
|
306
|
+
to: "database",
|
|
307
|
+
label: "Update booking_status",
|
|
308
|
+
type: "request",
|
|
309
|
+
color: "#7b59e6",
|
|
310
|
+
delay: 800,
|
|
311
|
+
duration: 600,
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
id: "dcj-3",
|
|
315
|
+
from: "backend-api",
|
|
316
|
+
to: "bullmq",
|
|
317
|
+
label: "Schedule driver-confirmation-timeout",
|
|
318
|
+
type: "job",
|
|
319
|
+
color: "#f59e0b",
|
|
320
|
+
delay: 1500,
|
|
321
|
+
duration: 700,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "dcj-4",
|
|
325
|
+
from: "backend-api",
|
|
326
|
+
to: "driver-app",
|
|
327
|
+
label: "Push: confirm driver booking",
|
|
328
|
+
type: "notification",
|
|
329
|
+
color: "#fb2576",
|
|
330
|
+
delay: 2300,
|
|
331
|
+
duration: 800,
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
sideEffects: {
|
|
335
|
+
jobs: "Schedule driver-confirmation-timeout",
|
|
336
|
+
notifications:
|
|
337
|
+
"Push to Driver — BOOKING_PRE_TRIP_DRIVER_CONFIRMATION",
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const driverConfirmsStep: FlowStep = {
|
|
342
|
+
id: "driver-confirms",
|
|
343
|
+
title: "Driver Confirms",
|
|
344
|
+
description:
|
|
345
|
+
"Driver accepts the booking. Rider is notified that driver is on the way.",
|
|
346
|
+
actor: "driver",
|
|
347
|
+
status: "BOOK_ACCEPTED",
|
|
348
|
+
bookingStatus: "BOOK_DRIVER_CONFIRMED",
|
|
349
|
+
trigger:
|
|
350
|
+
"Driver PUT /b2c/driver/trips/:tripId/booking-status → BOOK_ACCEPTED",
|
|
351
|
+
handler: "driver-booking-status-update.js",
|
|
352
|
+
activeComponents: [
|
|
353
|
+
"driver-app",
|
|
354
|
+
"backend-api",
|
|
355
|
+
"bullmq",
|
|
356
|
+
"rider-app",
|
|
357
|
+
"pubsub",
|
|
358
|
+
"database",
|
|
359
|
+
],
|
|
360
|
+
messages: [
|
|
361
|
+
{
|
|
362
|
+
id: "dc-1",
|
|
363
|
+
from: "driver-app",
|
|
364
|
+
to: "backend-api",
|
|
365
|
+
label: "PUT booking-status: BOOK_ACCEPTED",
|
|
366
|
+
type: "request",
|
|
367
|
+
color: "#7b59e6",
|
|
368
|
+
delay: 0,
|
|
369
|
+
duration: 800,
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: "dc-2",
|
|
373
|
+
from: "backend-api",
|
|
374
|
+
to: "database",
|
|
375
|
+
label: "Update status + booking_status",
|
|
376
|
+
type: "request",
|
|
377
|
+
color: "#7b59e6",
|
|
378
|
+
delay: 900,
|
|
379
|
+
duration: 600,
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
id: "dc-3",
|
|
383
|
+
from: "backend-api",
|
|
384
|
+
to: "bullmq",
|
|
385
|
+
label: "Remove driver-confirmation-timeout",
|
|
386
|
+
type: "cleanup",
|
|
387
|
+
color: "#ef4444",
|
|
388
|
+
delay: 1600,
|
|
389
|
+
duration: 700,
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
id: "dc-4",
|
|
393
|
+
from: "backend-api",
|
|
394
|
+
to: "rider-app",
|
|
395
|
+
label: "Push: driver accepted",
|
|
396
|
+
type: "notification",
|
|
397
|
+
color: "#fb2576",
|
|
398
|
+
delay: 2400,
|
|
399
|
+
duration: 800,
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
id: "dc-5",
|
|
403
|
+
from: "backend-api",
|
|
404
|
+
to: "pubsub",
|
|
405
|
+
label: "Ride dispatch: BOOK_ACCEPTED",
|
|
406
|
+
type: "event",
|
|
407
|
+
color: "#10b981",
|
|
408
|
+
delay: 3300,
|
|
409
|
+
duration: 700,
|
|
410
|
+
},
|
|
411
|
+
],
|
|
412
|
+
sideEffects: {
|
|
413
|
+
jobs: "Cleanup driver-confirmation-timeout",
|
|
414
|
+
notifications: "Push to Rider — driver accepted",
|
|
415
|
+
pubsub: "RIDE_STATUS_UPDATES_TOPIC: BOOK_ACCEPTED",
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
const tripCompletionStep: FlowStep = {
|
|
420
|
+
id: "trip-completion",
|
|
421
|
+
title: "Trip Progresses to Completion",
|
|
422
|
+
description:
|
|
423
|
+
"Trip progresses through DRIVER_ARRIVED → STARTED → FINISHED. DAC card is deleted.",
|
|
424
|
+
actor: "driver",
|
|
425
|
+
status: "FINISHED",
|
|
426
|
+
bookingStatus: "BOOK_FINISHED",
|
|
427
|
+
trigger:
|
|
428
|
+
"Driver/system updates via /trips/:tripId/status (DRIVER_ARRIVED → STARTED → FINISHED)",
|
|
429
|
+
handler: "TRIP_UPDATE_MWS + fnUpdateBookingStatus",
|
|
430
|
+
activeComponents: [
|
|
431
|
+
"driver-app",
|
|
432
|
+
"backend-api",
|
|
433
|
+
"dac",
|
|
434
|
+
"pubsub",
|
|
435
|
+
"database",
|
|
436
|
+
],
|
|
437
|
+
messages: [
|
|
438
|
+
{
|
|
439
|
+
id: "tc2-1",
|
|
440
|
+
from: "driver-app",
|
|
441
|
+
to: "backend-api",
|
|
442
|
+
label: "DRIVER_ARRIVED → STARTED → FINISHED",
|
|
443
|
+
type: "request",
|
|
444
|
+
color: "#7b59e6",
|
|
445
|
+
delay: 0,
|
|
446
|
+
duration: 800,
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
id: "tc2-2",
|
|
450
|
+
from: "backend-api",
|
|
451
|
+
to: "database",
|
|
452
|
+
label: "Update trip status + BOOK_FINISHED",
|
|
453
|
+
type: "request",
|
|
454
|
+
color: "#7b59e6",
|
|
455
|
+
delay: 900,
|
|
456
|
+
duration: 600,
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
id: "tc2-3",
|
|
460
|
+
from: "backend-api",
|
|
461
|
+
to: "dac",
|
|
462
|
+
label: "Delete scheduled ride DAC",
|
|
463
|
+
type: "cleanup",
|
|
464
|
+
color: "#ef4444",
|
|
465
|
+
delay: 1600,
|
|
466
|
+
duration: 700,
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
id: "tc2-4",
|
|
470
|
+
from: "backend-api",
|
|
471
|
+
to: "pubsub",
|
|
472
|
+
label: "Trip status events",
|
|
473
|
+
type: "event",
|
|
474
|
+
color: "#10b981",
|
|
475
|
+
delay: 2400,
|
|
476
|
+
duration: 700,
|
|
477
|
+
},
|
|
478
|
+
],
|
|
479
|
+
sideEffects: {
|
|
480
|
+
dac: "fnDeleteScheduledRideDac on STARTED/FINISHED",
|
|
481
|
+
pubsub: "Normal trip status events",
|
|
482
|
+
},
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
const riderCancelsStep = (
|
|
486
|
+
stepId: string,
|
|
487
|
+
_fromState: string,
|
|
488
|
+
hasDriver: boolean
|
|
489
|
+
): FlowStep => ({
|
|
490
|
+
id: stepId,
|
|
491
|
+
title: "Rider Cancels",
|
|
492
|
+
description: hasDriver
|
|
493
|
+
? "Rider cancels the trip after a driver has been assigned. Driver is notified and DAC is cleaned up."
|
|
494
|
+
: "Rider cancels the trip. All pending jobs are cleaned up.",
|
|
495
|
+
actor: "rider",
|
|
496
|
+
status: "RIDER_CANCELED",
|
|
497
|
+
bookingStatus: "BOOK_RIDER_CANCELED",
|
|
498
|
+
trigger:
|
|
499
|
+
"Rider PUT /b2c/rider/trips/:tripId/booking-status → RIDER_CANCELED",
|
|
500
|
+
handler: "booking-status-update.js",
|
|
501
|
+
activeComponents: [
|
|
502
|
+
"rider-app",
|
|
503
|
+
"backend-api",
|
|
504
|
+
"bullmq",
|
|
505
|
+
...(hasDriver ? ["driver-app", "dac"] : []),
|
|
506
|
+
"database",
|
|
507
|
+
],
|
|
508
|
+
messages: [
|
|
509
|
+
{
|
|
510
|
+
id: `${stepId}-1`,
|
|
511
|
+
from: "rider-app",
|
|
512
|
+
to: "backend-api",
|
|
513
|
+
label: "PUT booking-status: RIDER_CANCELED",
|
|
514
|
+
type: "request",
|
|
515
|
+
color: "#7b59e6",
|
|
516
|
+
delay: 0,
|
|
517
|
+
duration: 800,
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
id: `${stepId}-2`,
|
|
521
|
+
from: "backend-api",
|
|
522
|
+
to: "database",
|
|
523
|
+
label: "Update status + cancel_date_time",
|
|
524
|
+
type: "request",
|
|
525
|
+
color: "#7b59e6",
|
|
526
|
+
delay: 900,
|
|
527
|
+
duration: 600,
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
id: `${stepId}-3`,
|
|
531
|
+
from: "backend-api",
|
|
532
|
+
to: "bullmq",
|
|
533
|
+
label: "Cleanup all booking jobs",
|
|
534
|
+
type: "cleanup",
|
|
535
|
+
color: "#ef4444",
|
|
536
|
+
delay: 1600,
|
|
537
|
+
duration: 700,
|
|
538
|
+
},
|
|
539
|
+
...(hasDriver
|
|
540
|
+
? [
|
|
541
|
+
{
|
|
542
|
+
id: `${stepId}-4`,
|
|
543
|
+
from: "backend-api",
|
|
544
|
+
to: "driver-app",
|
|
545
|
+
label: "Push: booking_canceled_by_rider",
|
|
546
|
+
type: "notification" as const,
|
|
547
|
+
color: "#fb2576",
|
|
548
|
+
delay: 2400,
|
|
549
|
+
duration: 800,
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
id: `${stepId}-5`,
|
|
553
|
+
from: "backend-api",
|
|
554
|
+
to: "dac",
|
|
555
|
+
label: "Delete scheduled ride DAC",
|
|
556
|
+
type: "cleanup" as const,
|
|
557
|
+
color: "#ef4444",
|
|
558
|
+
delay: 3300,
|
|
559
|
+
duration: 700,
|
|
560
|
+
},
|
|
561
|
+
]
|
|
562
|
+
: []),
|
|
563
|
+
],
|
|
564
|
+
sideEffects: {
|
|
565
|
+
jobs: "cleanupBookingJobs()",
|
|
566
|
+
...(hasDriver
|
|
567
|
+
? {
|
|
568
|
+
notifications:
|
|
569
|
+
"Push to Driver — BOOKING_RIDER_CANCELED_DRIVER_NOTIFICATION",
|
|
570
|
+
dac: "deleteScheduledRideAction()",
|
|
571
|
+
}
|
|
572
|
+
: {}),
|
|
573
|
+
},
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
// Condensed setup step for paths that skip through early phases
|
|
577
|
+
const condensedSetupStep: FlowStep = {
|
|
578
|
+
id: "condensed-setup",
|
|
579
|
+
title: "Trip Created → Rider Confirmed → Driver Assigned",
|
|
580
|
+
description:
|
|
581
|
+
"Condensed: Trip is created, rider confirms, and ops assigns a driver.",
|
|
582
|
+
actor: "system",
|
|
583
|
+
status: "BOOK_ASSIGNED",
|
|
584
|
+
bookingStatus: "BOOK_RIDER_CONFIRMED",
|
|
585
|
+
trigger: "Setup phase (condensed)",
|
|
586
|
+
handler: "Various handlers",
|
|
587
|
+
activeComponents: [
|
|
588
|
+
"rider-app",
|
|
589
|
+
"backend-api",
|
|
590
|
+
"bullmq",
|
|
591
|
+
"ops-dashboard",
|
|
592
|
+
"driver-app",
|
|
593
|
+
"dac",
|
|
594
|
+
"pubsub",
|
|
595
|
+
"database",
|
|
596
|
+
],
|
|
597
|
+
messages: [
|
|
598
|
+
{
|
|
599
|
+
id: "cs-1",
|
|
600
|
+
from: "rider-app",
|
|
601
|
+
to: "backend-api",
|
|
602
|
+
label: "POST /trips → Confirm → Assign",
|
|
603
|
+
type: "request",
|
|
604
|
+
color: "#7b59e6",
|
|
605
|
+
delay: 0,
|
|
606
|
+
duration: 800,
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
id: "cs-2",
|
|
610
|
+
from: "backend-api",
|
|
611
|
+
to: "database",
|
|
612
|
+
label: "Create & update trip",
|
|
613
|
+
type: "request",
|
|
614
|
+
color: "#7b59e6",
|
|
615
|
+
delay: 900,
|
|
616
|
+
duration: 600,
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
id: "cs-3",
|
|
620
|
+
from: "ops-dashboard",
|
|
621
|
+
to: "backend-api",
|
|
622
|
+
label: "Assign driver",
|
|
623
|
+
type: "request",
|
|
624
|
+
color: "#7b59e6",
|
|
625
|
+
delay: 1600,
|
|
626
|
+
duration: 800,
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
id: "cs-4",
|
|
630
|
+
from: "backend-api",
|
|
631
|
+
to: "driver-app",
|
|
632
|
+
label: "Push: driver assignment",
|
|
633
|
+
type: "notification",
|
|
634
|
+
color: "#fb2576",
|
|
635
|
+
delay: 2500,
|
|
636
|
+
duration: 800,
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
id: "cs-5",
|
|
640
|
+
from: "backend-api",
|
|
641
|
+
to: "dac",
|
|
642
|
+
label: "Create DAC card",
|
|
643
|
+
type: "event",
|
|
644
|
+
color: "#10b981",
|
|
645
|
+
delay: 3400,
|
|
646
|
+
duration: 700,
|
|
647
|
+
},
|
|
648
|
+
],
|
|
649
|
+
sideEffects: {
|
|
650
|
+
jobs: "Schedule pre-trip-driver-confirmation",
|
|
651
|
+
notifications: "Driver assignment notification",
|
|
652
|
+
dac: "publishScheduledRideAction()",
|
|
653
|
+
pubsub: "RIDE_STATUS_UPDATES_TOPIC: BOOK_ASSIGNED",
|
|
654
|
+
},
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
export const PATHS: FlowPath[] = [
|
|
658
|
+
// Path 1: Happy Path
|
|
659
|
+
{
|
|
660
|
+
id: 1,
|
|
661
|
+
label: "Happy Path",
|
|
662
|
+
icon: "✅",
|
|
663
|
+
color: "#10b981",
|
|
664
|
+
description:
|
|
665
|
+
"PENDING → BOOK_CONFIRMED → BOOK_ASSIGNED → BOOK_ACCEPTED → FINISHED",
|
|
666
|
+
category: "success",
|
|
667
|
+
steps: [
|
|
668
|
+
tripCreatedStep,
|
|
669
|
+
riderConfirmationJobStep,
|
|
670
|
+
riderConfirmsStep,
|
|
671
|
+
opsAssignsDriverStep,
|
|
672
|
+
driverConfirmationJobStep,
|
|
673
|
+
driverConfirmsStep,
|
|
674
|
+
tripCompletionStep,
|
|
675
|
+
],
|
|
676
|
+
},
|
|
677
|
+
|
|
678
|
+
// Path 2: Rider Cancels Early
|
|
679
|
+
{
|
|
680
|
+
id: 2,
|
|
681
|
+
label: "Rider Cancels Early",
|
|
682
|
+
icon: "🚫",
|
|
683
|
+
color: "#ef4444",
|
|
684
|
+
description: "PENDING → RIDER_CANCELED",
|
|
685
|
+
category: "rider-cancel",
|
|
686
|
+
steps: [
|
|
687
|
+
{ ...tripCreatedStep, id: "p2-trip-created" },
|
|
688
|
+
riderCancelsStep("p2-rider-cancels", "PENDING", false),
|
|
689
|
+
],
|
|
690
|
+
},
|
|
691
|
+
|
|
692
|
+
// Path 3: Rider Timeout → System Cancel
|
|
693
|
+
{
|
|
694
|
+
id: 3,
|
|
695
|
+
label: "Rider Timeout → System Cancel",
|
|
696
|
+
icon: "⏰",
|
|
697
|
+
color: "#f59e0b",
|
|
698
|
+
description:
|
|
699
|
+
"PENDING → BOOK_RIDER_CONFIRMATION_PENDING → RIDER_CANCELED (System)",
|
|
700
|
+
category: "timeout",
|
|
701
|
+
steps: [
|
|
702
|
+
{ ...tripCreatedStep, id: "p3-trip-created" },
|
|
703
|
+
{ ...riderConfirmationJobStep, id: "p3-rider-conf-job" },
|
|
704
|
+
{
|
|
705
|
+
id: "p3-rider-timeout",
|
|
706
|
+
title: "Rider Confirmation Timeout Fires",
|
|
707
|
+
description:
|
|
708
|
+
"Rider did not confirm in time. Ops team is alerted with HIGH priority and given a window to intervene.",
|
|
709
|
+
actor: "system",
|
|
710
|
+
status: "PENDING",
|
|
711
|
+
bookingStatus: "BOOK_OPERATION_RIDER_CONFIRMATION_PENDING",
|
|
712
|
+
trigger: "BullMQ rider-confirmation-timeout job fires",
|
|
713
|
+
handler:
|
|
714
|
+
"processRiderConfirmationTimeout() in booking-jobs-worker.js",
|
|
715
|
+
activeComponents: [
|
|
716
|
+
"bullmq",
|
|
717
|
+
"backend-api",
|
|
718
|
+
"rider-app",
|
|
719
|
+
"ops-dashboard",
|
|
720
|
+
"database",
|
|
721
|
+
],
|
|
722
|
+
messages: [
|
|
723
|
+
{
|
|
724
|
+
id: "p3rt-1",
|
|
725
|
+
from: "bullmq",
|
|
726
|
+
to: "backend-api",
|
|
727
|
+
label: "rider-confirmation-timeout fires",
|
|
728
|
+
type: "job",
|
|
729
|
+
color: "#f59e0b",
|
|
730
|
+
delay: 0,
|
|
731
|
+
duration: 700,
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
id: "p3rt-2",
|
|
735
|
+
from: "backend-api",
|
|
736
|
+
to: "database",
|
|
737
|
+
label: "Update booking_status",
|
|
738
|
+
type: "request",
|
|
739
|
+
color: "#7b59e6",
|
|
740
|
+
delay: 800,
|
|
741
|
+
duration: 600,
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
id: "p3rt-3",
|
|
745
|
+
from: "backend-api",
|
|
746
|
+
to: "bullmq",
|
|
747
|
+
label: "Schedule ops-rider-confirmation-window-timeout",
|
|
748
|
+
type: "job",
|
|
749
|
+
color: "#f59e0b",
|
|
750
|
+
delay: 1500,
|
|
751
|
+
duration: 700,
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
id: "p3rt-4",
|
|
755
|
+
from: "backend-api",
|
|
756
|
+
to: "rider-app",
|
|
757
|
+
label: "Push: booking_timeout",
|
|
758
|
+
type: "notification",
|
|
759
|
+
color: "#fb2576",
|
|
760
|
+
delay: 2300,
|
|
761
|
+
duration: 800,
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
id: "p3rt-5",
|
|
765
|
+
from: "backend-api",
|
|
766
|
+
to: "ops-dashboard",
|
|
767
|
+
label: "HIGH: booking_rider_confirmation_timeout",
|
|
768
|
+
type: "event",
|
|
769
|
+
color: "#10b981",
|
|
770
|
+
delay: 3200,
|
|
771
|
+
duration: 800,
|
|
772
|
+
},
|
|
773
|
+
],
|
|
774
|
+
sideEffects: {
|
|
775
|
+
jobs: "Schedule ops-rider-confirmation-window-timeout",
|
|
776
|
+
notifications:
|
|
777
|
+
"Push to Rider + Dashboard alert (high priority)",
|
|
778
|
+
},
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
id: "p3-ops-window-timeout",
|
|
782
|
+
title: "Ops Window Timeout → System Cancel",
|
|
783
|
+
description:
|
|
784
|
+
"Ops window expired without intervention. System auto-cancels the trip.",
|
|
785
|
+
actor: "system",
|
|
786
|
+
status: "RIDER_CANCELED",
|
|
787
|
+
bookingStatus: "BOOK_SYSTEM_CANCELED",
|
|
788
|
+
trigger:
|
|
789
|
+
"BullMQ ops-rider-confirmation-window-timeout job fires",
|
|
790
|
+
handler:
|
|
791
|
+
"processOpsConfirmationWindowTimeout() in booking-jobs-worker.js",
|
|
792
|
+
activeComponents: [
|
|
793
|
+
"bullmq",
|
|
794
|
+
"backend-api",
|
|
795
|
+
"rider-app",
|
|
796
|
+
"ops-dashboard",
|
|
797
|
+
"database",
|
|
798
|
+
],
|
|
799
|
+
messages: [
|
|
800
|
+
{
|
|
801
|
+
id: "p3owt-1",
|
|
802
|
+
from: "bullmq",
|
|
803
|
+
to: "backend-api",
|
|
804
|
+
label: "ops-rider-confirmation-window-timeout fires",
|
|
805
|
+
type: "job",
|
|
806
|
+
color: "#f59e0b",
|
|
807
|
+
delay: 0,
|
|
808
|
+
duration: 700,
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
id: "p3owt-2",
|
|
812
|
+
from: "backend-api",
|
|
813
|
+
to: "database",
|
|
814
|
+
label: "RIDER_CANCELED + BOOK_SYSTEM_CANCELED",
|
|
815
|
+
type: "request",
|
|
816
|
+
color: "#7b59e6",
|
|
817
|
+
delay: 800,
|
|
818
|
+
duration: 600,
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
id: "p3owt-3",
|
|
822
|
+
from: "backend-api",
|
|
823
|
+
to: "rider-app",
|
|
824
|
+
label: "Push: booking_cancelled",
|
|
825
|
+
type: "notification",
|
|
826
|
+
color: "#fb2576",
|
|
827
|
+
delay: 1500,
|
|
828
|
+
duration: 800,
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
id: "p3owt-4",
|
|
832
|
+
from: "backend-api",
|
|
833
|
+
to: "ops-dashboard",
|
|
834
|
+
label: "booking_ops_confirmation_window_timeout",
|
|
835
|
+
type: "event",
|
|
836
|
+
color: "#10b981",
|
|
837
|
+
delay: 2400,
|
|
838
|
+
duration: 800,
|
|
839
|
+
},
|
|
840
|
+
],
|
|
841
|
+
sideEffects: {
|
|
842
|
+
notifications: "Push to Rider + Dashboard alert",
|
|
843
|
+
},
|
|
844
|
+
},
|
|
845
|
+
],
|
|
846
|
+
},
|
|
847
|
+
|
|
848
|
+
// Path 4: Rider Cancels During Confirmation Pending
|
|
849
|
+
{
|
|
850
|
+
id: 4,
|
|
851
|
+
label: "Rider Cancels During Confirmation",
|
|
852
|
+
icon: "🚫",
|
|
853
|
+
color: "#ef4444",
|
|
854
|
+
description:
|
|
855
|
+
"PENDING → BOOK_RIDER_CONFIRMATION_PENDING → RIDER_CANCELED",
|
|
856
|
+
category: "rider-cancel",
|
|
857
|
+
steps: [
|
|
858
|
+
{ ...tripCreatedStep, id: "p4-trip-created" },
|
|
859
|
+
{ ...riderConfirmationJobStep, id: "p4-rider-conf-job" },
|
|
860
|
+
riderCancelsStep("p4-rider-cancels", "BOOK_RIDER_CONFIRMATION_PENDING", false),
|
|
861
|
+
],
|
|
862
|
+
},
|
|
863
|
+
|
|
864
|
+
// Path 5: Rider Cancels After Confirming
|
|
865
|
+
{
|
|
866
|
+
id: 5,
|
|
867
|
+
label: "Rider Cancels After Confirming",
|
|
868
|
+
icon: "🚫",
|
|
869
|
+
color: "#ef4444",
|
|
870
|
+
description: "PENDING → BOOK_CONFIRMED → RIDER_CANCELED",
|
|
871
|
+
category: "rider-cancel",
|
|
872
|
+
steps: [
|
|
873
|
+
{ ...tripCreatedStep, id: "p5-trip-created" },
|
|
874
|
+
{ ...riderConfirmationJobStep, id: "p5-rider-conf-job" },
|
|
875
|
+
{ ...riderConfirmsStep, id: "p5-rider-confirms" },
|
|
876
|
+
riderCancelsStep("p5-rider-cancels", "BOOK_RIDER_CONFIRMED", false),
|
|
877
|
+
],
|
|
878
|
+
},
|
|
879
|
+
|
|
880
|
+
// Path 6: Rider Cancels After Driver Assignment
|
|
881
|
+
{
|
|
882
|
+
id: 6,
|
|
883
|
+
label: "Rider Cancels After Assignment",
|
|
884
|
+
icon: "🚫",
|
|
885
|
+
color: "#ef4444",
|
|
886
|
+
description: "PENDING → BOOK_CONFIRMED → BOOK_ASSIGNED → RIDER_CANCELED",
|
|
887
|
+
category: "rider-cancel",
|
|
888
|
+
steps: [
|
|
889
|
+
{ ...tripCreatedStep, id: "p6-trip-created" },
|
|
890
|
+
{ ...riderConfirmationJobStep, id: "p6-rider-conf-job" },
|
|
891
|
+
{ ...riderConfirmsStep, id: "p6-rider-confirms" },
|
|
892
|
+
{ ...opsAssignsDriverStep, id: "p6-ops-assigns" },
|
|
893
|
+
{
|
|
894
|
+
id: "p6-rider-cancels-after-assign",
|
|
895
|
+
title: "Rider Cancels After Assignment",
|
|
896
|
+
description:
|
|
897
|
+
"Rider cancels the trip after a driver has been assigned. All jobs are cleaned up and driver is notified.",
|
|
898
|
+
actor: "rider",
|
|
899
|
+
status: "RIDER_CANCELED",
|
|
900
|
+
bookingStatus: "BOOK_RIDER_CANCELED",
|
|
901
|
+
trigger:
|
|
902
|
+
"Via /b2c/rider/trips/:tripId/booking-status or /trips/:tripId/status",
|
|
903
|
+
handler: "booking-status-update.js / fnUpdateBookingStatus",
|
|
904
|
+
activeComponents: [
|
|
905
|
+
"rider-app",
|
|
906
|
+
"backend-api",
|
|
907
|
+
"bullmq",
|
|
908
|
+
"driver-app",
|
|
909
|
+
"dac",
|
|
910
|
+
"pubsub",
|
|
911
|
+
"database",
|
|
912
|
+
],
|
|
913
|
+
messages: [
|
|
914
|
+
{
|
|
915
|
+
id: "p6rc-1",
|
|
916
|
+
from: "rider-app",
|
|
917
|
+
to: "backend-api",
|
|
918
|
+
label: "PUT booking-status: RIDER_CANCELED",
|
|
919
|
+
type: "request",
|
|
920
|
+
color: "#7b59e6",
|
|
921
|
+
delay: 0,
|
|
922
|
+
duration: 800,
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
id: "p6rc-2",
|
|
926
|
+
from: "backend-api",
|
|
927
|
+
to: "database",
|
|
928
|
+
label: "Update status + cancel_date_time",
|
|
929
|
+
type: "request",
|
|
930
|
+
color: "#7b59e6",
|
|
931
|
+
delay: 900,
|
|
932
|
+
duration: 600,
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
id: "p6rc-3",
|
|
936
|
+
from: "backend-api",
|
|
937
|
+
to: "bullmq",
|
|
938
|
+
label: "Cleanup all rider + driver jobs",
|
|
939
|
+
type: "cleanup",
|
|
940
|
+
color: "#ef4444",
|
|
941
|
+
delay: 1600,
|
|
942
|
+
duration: 700,
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
id: "p6rc-4",
|
|
946
|
+
from: "backend-api",
|
|
947
|
+
to: "driver-app",
|
|
948
|
+
label: "Push: booking_canceled_by_rider",
|
|
949
|
+
type: "notification",
|
|
950
|
+
color: "#fb2576",
|
|
951
|
+
delay: 2400,
|
|
952
|
+
duration: 800,
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
id: "p6rc-5",
|
|
956
|
+
from: "backend-api",
|
|
957
|
+
to: "dac",
|
|
958
|
+
label: "Delete scheduled ride DAC",
|
|
959
|
+
type: "cleanup",
|
|
960
|
+
color: "#ef4444",
|
|
961
|
+
delay: 3300,
|
|
962
|
+
duration: 700,
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
id: "p6rc-6",
|
|
966
|
+
from: "backend-api",
|
|
967
|
+
to: "pubsub",
|
|
968
|
+
label: "Trip status update",
|
|
969
|
+
type: "event",
|
|
970
|
+
color: "#10b981",
|
|
971
|
+
delay: 4100,
|
|
972
|
+
duration: 700,
|
|
973
|
+
},
|
|
974
|
+
],
|
|
975
|
+
sideEffects: {
|
|
976
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
977
|
+
notifications:
|
|
978
|
+
"Push to Driver — BOOKING_RIDER_CANCELED_DRIVER_NOTIFICATION",
|
|
979
|
+
dac: "deleteScheduledRideAction()",
|
|
980
|
+
pubsub: "Trip status update",
|
|
981
|
+
},
|
|
982
|
+
},
|
|
983
|
+
],
|
|
984
|
+
},
|
|
985
|
+
|
|
986
|
+
// Path 7: Driver Cancels
|
|
987
|
+
{
|
|
988
|
+
id: 7,
|
|
989
|
+
label: "Driver Cancels",
|
|
990
|
+
icon: "🚗",
|
|
991
|
+
color: "#8b5cf6",
|
|
992
|
+
description:
|
|
993
|
+
"BOOK_ASSIGNED → BOOK_DRIVER_CONFIRMATION_PENDING → DRIVER_CANCELED",
|
|
994
|
+
category: "driver-cancel",
|
|
995
|
+
steps: [
|
|
996
|
+
{ ...condensedSetupStep, id: "p7-setup" },
|
|
997
|
+
{ ...driverConfirmationJobStep, id: "p7-driver-conf-job" },
|
|
998
|
+
{
|
|
999
|
+
id: "p7-driver-cancels",
|
|
1000
|
+
title: "Driver Cancels",
|
|
1001
|
+
description:
|
|
1002
|
+
"Driver declines the booking. DAC is deleted and dispatch event is published.",
|
|
1003
|
+
actor: "driver",
|
|
1004
|
+
status: "DRIVER_CANCELED",
|
|
1005
|
+
bookingStatus: "BOOK_DRIVER_CANCELED",
|
|
1006
|
+
trigger:
|
|
1007
|
+
"Driver PUT /b2c/driver/trips/:tripId/booking-status → BOOK_DRIVER_CANCELED",
|
|
1008
|
+
handler: "driver-booking-status-update.js",
|
|
1009
|
+
activeComponents: [
|
|
1010
|
+
"driver-app",
|
|
1011
|
+
"backend-api",
|
|
1012
|
+
"bullmq",
|
|
1013
|
+
"dac",
|
|
1014
|
+
"pubsub",
|
|
1015
|
+
"database",
|
|
1016
|
+
],
|
|
1017
|
+
messages: [
|
|
1018
|
+
{
|
|
1019
|
+
id: "p7dc-1",
|
|
1020
|
+
from: "driver-app",
|
|
1021
|
+
to: "backend-api",
|
|
1022
|
+
label: "PUT booking-status: BOOK_DRIVER_CANCELED",
|
|
1023
|
+
type: "request",
|
|
1024
|
+
color: "#7b59e6",
|
|
1025
|
+
delay: 0,
|
|
1026
|
+
duration: 800,
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
id: "p7dc-2",
|
|
1030
|
+
from: "backend-api",
|
|
1031
|
+
to: "database",
|
|
1032
|
+
label: "Update status + booking_status",
|
|
1033
|
+
type: "request",
|
|
1034
|
+
color: "#7b59e6",
|
|
1035
|
+
delay: 900,
|
|
1036
|
+
duration: 600,
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
id: "p7dc-3",
|
|
1040
|
+
from: "backend-api",
|
|
1041
|
+
to: "bullmq",
|
|
1042
|
+
label: "Cleanup driver jobs",
|
|
1043
|
+
type: "cleanup",
|
|
1044
|
+
color: "#ef4444",
|
|
1045
|
+
delay: 1600,
|
|
1046
|
+
duration: 700,
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
id: "p7dc-4",
|
|
1050
|
+
from: "backend-api",
|
|
1051
|
+
to: "dac",
|
|
1052
|
+
label: "Delete scheduled ride DAC",
|
|
1053
|
+
type: "cleanup",
|
|
1054
|
+
color: "#ef4444",
|
|
1055
|
+
delay: 2400,
|
|
1056
|
+
duration: 700,
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
id: "p7dc-5",
|
|
1060
|
+
from: "backend-api",
|
|
1061
|
+
to: "pubsub",
|
|
1062
|
+
label: "Ride dispatch: BOOK_DRIVER_CANCELED",
|
|
1063
|
+
type: "event",
|
|
1064
|
+
color: "#10b981",
|
|
1065
|
+
delay: 3200,
|
|
1066
|
+
duration: 700,
|
|
1067
|
+
},
|
|
1068
|
+
],
|
|
1069
|
+
sideEffects: {
|
|
1070
|
+
jobs: "Cleanup driver confirmation + timeout jobs",
|
|
1071
|
+
dac: "deleteScheduledRideAction()",
|
|
1072
|
+
pubsub: "RIDE_STATUS_UPDATES_TOPIC: BOOK_DRIVER_CANCELED",
|
|
1073
|
+
},
|
|
1074
|
+
},
|
|
1075
|
+
],
|
|
1076
|
+
},
|
|
1077
|
+
|
|
1078
|
+
// Path 8: Driver Timeout → Ops Cancel
|
|
1079
|
+
{
|
|
1080
|
+
id: 8,
|
|
1081
|
+
label: "Driver Timeout → Ops Cancel",
|
|
1082
|
+
icon: "⏰",
|
|
1083
|
+
color: "#f59e0b",
|
|
1084
|
+
description:
|
|
1085
|
+
"BOOK_ASSIGNED → BOOK_DRIVER_CONFIRMATION_PENDING → DRIVER_CANCELED (via timeout)",
|
|
1086
|
+
category: "timeout",
|
|
1087
|
+
steps: [
|
|
1088
|
+
{ ...condensedSetupStep, id: "p8-setup" },
|
|
1089
|
+
{ ...driverConfirmationJobStep, id: "p8-driver-conf-job" },
|
|
1090
|
+
{
|
|
1091
|
+
id: "p8-driver-timeout",
|
|
1092
|
+
title: "Driver Timeout → Ops Escalation",
|
|
1093
|
+
description:
|
|
1094
|
+
"Driver did not confirm in time. Trip is canceled and ops team is alerted.",
|
|
1095
|
+
actor: "system",
|
|
1096
|
+
status: "DRIVER_CANCELED",
|
|
1097
|
+
bookingStatus: "BOOK_OPERATION_DRIVER_CONFIRMATION_PENDING",
|
|
1098
|
+
trigger: "BullMQ driver-confirmation-timeout job fires",
|
|
1099
|
+
handler:
|
|
1100
|
+
"processDriverConfirmationTimeout() in booking-jobs-worker.js",
|
|
1101
|
+
activeComponents: [
|
|
1102
|
+
"bullmq",
|
|
1103
|
+
"backend-api",
|
|
1104
|
+
"driver-app",
|
|
1105
|
+
"ops-dashboard",
|
|
1106
|
+
"database",
|
|
1107
|
+
],
|
|
1108
|
+
messages: [
|
|
1109
|
+
{
|
|
1110
|
+
id: "p8dt-1",
|
|
1111
|
+
from: "bullmq",
|
|
1112
|
+
to: "backend-api",
|
|
1113
|
+
label: "driver-confirmation-timeout fires",
|
|
1114
|
+
type: "job",
|
|
1115
|
+
color: "#f59e0b",
|
|
1116
|
+
delay: 0,
|
|
1117
|
+
duration: 700,
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
id: "p8dt-2",
|
|
1121
|
+
from: "backend-api",
|
|
1122
|
+
to: "database",
|
|
1123
|
+
label: "DRIVER_CANCELED + booking_status",
|
|
1124
|
+
type: "request",
|
|
1125
|
+
color: "#7b59e6",
|
|
1126
|
+
delay: 800,
|
|
1127
|
+
duration: 600,
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
id: "p8dt-3",
|
|
1131
|
+
from: "backend-api",
|
|
1132
|
+
to: "bullmq",
|
|
1133
|
+
label: "Schedule ops-driver-confirmation-window-timeout",
|
|
1134
|
+
type: "job",
|
|
1135
|
+
color: "#f59e0b",
|
|
1136
|
+
delay: 1500,
|
|
1137
|
+
duration: 700,
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
id: "p8dt-4",
|
|
1141
|
+
from: "backend-api",
|
|
1142
|
+
to: "driver-app",
|
|
1143
|
+
label: "Push: driver_booking_timeout",
|
|
1144
|
+
type: "notification",
|
|
1145
|
+
color: "#fb2576",
|
|
1146
|
+
delay: 2300,
|
|
1147
|
+
duration: 800,
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
id: "p8dt-5",
|
|
1151
|
+
from: "backend-api",
|
|
1152
|
+
to: "ops-dashboard",
|
|
1153
|
+
label: "HIGH: booking_driver_confirmation_timeout",
|
|
1154
|
+
type: "event",
|
|
1155
|
+
color: "#10b981",
|
|
1156
|
+
delay: 3200,
|
|
1157
|
+
duration: 800,
|
|
1158
|
+
},
|
|
1159
|
+
],
|
|
1160
|
+
sideEffects: {
|
|
1161
|
+
jobs: "Schedule ops-driver-confirmation-window-timeout",
|
|
1162
|
+
notifications:
|
|
1163
|
+
"Push to Driver + Dashboard alert (high priority)",
|
|
1164
|
+
},
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
id: "p8-ops-window-timeout",
|
|
1168
|
+
title: "Ops Window Timeout → Cancel",
|
|
1169
|
+
description:
|
|
1170
|
+
"Ops window expired. System cancels the driver assignment and cleans up.",
|
|
1171
|
+
actor: "system",
|
|
1172
|
+
status: "DRIVER_CANCELED",
|
|
1173
|
+
bookingStatus: "BOOK_OPERATION_DRIVER_CANCELED",
|
|
1174
|
+
trigger:
|
|
1175
|
+
"BullMQ ops-driver-confirmation-window-timeout job fires",
|
|
1176
|
+
handler:
|
|
1177
|
+
"processOpsDriverConfirmationWindowTimeout() in booking-jobs-worker.js",
|
|
1178
|
+
activeComponents: [
|
|
1179
|
+
"bullmq",
|
|
1180
|
+
"backend-api",
|
|
1181
|
+
"driver-app",
|
|
1182
|
+
"ops-dashboard",
|
|
1183
|
+
"dac",
|
|
1184
|
+
"database",
|
|
1185
|
+
],
|
|
1186
|
+
messages: [
|
|
1187
|
+
{
|
|
1188
|
+
id: "p8owt-1",
|
|
1189
|
+
from: "bullmq",
|
|
1190
|
+
to: "backend-api",
|
|
1191
|
+
label: "ops-driver-confirmation-window-timeout fires",
|
|
1192
|
+
type: "job",
|
|
1193
|
+
color: "#f59e0b",
|
|
1194
|
+
delay: 0,
|
|
1195
|
+
duration: 700,
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
id: "p8owt-2",
|
|
1199
|
+
from: "backend-api",
|
|
1200
|
+
to: "database",
|
|
1201
|
+
label: "BOOK_OPERATION_DRIVER_CANCELED",
|
|
1202
|
+
type: "request",
|
|
1203
|
+
color: "#7b59e6",
|
|
1204
|
+
delay: 800,
|
|
1205
|
+
duration: 600,
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
id: "p8owt-3",
|
|
1209
|
+
from: "backend-api",
|
|
1210
|
+
to: "driver-app",
|
|
1211
|
+
label: "Push: driver_booking_ops_cancelled",
|
|
1212
|
+
type: "notification",
|
|
1213
|
+
color: "#fb2576",
|
|
1214
|
+
delay: 1500,
|
|
1215
|
+
duration: 800,
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
id: "p8owt-4",
|
|
1219
|
+
from: "backend-api",
|
|
1220
|
+
to: "ops-dashboard",
|
|
1221
|
+
label: "booking_driver_ops_window_timeout",
|
|
1222
|
+
type: "event",
|
|
1223
|
+
color: "#10b981",
|
|
1224
|
+
delay: 2400,
|
|
1225
|
+
duration: 800,
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
id: "p8owt-5",
|
|
1229
|
+
from: "backend-api",
|
|
1230
|
+
to: "dac",
|
|
1231
|
+
label: "Delete scheduled ride DAC",
|
|
1232
|
+
type: "cleanup",
|
|
1233
|
+
color: "#ef4444",
|
|
1234
|
+
delay: 3300,
|
|
1235
|
+
duration: 700,
|
|
1236
|
+
},
|
|
1237
|
+
],
|
|
1238
|
+
sideEffects: {
|
|
1239
|
+
notifications: "Push to Driver + Dashboard alert",
|
|
1240
|
+
dac: "deleteScheduledRideAction()",
|
|
1241
|
+
},
|
|
1242
|
+
},
|
|
1243
|
+
],
|
|
1244
|
+
},
|
|
1245
|
+
|
|
1246
|
+
// Path 9: Ops Cancels (Various) — with sub-paths
|
|
1247
|
+
{
|
|
1248
|
+
id: 9,
|
|
1249
|
+
label: "Ops Cancels (Various)",
|
|
1250
|
+
icon: "🛠️",
|
|
1251
|
+
color: "#06b6d4",
|
|
1252
|
+
description: "Ops-initiated cancellations at various stages",
|
|
1253
|
+
category: "ops",
|
|
1254
|
+
steps: [],
|
|
1255
|
+
subPaths: [
|
|
1256
|
+
{
|
|
1257
|
+
id: "9a",
|
|
1258
|
+
label: "Ops Cancels Before Assignment",
|
|
1259
|
+
steps: [
|
|
1260
|
+
{
|
|
1261
|
+
id: "p9a-starting-state",
|
|
1262
|
+
title: "Trip at Pre-Assignment Stage",
|
|
1263
|
+
description:
|
|
1264
|
+
"Trip is in PENDING or BOOK_CONFIRMED state, no driver assigned.",
|
|
1265
|
+
actor: "system",
|
|
1266
|
+
status: "PENDING / BOOK_CONFIRMED",
|
|
1267
|
+
bookingStatus: "BOOK_PENDING / BOOK_RIDER_CONFIRMED",
|
|
1268
|
+
trigger: "Starting state",
|
|
1269
|
+
handler: "N/A",
|
|
1270
|
+
activeComponents: [
|
|
1271
|
+
"rider-app",
|
|
1272
|
+
"backend-api",
|
|
1273
|
+
"database",
|
|
1274
|
+
],
|
|
1275
|
+
messages: [],
|
|
1276
|
+
sideEffects: {},
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
id: "p9a-ops-cancels",
|
|
1280
|
+
title: "Ops Cancels Before Assignment",
|
|
1281
|
+
description:
|
|
1282
|
+
"Operations cancels the trip before any driver is assigned. Rider is notified.",
|
|
1283
|
+
actor: "ops",
|
|
1284
|
+
status: "RIDER_CANCELED",
|
|
1285
|
+
bookingStatus: "BOOK_OPERATION_RIDER_CANCELED",
|
|
1286
|
+
trigger:
|
|
1287
|
+
"Ops PUT /trips/:tripId/status → RIDER_CANCELED + internal-access-key",
|
|
1288
|
+
handler: "fnUpdateBookingStatus",
|
|
1289
|
+
activeComponents: [
|
|
1290
|
+
"ops-dashboard",
|
|
1291
|
+
"backend-api",
|
|
1292
|
+
"bullmq",
|
|
1293
|
+
"rider-app",
|
|
1294
|
+
"pubsub",
|
|
1295
|
+
"database",
|
|
1296
|
+
],
|
|
1297
|
+
messages: [
|
|
1298
|
+
{
|
|
1299
|
+
id: "p9a-1",
|
|
1300
|
+
from: "ops-dashboard",
|
|
1301
|
+
to: "backend-api",
|
|
1302
|
+
label: "PUT status: RIDER_CANCELED",
|
|
1303
|
+
type: "request",
|
|
1304
|
+
color: "#7b59e6",
|
|
1305
|
+
delay: 0,
|
|
1306
|
+
duration: 800,
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
id: "p9a-2",
|
|
1310
|
+
from: "backend-api",
|
|
1311
|
+
to: "database",
|
|
1312
|
+
label: "Update status + booking_status",
|
|
1313
|
+
type: "request",
|
|
1314
|
+
color: "#7b59e6",
|
|
1315
|
+
delay: 900,
|
|
1316
|
+
duration: 600,
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
id: "p9a-3",
|
|
1320
|
+
from: "backend-api",
|
|
1321
|
+
to: "bullmq",
|
|
1322
|
+
label: "Cleanup rider + driver jobs",
|
|
1323
|
+
type: "cleanup",
|
|
1324
|
+
color: "#ef4444",
|
|
1325
|
+
delay: 1600,
|
|
1326
|
+
duration: 700,
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
id: "p9a-4",
|
|
1330
|
+
from: "backend-api",
|
|
1331
|
+
to: "rider-app",
|
|
1332
|
+
label: "Push: RIDER_CANCELED",
|
|
1333
|
+
type: "notification",
|
|
1334
|
+
color: "#fb2576",
|
|
1335
|
+
delay: 2400,
|
|
1336
|
+
duration: 800,
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
id: "p9a-5",
|
|
1340
|
+
from: "backend-api",
|
|
1341
|
+
to: "pubsub",
|
|
1342
|
+
label: "Trip status + dispatch events",
|
|
1343
|
+
type: "event",
|
|
1344
|
+
color: "#10b981",
|
|
1345
|
+
delay: 3300,
|
|
1346
|
+
duration: 700,
|
|
1347
|
+
},
|
|
1348
|
+
],
|
|
1349
|
+
sideEffects: {
|
|
1350
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
1351
|
+
notifications: "Generic ConfiguredPn: RIDER_CANCELED",
|
|
1352
|
+
pubsub:
|
|
1353
|
+
"fnProduceTripStatusUpdate + publishRideDispatchGenericStatusMW",
|
|
1354
|
+
},
|
|
1355
|
+
},
|
|
1356
|
+
],
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
id: "9b",
|
|
1360
|
+
label: "Ops Cancels Rider After Assignment",
|
|
1361
|
+
steps: [
|
|
1362
|
+
{
|
|
1363
|
+
id: "p9b-starting-state",
|
|
1364
|
+
title: "Trip With Driver Assigned",
|
|
1365
|
+
description:
|
|
1366
|
+
"Trip has a driver assigned (BOOK_ASSIGNED state).",
|
|
1367
|
+
actor: "system",
|
|
1368
|
+
status: "BOOK_ASSIGNED",
|
|
1369
|
+
bookingStatus: "BOOK_RIDER_CONFIRMED",
|
|
1370
|
+
trigger: "Starting state",
|
|
1371
|
+
handler: "N/A",
|
|
1372
|
+
activeComponents: [
|
|
1373
|
+
"rider-app",
|
|
1374
|
+
"backend-api",
|
|
1375
|
+
"driver-app",
|
|
1376
|
+
"database",
|
|
1377
|
+
],
|
|
1378
|
+
messages: [],
|
|
1379
|
+
sideEffects: {},
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
id: "p9b-ops-cancels-rider",
|
|
1383
|
+
title: "Ops Cancels Rider After Assignment",
|
|
1384
|
+
description:
|
|
1385
|
+
"Operations cancels the rider side. Both rider and driver are notified, DAC deleted, driver goes ONLINE.",
|
|
1386
|
+
actor: "ops",
|
|
1387
|
+
status: "RIDER_CANCELED",
|
|
1388
|
+
bookingStatus: "BOOK_OPERATION_RIDER_CANCELED",
|
|
1389
|
+
trigger:
|
|
1390
|
+
"Ops PUT /trips/:tripId/status → RIDER_CANCELED + internal-access-key",
|
|
1391
|
+
handler: "fnUpdateBookingStatus",
|
|
1392
|
+
activeComponents: [
|
|
1393
|
+
"ops-dashboard",
|
|
1394
|
+
"backend-api",
|
|
1395
|
+
"bullmq",
|
|
1396
|
+
"rider-app",
|
|
1397
|
+
"driver-app",
|
|
1398
|
+
"dac",
|
|
1399
|
+
"pubsub",
|
|
1400
|
+
"database",
|
|
1401
|
+
],
|
|
1402
|
+
messages: [
|
|
1403
|
+
{
|
|
1404
|
+
id: "p9b-1",
|
|
1405
|
+
from: "ops-dashboard",
|
|
1406
|
+
to: "backend-api",
|
|
1407
|
+
label: "PUT status: RIDER_CANCELED",
|
|
1408
|
+
type: "request",
|
|
1409
|
+
color: "#7b59e6",
|
|
1410
|
+
delay: 0,
|
|
1411
|
+
duration: 800,
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
id: "p9b-2",
|
|
1415
|
+
from: "backend-api",
|
|
1416
|
+
to: "database",
|
|
1417
|
+
label: "Update status + booking_status",
|
|
1418
|
+
type: "request",
|
|
1419
|
+
color: "#7b59e6",
|
|
1420
|
+
delay: 900,
|
|
1421
|
+
duration: 600,
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
id: "p9b-3",
|
|
1425
|
+
from: "backend-api",
|
|
1426
|
+
to: "bullmq",
|
|
1427
|
+
label: "Cleanup rider + driver jobs",
|
|
1428
|
+
type: "cleanup",
|
|
1429
|
+
color: "#ef4444",
|
|
1430
|
+
delay: 1600,
|
|
1431
|
+
duration: 700,
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
id: "p9b-4",
|
|
1435
|
+
from: "backend-api",
|
|
1436
|
+
to: "rider-app",
|
|
1437
|
+
label: "Push: RIDER_CANCELED",
|
|
1438
|
+
type: "notification",
|
|
1439
|
+
color: "#fb2576",
|
|
1440
|
+
delay: 2400,
|
|
1441
|
+
duration: 800,
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
id: "p9b-5",
|
|
1445
|
+
from: "backend-api",
|
|
1446
|
+
to: "driver-app",
|
|
1447
|
+
label: "Push: booking_canceled_by_rider",
|
|
1448
|
+
type: "notification",
|
|
1449
|
+
color: "#fb2576",
|
|
1450
|
+
delay: 3300,
|
|
1451
|
+
duration: 800,
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
id: "p9b-6",
|
|
1455
|
+
from: "backend-api",
|
|
1456
|
+
to: "dac",
|
|
1457
|
+
label: "Delete scheduled ride DAC",
|
|
1458
|
+
type: "cleanup",
|
|
1459
|
+
color: "#ef4444",
|
|
1460
|
+
delay: 4200,
|
|
1461
|
+
duration: 700,
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
id: "p9b-7",
|
|
1465
|
+
from: "backend-api",
|
|
1466
|
+
to: "pubsub",
|
|
1467
|
+
label: "Trip status + dispatch events",
|
|
1468
|
+
type: "event",
|
|
1469
|
+
color: "#10b981",
|
|
1470
|
+
delay: 5000,
|
|
1471
|
+
duration: 700,
|
|
1472
|
+
},
|
|
1473
|
+
],
|
|
1474
|
+
sideEffects: {
|
|
1475
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
1476
|
+
notifications:
|
|
1477
|
+
"Push to Rider + Push to Driver — booking_canceled_by_rider",
|
|
1478
|
+
dac: "deleteScheduledRideAction()",
|
|
1479
|
+
pubsub: "Trip status + dispatch events",
|
|
1480
|
+
},
|
|
1481
|
+
},
|
|
1482
|
+
],
|
|
1483
|
+
},
|
|
1484
|
+
{
|
|
1485
|
+
id: "9c",
|
|
1486
|
+
label: "Ops Cancels Driver After Assignment",
|
|
1487
|
+
steps: [
|
|
1488
|
+
{
|
|
1489
|
+
id: "p9c-starting-state",
|
|
1490
|
+
title: "Trip With Driver Assigned",
|
|
1491
|
+
description:
|
|
1492
|
+
"Trip has a driver assigned (BOOK_ASSIGNED state).",
|
|
1493
|
+
actor: "system",
|
|
1494
|
+
status: "BOOK_ASSIGNED",
|
|
1495
|
+
bookingStatus: "BOOK_RIDER_CONFIRMED",
|
|
1496
|
+
trigger: "Starting state",
|
|
1497
|
+
handler: "N/A",
|
|
1498
|
+
activeComponents: [
|
|
1499
|
+
"rider-app",
|
|
1500
|
+
"backend-api",
|
|
1501
|
+
"driver-app",
|
|
1502
|
+
"database",
|
|
1503
|
+
],
|
|
1504
|
+
messages: [],
|
|
1505
|
+
sideEffects: {},
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
id: "p9c-ops-cancels-driver",
|
|
1509
|
+
title: "Ops Cancels Driver After Assignment",
|
|
1510
|
+
description:
|
|
1511
|
+
"Operations cancels the driver assignment. Driver goes ONLINE, rider notified of reassignment/cancel.",
|
|
1512
|
+
actor: "ops",
|
|
1513
|
+
status: "DRIVER_CANCELED",
|
|
1514
|
+
bookingStatus: "BOOK_OPERATION_DRIVER_CANCELED",
|
|
1515
|
+
trigger:
|
|
1516
|
+
"Ops PUT /trips/:tripId/status → DRIVER_CANCELED + internal-access-key",
|
|
1517
|
+
handler: "fnUpdateBookingStatus",
|
|
1518
|
+
activeComponents: [
|
|
1519
|
+
"ops-dashboard",
|
|
1520
|
+
"backend-api",
|
|
1521
|
+
"bullmq",
|
|
1522
|
+
"rider-app",
|
|
1523
|
+
"driver-app",
|
|
1524
|
+
"dac",
|
|
1525
|
+
"pubsub",
|
|
1526
|
+
"database",
|
|
1527
|
+
],
|
|
1528
|
+
messages: [
|
|
1529
|
+
{
|
|
1530
|
+
id: "p9c-1",
|
|
1531
|
+
from: "ops-dashboard",
|
|
1532
|
+
to: "backend-api",
|
|
1533
|
+
label: "PUT status: DRIVER_CANCELED",
|
|
1534
|
+
type: "request",
|
|
1535
|
+
color: "#7b59e6",
|
|
1536
|
+
delay: 0,
|
|
1537
|
+
duration: 800,
|
|
1538
|
+
},
|
|
1539
|
+
{
|
|
1540
|
+
id: "p9c-2",
|
|
1541
|
+
from: "backend-api",
|
|
1542
|
+
to: "database",
|
|
1543
|
+
label: "Update status, clear driver refs",
|
|
1544
|
+
type: "request",
|
|
1545
|
+
color: "#7b59e6",
|
|
1546
|
+
delay: 900,
|
|
1547
|
+
duration: 600,
|
|
1548
|
+
},
|
|
1549
|
+
{
|
|
1550
|
+
id: "p9c-3",
|
|
1551
|
+
from: "backend-api",
|
|
1552
|
+
to: "bullmq",
|
|
1553
|
+
label: "Cleanup all rider + driver jobs",
|
|
1554
|
+
type: "cleanup",
|
|
1555
|
+
color: "#ef4444",
|
|
1556
|
+
delay: 1600,
|
|
1557
|
+
duration: 700,
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
id: "p9c-4",
|
|
1561
|
+
from: "backend-api",
|
|
1562
|
+
to: "rider-app",
|
|
1563
|
+
label: "Push: driver canceled, reassigning",
|
|
1564
|
+
type: "notification",
|
|
1565
|
+
color: "#fb2576",
|
|
1566
|
+
delay: 2400,
|
|
1567
|
+
duration: 800,
|
|
1568
|
+
},
|
|
1569
|
+
{
|
|
1570
|
+
id: "p9c-5",
|
|
1571
|
+
from: "backend-api",
|
|
1572
|
+
to: "dac",
|
|
1573
|
+
label: "Delete scheduled ride DAC",
|
|
1574
|
+
type: "cleanup",
|
|
1575
|
+
color: "#ef4444",
|
|
1576
|
+
delay: 3300,
|
|
1577
|
+
duration: 700,
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
id: "p9c-6",
|
|
1581
|
+
from: "backend-api",
|
|
1582
|
+
to: "pubsub",
|
|
1583
|
+
label: "Trip status + dispatch events",
|
|
1584
|
+
type: "event",
|
|
1585
|
+
color: "#10b981",
|
|
1586
|
+
delay: 4100,
|
|
1587
|
+
duration: 700,
|
|
1588
|
+
},
|
|
1589
|
+
],
|
|
1590
|
+
sideEffects: {
|
|
1591
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
1592
|
+
notifications:
|
|
1593
|
+
"Push to Rider — driver canceled, being reassigned",
|
|
1594
|
+
dac: "deleteScheduledRideAction()",
|
|
1595
|
+
pubsub: "Trip status + dispatch events",
|
|
1596
|
+
},
|
|
1597
|
+
},
|
|
1598
|
+
],
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
id: "9d",
|
|
1602
|
+
label: "No Driver Available",
|
|
1603
|
+
steps: [
|
|
1604
|
+
{
|
|
1605
|
+
id: "p9d-starting-state",
|
|
1606
|
+
title: "Trip Awaiting Driver",
|
|
1607
|
+
description:
|
|
1608
|
+
"Trip is confirmed but no driver can be found.",
|
|
1609
|
+
actor: "system",
|
|
1610
|
+
status: "BOOK_CONFIRMED",
|
|
1611
|
+
bookingStatus: "BOOK_RIDER_CONFIRMED",
|
|
1612
|
+
trigger: "Starting state",
|
|
1613
|
+
handler: "N/A",
|
|
1614
|
+
activeComponents: [
|
|
1615
|
+
"rider-app",
|
|
1616
|
+
"backend-api",
|
|
1617
|
+
"database",
|
|
1618
|
+
],
|
|
1619
|
+
messages: [],
|
|
1620
|
+
sideEffects: {},
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
id: "p9d-no-driver",
|
|
1624
|
+
title: "No Driver Available",
|
|
1625
|
+
description:
|
|
1626
|
+
"System determines no driver is available for the scheduled ride. Trip is canceled.",
|
|
1627
|
+
actor: "system",
|
|
1628
|
+
status: "NO_DRIVER_AVAILABLE",
|
|
1629
|
+
bookingStatus: "BOOK_SYSTEM_CANCELED",
|
|
1630
|
+
trigger:
|
|
1631
|
+
"Ops PUT /trips/:tripId/status → NO_DRIVER_AVAILABLE + internal-access-key",
|
|
1632
|
+
handler: "fnUpdateBookingStatus",
|
|
1633
|
+
activeComponents: [
|
|
1634
|
+
"ops-dashboard",
|
|
1635
|
+
"backend-api",
|
|
1636
|
+
"bullmq",
|
|
1637
|
+
"rider-app",
|
|
1638
|
+
"dac",
|
|
1639
|
+
"pubsub",
|
|
1640
|
+
"database",
|
|
1641
|
+
],
|
|
1642
|
+
messages: [
|
|
1643
|
+
{
|
|
1644
|
+
id: "p9d-1",
|
|
1645
|
+
from: "ops-dashboard",
|
|
1646
|
+
to: "backend-api",
|
|
1647
|
+
label: "PUT status: NO_DRIVER_AVAILABLE",
|
|
1648
|
+
type: "request",
|
|
1649
|
+
color: "#7b59e6",
|
|
1650
|
+
delay: 0,
|
|
1651
|
+
duration: 800,
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
id: "p9d-2",
|
|
1655
|
+
from: "backend-api",
|
|
1656
|
+
to: "database",
|
|
1657
|
+
label: "Update status + booking_status",
|
|
1658
|
+
type: "request",
|
|
1659
|
+
color: "#7b59e6",
|
|
1660
|
+
delay: 900,
|
|
1661
|
+
duration: 600,
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
id: "p9d-3",
|
|
1665
|
+
from: "backend-api",
|
|
1666
|
+
to: "bullmq",
|
|
1667
|
+
label: "Cleanup all jobs",
|
|
1668
|
+
type: "cleanup",
|
|
1669
|
+
color: "#ef4444",
|
|
1670
|
+
delay: 1600,
|
|
1671
|
+
duration: 700,
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
id: "p9d-4",
|
|
1675
|
+
from: "backend-api",
|
|
1676
|
+
to: "rider-app",
|
|
1677
|
+
label: "Push: no driver found",
|
|
1678
|
+
type: "notification",
|
|
1679
|
+
color: "#fb2576",
|
|
1680
|
+
delay: 2400,
|
|
1681
|
+
duration: 800,
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
id: "p9d-5",
|
|
1685
|
+
from: "backend-api",
|
|
1686
|
+
to: "dac",
|
|
1687
|
+
label: "Delete scheduled ride DAC",
|
|
1688
|
+
type: "cleanup",
|
|
1689
|
+
color: "#ef4444",
|
|
1690
|
+
delay: 3300,
|
|
1691
|
+
duration: 700,
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
id: "p9d-6",
|
|
1695
|
+
from: "backend-api",
|
|
1696
|
+
to: "pubsub",
|
|
1697
|
+
label: "Trip status events",
|
|
1698
|
+
type: "event",
|
|
1699
|
+
color: "#10b981",
|
|
1700
|
+
delay: 4100,
|
|
1701
|
+
duration: 700,
|
|
1702
|
+
},
|
|
1703
|
+
],
|
|
1704
|
+
sideEffects: {
|
|
1705
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
1706
|
+
notifications:
|
|
1707
|
+
"Push to Rider — no driver found for scheduled ride",
|
|
1708
|
+
dac: "deleteScheduledRideAction()",
|
|
1709
|
+
pubsub: "Trip status events",
|
|
1710
|
+
},
|
|
1711
|
+
},
|
|
1712
|
+
],
|
|
1713
|
+
},
|
|
1714
|
+
],
|
|
1715
|
+
},
|
|
1716
|
+
|
|
1717
|
+
// Path 10: Driver Re-assignment
|
|
1718
|
+
{
|
|
1719
|
+
id: 10,
|
|
1720
|
+
label: "Driver Re-assignment",
|
|
1721
|
+
icon: "🔄",
|
|
1722
|
+
color: "#8b5cf6",
|
|
1723
|
+
description:
|
|
1724
|
+
"DRIVER_CANCELED → BOOK_ASSIGNED (new driver) → continues Happy Path",
|
|
1725
|
+
category: "ops",
|
|
1726
|
+
steps: [
|
|
1727
|
+
{
|
|
1728
|
+
id: "p10-canceled-state",
|
|
1729
|
+
title: "Previous State — Driver Canceled",
|
|
1730
|
+
description:
|
|
1731
|
+
"Trip is in DRIVER_CANCELED state. Previous driver has been removed.",
|
|
1732
|
+
actor: "system",
|
|
1733
|
+
status: "DRIVER_CANCELED",
|
|
1734
|
+
bookingStatus: "BOOK_DRIVER_CANCELED",
|
|
1735
|
+
trigger: "Previous driver cancellation",
|
|
1736
|
+
handler: "N/A",
|
|
1737
|
+
activeComponents: ["backend-api", "database"],
|
|
1738
|
+
messages: [],
|
|
1739
|
+
sideEffects: {},
|
|
1740
|
+
},
|
|
1741
|
+
{
|
|
1742
|
+
id: "p10-reassign",
|
|
1743
|
+
title: "Ops Re-assigns New Driver",
|
|
1744
|
+
description:
|
|
1745
|
+
"Ops assigns a new driver. Booking status is reset to BOOK_RIDER_CONFIRMED to re-enable driver confirmation flow.",
|
|
1746
|
+
actor: "ops",
|
|
1747
|
+
status: "BOOK_ASSIGNED",
|
|
1748
|
+
bookingStatus: "BOOK_RIDER_CONFIRMED",
|
|
1749
|
+
trigger:
|
|
1750
|
+
"Ops PUT /trips/:tripId/status → BOOK_ASSIGNED (new driver) + internal-access-key",
|
|
1751
|
+
handler: "fnUpdateBookingStatus",
|
|
1752
|
+
activeComponents: [
|
|
1753
|
+
"ops-dashboard",
|
|
1754
|
+
"backend-api",
|
|
1755
|
+
"bullmq",
|
|
1756
|
+
"driver-app",
|
|
1757
|
+
"dac",
|
|
1758
|
+
"pubsub",
|
|
1759
|
+
"database",
|
|
1760
|
+
],
|
|
1761
|
+
messages: [
|
|
1762
|
+
{
|
|
1763
|
+
id: "p10-1",
|
|
1764
|
+
from: "ops-dashboard",
|
|
1765
|
+
to: "backend-api",
|
|
1766
|
+
label: "PUT status: BOOK_ASSIGNED (new driver)",
|
|
1767
|
+
type: "request",
|
|
1768
|
+
color: "#7b59e6",
|
|
1769
|
+
delay: 0,
|
|
1770
|
+
duration: 800,
|
|
1771
|
+
},
|
|
1772
|
+
{
|
|
1773
|
+
id: "p10-2",
|
|
1774
|
+
from: "backend-api",
|
|
1775
|
+
to: "database",
|
|
1776
|
+
label: "Reset booking_status, assign new driver",
|
|
1777
|
+
type: "request",
|
|
1778
|
+
color: "#7b59e6",
|
|
1779
|
+
delay: 900,
|
|
1780
|
+
duration: 600,
|
|
1781
|
+
},
|
|
1782
|
+
{
|
|
1783
|
+
id: "p10-3",
|
|
1784
|
+
from: "backend-api",
|
|
1785
|
+
to: "bullmq",
|
|
1786
|
+
label: "Cleanup old driver jobs",
|
|
1787
|
+
type: "cleanup",
|
|
1788
|
+
color: "#ef4444",
|
|
1789
|
+
delay: 1600,
|
|
1790
|
+
duration: 700,
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
id: "p10-4",
|
|
1794
|
+
from: "backend-api",
|
|
1795
|
+
to: "bullmq",
|
|
1796
|
+
label: "Schedule new pre-trip-driver-confirmation",
|
|
1797
|
+
type: "job",
|
|
1798
|
+
color: "#f59e0b",
|
|
1799
|
+
delay: 2400,
|
|
1800
|
+
duration: 700,
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
id: "p10-5",
|
|
1804
|
+
from: "backend-api",
|
|
1805
|
+
to: "driver-app",
|
|
1806
|
+
label: "New driver assignment notification",
|
|
1807
|
+
type: "notification",
|
|
1808
|
+
color: "#fb2576",
|
|
1809
|
+
delay: 3200,
|
|
1810
|
+
duration: 800,
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
id: "p10-6",
|
|
1814
|
+
from: "backend-api",
|
|
1815
|
+
to: "dac",
|
|
1816
|
+
label: "Publish new scheduled ride DAC",
|
|
1817
|
+
type: "event",
|
|
1818
|
+
color: "#10b981",
|
|
1819
|
+
delay: 4100,
|
|
1820
|
+
duration: 700,
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
id: "p10-7",
|
|
1824
|
+
from: "backend-api",
|
|
1825
|
+
to: "pubsub",
|
|
1826
|
+
label: "Ride dispatch event",
|
|
1827
|
+
type: "event",
|
|
1828
|
+
color: "#10b981",
|
|
1829
|
+
delay: 4900,
|
|
1830
|
+
duration: 700,
|
|
1831
|
+
},
|
|
1832
|
+
],
|
|
1833
|
+
sideEffects: {
|
|
1834
|
+
jobs: "Cleanup old driver jobs + Schedule new pre-trip-driver-confirmation",
|
|
1835
|
+
notifications: "New driver assignment notification",
|
|
1836
|
+
dac: "publishScheduledRideAction()",
|
|
1837
|
+
pubsub: "Ride dispatch event",
|
|
1838
|
+
},
|
|
1839
|
+
},
|
|
1840
|
+
],
|
|
1841
|
+
},
|
|
1842
|
+
|
|
1843
|
+
// Path 11: Active Trip Cancellations — with sub-paths
|
|
1844
|
+
{
|
|
1845
|
+
id: 11,
|
|
1846
|
+
label: "Active Trip Cancellations",
|
|
1847
|
+
icon: "⚠️",
|
|
1848
|
+
color: "#ef4444",
|
|
1849
|
+
description: "Cancellations during active trips (post-acceptance)",
|
|
1850
|
+
category: "active-cancel",
|
|
1851
|
+
steps: [],
|
|
1852
|
+
subPaths: [
|
|
1853
|
+
{
|
|
1854
|
+
id: "11a",
|
|
1855
|
+
label: "Driver Cancels While Coming",
|
|
1856
|
+
steps: [
|
|
1857
|
+
{
|
|
1858
|
+
id: "p11a-active-state",
|
|
1859
|
+
title: "Trip Accepted & Driver Coming",
|
|
1860
|
+
description:
|
|
1861
|
+
"Trip has been accepted by driver and driver is en route.",
|
|
1862
|
+
actor: "system",
|
|
1863
|
+
status: "ACCEPTED",
|
|
1864
|
+
bookingStatus: "BOOK_DRIVER_CONFIRMED",
|
|
1865
|
+
trigger: "Active trip state",
|
|
1866
|
+
handler: "N/A",
|
|
1867
|
+
activeComponents: [
|
|
1868
|
+
"rider-app",
|
|
1869
|
+
"driver-app",
|
|
1870
|
+
"backend-api",
|
|
1871
|
+
"database",
|
|
1872
|
+
],
|
|
1873
|
+
messages: [],
|
|
1874
|
+
sideEffects: {},
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
id: "p11a-driver-cancels",
|
|
1878
|
+
title: "Driver Cancels While Coming",
|
|
1879
|
+
description:
|
|
1880
|
+
"Driver cancels while en route. Re-dispatch is triggered. Driver goes ONLINE.",
|
|
1881
|
+
actor: "ops",
|
|
1882
|
+
status: "DRIVER_COMING_CANCELED",
|
|
1883
|
+
bookingStatus: "BOOK_OPERATION_DRIVER_CANCELED",
|
|
1884
|
+
trigger:
|
|
1885
|
+
"Ops PUT /trips/:tripId/status → DRIVER_COMING_CANCELED + internal-access-key",
|
|
1886
|
+
handler: "fnUpdateBookingStatus",
|
|
1887
|
+
activeComponents: [
|
|
1888
|
+
"ops-dashboard",
|
|
1889
|
+
"backend-api",
|
|
1890
|
+
"bullmq",
|
|
1891
|
+
"rider-app",
|
|
1892
|
+
"driver-app",
|
|
1893
|
+
"dac",
|
|
1894
|
+
"pubsub",
|
|
1895
|
+
"database",
|
|
1896
|
+
],
|
|
1897
|
+
messages: [
|
|
1898
|
+
{
|
|
1899
|
+
id: "p11a-1",
|
|
1900
|
+
from: "ops-dashboard",
|
|
1901
|
+
to: "backend-api",
|
|
1902
|
+
label: "PUT status: DRIVER_COMING_CANCELED",
|
|
1903
|
+
type: "request",
|
|
1904
|
+
color: "#7b59e6",
|
|
1905
|
+
delay: 0,
|
|
1906
|
+
duration: 800,
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
id: "p11a-2",
|
|
1910
|
+
from: "backend-api",
|
|
1911
|
+
to: "database",
|
|
1912
|
+
label: "Update status + booking_status",
|
|
1913
|
+
type: "request",
|
|
1914
|
+
color: "#7b59e6",
|
|
1915
|
+
delay: 900,
|
|
1916
|
+
duration: 600,
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
id: "p11a-3",
|
|
1920
|
+
from: "backend-api",
|
|
1921
|
+
to: "bullmq",
|
|
1922
|
+
label: "Cleanup all jobs",
|
|
1923
|
+
type: "cleanup",
|
|
1924
|
+
color: "#ef4444",
|
|
1925
|
+
delay: 1600,
|
|
1926
|
+
duration: 700,
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
id: "p11a-4",
|
|
1930
|
+
from: "backend-api",
|
|
1931
|
+
to: "rider-app",
|
|
1932
|
+
label: "Push: driver canceled while coming",
|
|
1933
|
+
type: "notification",
|
|
1934
|
+
color: "#fb2576",
|
|
1935
|
+
delay: 2400,
|
|
1936
|
+
duration: 800,
|
|
1937
|
+
},
|
|
1938
|
+
{
|
|
1939
|
+
id: "p11a-5",
|
|
1940
|
+
from: "backend-api",
|
|
1941
|
+
to: "dac",
|
|
1942
|
+
label: "Delete scheduled ride DAC",
|
|
1943
|
+
type: "cleanup",
|
|
1944
|
+
color: "#ef4444",
|
|
1945
|
+
delay: 3300,
|
|
1946
|
+
duration: 700,
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
id: "p11a-6",
|
|
1950
|
+
from: "backend-api",
|
|
1951
|
+
to: "pubsub",
|
|
1952
|
+
label: "Trip status events",
|
|
1953
|
+
type: "event",
|
|
1954
|
+
color: "#10b981",
|
|
1955
|
+
delay: 4100,
|
|
1956
|
+
duration: 700,
|
|
1957
|
+
},
|
|
1958
|
+
],
|
|
1959
|
+
sideEffects: {
|
|
1960
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
1961
|
+
notifications:
|
|
1962
|
+
"Push to Rider — driver canceled while coming",
|
|
1963
|
+
dac: "deleteScheduledRideAction()",
|
|
1964
|
+
pubsub:
|
|
1965
|
+
"fnReDispatchAfterDriverCancels triggers re-dispatch",
|
|
1966
|
+
},
|
|
1967
|
+
},
|
|
1968
|
+
],
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
id: "11b",
|
|
1972
|
+
label: "Rider Cancels While Driver Coming",
|
|
1973
|
+
steps: [
|
|
1974
|
+
{
|
|
1975
|
+
id: "p11b-active-state",
|
|
1976
|
+
title: "Trip Accepted & Driver Coming",
|
|
1977
|
+
description:
|
|
1978
|
+
"Trip has been accepted by driver and driver is en route.",
|
|
1979
|
+
actor: "system",
|
|
1980
|
+
status: "ACCEPTED",
|
|
1981
|
+
bookingStatus: "BOOK_DRIVER_CONFIRMED",
|
|
1982
|
+
trigger: "Active trip state",
|
|
1983
|
+
handler: "N/A",
|
|
1984
|
+
activeComponents: [
|
|
1985
|
+
"rider-app",
|
|
1986
|
+
"driver-app",
|
|
1987
|
+
"backend-api",
|
|
1988
|
+
"database",
|
|
1989
|
+
],
|
|
1990
|
+
messages: [],
|
|
1991
|
+
sideEffects: {},
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
id: "p11b-rider-cancels",
|
|
1995
|
+
title: "Rider Cancels While Driver Coming",
|
|
1996
|
+
description:
|
|
1997
|
+
"Rider cancels while driver is en route. Driver is notified and goes ONLINE.",
|
|
1998
|
+
actor: "ops",
|
|
1999
|
+
status: "DRIVER_COMING_RIDER_CANCELED",
|
|
2000
|
+
bookingStatus: "BOOK_OPERATION_RIDER_CANCELED",
|
|
2001
|
+
trigger:
|
|
2002
|
+
"Ops PUT /trips/:tripId/status → DRIVER_COMING_RIDER_CANCELED + internal-access-key",
|
|
2003
|
+
handler: "fnUpdateBookingStatus",
|
|
2004
|
+
activeComponents: [
|
|
2005
|
+
"ops-dashboard",
|
|
2006
|
+
"backend-api",
|
|
2007
|
+
"bullmq",
|
|
2008
|
+
"rider-app",
|
|
2009
|
+
"driver-app",
|
|
2010
|
+
"dac",
|
|
2011
|
+
"pubsub",
|
|
2012
|
+
"database",
|
|
2013
|
+
],
|
|
2014
|
+
messages: [
|
|
2015
|
+
{
|
|
2016
|
+
id: "p11b-1",
|
|
2017
|
+
from: "ops-dashboard",
|
|
2018
|
+
to: "backend-api",
|
|
2019
|
+
label: "PUT status: DRIVER_COMING_RIDER_CANCELED",
|
|
2020
|
+
type: "request",
|
|
2021
|
+
color: "#7b59e6",
|
|
2022
|
+
delay: 0,
|
|
2023
|
+
duration: 800,
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
id: "p11b-2",
|
|
2027
|
+
from: "backend-api",
|
|
2028
|
+
to: "database",
|
|
2029
|
+
label: "Update status + booking_status",
|
|
2030
|
+
type: "request",
|
|
2031
|
+
color: "#7b59e6",
|
|
2032
|
+
delay: 900,
|
|
2033
|
+
duration: 600,
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
id: "p11b-3",
|
|
2037
|
+
from: "backend-api",
|
|
2038
|
+
to: "bullmq",
|
|
2039
|
+
label: "Cleanup all jobs",
|
|
2040
|
+
type: "cleanup",
|
|
2041
|
+
color: "#ef4444",
|
|
2042
|
+
delay: 1600,
|
|
2043
|
+
duration: 700,
|
|
2044
|
+
},
|
|
2045
|
+
{
|
|
2046
|
+
id: "p11b-4",
|
|
2047
|
+
from: "backend-api",
|
|
2048
|
+
to: "driver-app",
|
|
2049
|
+
label: "Push: rider canceled",
|
|
2050
|
+
type: "notification",
|
|
2051
|
+
color: "#fb2576",
|
|
2052
|
+
delay: 2400,
|
|
2053
|
+
duration: 800,
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
id: "p11b-5",
|
|
2057
|
+
from: "backend-api",
|
|
2058
|
+
to: "dac",
|
|
2059
|
+
label: "Delete scheduled ride DAC",
|
|
2060
|
+
type: "cleanup",
|
|
2061
|
+
color: "#ef4444",
|
|
2062
|
+
delay: 3300,
|
|
2063
|
+
duration: 700,
|
|
2064
|
+
},
|
|
2065
|
+
{
|
|
2066
|
+
id: "p11b-6",
|
|
2067
|
+
from: "backend-api",
|
|
2068
|
+
to: "pubsub",
|
|
2069
|
+
label: "Trip status events",
|
|
2070
|
+
type: "event",
|
|
2071
|
+
color: "#10b981",
|
|
2072
|
+
delay: 4100,
|
|
2073
|
+
duration: 700,
|
|
2074
|
+
},
|
|
2075
|
+
],
|
|
2076
|
+
sideEffects: {
|
|
2077
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
2078
|
+
notifications: "Push to Driver — rider canceled",
|
|
2079
|
+
dac: "deleteScheduledRideAction()",
|
|
2080
|
+
pubsub: "Trip status events",
|
|
2081
|
+
},
|
|
2082
|
+
},
|
|
2083
|
+
],
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
id: "11c",
|
|
2087
|
+
label: "Driver Cancels After Arrival",
|
|
2088
|
+
steps: [
|
|
2089
|
+
{
|
|
2090
|
+
id: "p11c-active-state",
|
|
2091
|
+
title: "Trip — Driver Has Arrived",
|
|
2092
|
+
description:
|
|
2093
|
+
"Driver has arrived at pickup location.",
|
|
2094
|
+
actor: "system",
|
|
2095
|
+
status: "DRIVER_ARRIVED",
|
|
2096
|
+
bookingStatus: "BOOK_DRIVER_CONFIRMED",
|
|
2097
|
+
trigger: "Active trip state",
|
|
2098
|
+
handler: "N/A",
|
|
2099
|
+
activeComponents: [
|
|
2100
|
+
"rider-app",
|
|
2101
|
+
"driver-app",
|
|
2102
|
+
"backend-api",
|
|
2103
|
+
"database",
|
|
2104
|
+
],
|
|
2105
|
+
messages: [],
|
|
2106
|
+
sideEffects: {},
|
|
2107
|
+
},
|
|
2108
|
+
{
|
|
2109
|
+
id: "p11c-driver-cancels",
|
|
2110
|
+
title: "Driver Cancels After Arrival",
|
|
2111
|
+
description:
|
|
2112
|
+
"Driver cancels after arriving at pickup. Rider is notified and driver goes ONLINE.",
|
|
2113
|
+
actor: "ops",
|
|
2114
|
+
status: "DRIVER_ARRIVED_CANCELED",
|
|
2115
|
+
bookingStatus: "BOOK_OPERATION_DRIVER_CANCELED",
|
|
2116
|
+
trigger:
|
|
2117
|
+
"Ops PUT /trips/:tripId/status → DRIVER_ARRIVED_CANCELED + internal-access-key",
|
|
2118
|
+
handler: "fnUpdateBookingStatus",
|
|
2119
|
+
activeComponents: [
|
|
2120
|
+
"ops-dashboard",
|
|
2121
|
+
"backend-api",
|
|
2122
|
+
"bullmq",
|
|
2123
|
+
"rider-app",
|
|
2124
|
+
"driver-app",
|
|
2125
|
+
"dac",
|
|
2126
|
+
"pubsub",
|
|
2127
|
+
"database",
|
|
2128
|
+
],
|
|
2129
|
+
messages: [
|
|
2130
|
+
{
|
|
2131
|
+
id: "p11c-1",
|
|
2132
|
+
from: "ops-dashboard",
|
|
2133
|
+
to: "backend-api",
|
|
2134
|
+
label: "PUT status: DRIVER_ARRIVED_CANCELED",
|
|
2135
|
+
type: "request",
|
|
2136
|
+
color: "#7b59e6",
|
|
2137
|
+
delay: 0,
|
|
2138
|
+
duration: 800,
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
id: "p11c-2",
|
|
2142
|
+
from: "backend-api",
|
|
2143
|
+
to: "database",
|
|
2144
|
+
label: "Update status + booking_status",
|
|
2145
|
+
type: "request",
|
|
2146
|
+
color: "#7b59e6",
|
|
2147
|
+
delay: 900,
|
|
2148
|
+
duration: 600,
|
|
2149
|
+
},
|
|
2150
|
+
{
|
|
2151
|
+
id: "p11c-3",
|
|
2152
|
+
from: "backend-api",
|
|
2153
|
+
to: "bullmq",
|
|
2154
|
+
label: "Cleanup all jobs",
|
|
2155
|
+
type: "cleanup",
|
|
2156
|
+
color: "#ef4444",
|
|
2157
|
+
delay: 1600,
|
|
2158
|
+
duration: 700,
|
|
2159
|
+
},
|
|
2160
|
+
{
|
|
2161
|
+
id: "p11c-4",
|
|
2162
|
+
from: "backend-api",
|
|
2163
|
+
to: "rider-app",
|
|
2164
|
+
label: "Push: driver canceled after arrival",
|
|
2165
|
+
type: "notification",
|
|
2166
|
+
color: "#fb2576",
|
|
2167
|
+
delay: 2400,
|
|
2168
|
+
duration: 800,
|
|
2169
|
+
},
|
|
2170
|
+
{
|
|
2171
|
+
id: "p11c-5",
|
|
2172
|
+
from: "backend-api",
|
|
2173
|
+
to: "dac",
|
|
2174
|
+
label: "Delete scheduled ride DAC",
|
|
2175
|
+
type: "cleanup",
|
|
2176
|
+
color: "#ef4444",
|
|
2177
|
+
delay: 3300,
|
|
2178
|
+
duration: 700,
|
|
2179
|
+
},
|
|
2180
|
+
{
|
|
2181
|
+
id: "p11c-6",
|
|
2182
|
+
from: "backend-api",
|
|
2183
|
+
to: "pubsub",
|
|
2184
|
+
label: "Trip status events",
|
|
2185
|
+
type: "event",
|
|
2186
|
+
color: "#10b981",
|
|
2187
|
+
delay: 4100,
|
|
2188
|
+
duration: 700,
|
|
2189
|
+
},
|
|
2190
|
+
],
|
|
2191
|
+
sideEffects: {
|
|
2192
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
2193
|
+
notifications:
|
|
2194
|
+
"Push to Rider — driver canceled after arrival",
|
|
2195
|
+
dac: "deleteScheduledRideAction()",
|
|
2196
|
+
pubsub: "Trip status events",
|
|
2197
|
+
},
|
|
2198
|
+
},
|
|
2199
|
+
],
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
id: "11d",
|
|
2203
|
+
label: "Rider Cancels After Driver Arrived",
|
|
2204
|
+
steps: [
|
|
2205
|
+
{
|
|
2206
|
+
id: "p11d-active-state",
|
|
2207
|
+
title: "Trip — Driver Has Arrived",
|
|
2208
|
+
description:
|
|
2209
|
+
"Driver has arrived at pickup location.",
|
|
2210
|
+
actor: "system",
|
|
2211
|
+
status: "DRIVER_ARRIVED",
|
|
2212
|
+
bookingStatus: "BOOK_DRIVER_CONFIRMED",
|
|
2213
|
+
trigger: "Active trip state",
|
|
2214
|
+
handler: "N/A",
|
|
2215
|
+
activeComponents: [
|
|
2216
|
+
"rider-app",
|
|
2217
|
+
"driver-app",
|
|
2218
|
+
"backend-api",
|
|
2219
|
+
"database",
|
|
2220
|
+
],
|
|
2221
|
+
messages: [],
|
|
2222
|
+
sideEffects: {},
|
|
2223
|
+
},
|
|
2224
|
+
{
|
|
2225
|
+
id: "p11d-rider-cancels",
|
|
2226
|
+
title: "Rider Cancels After Driver Arrived",
|
|
2227
|
+
description:
|
|
2228
|
+
"Rider cancels after driver has arrived at pickup. Driver is notified and goes ONLINE.",
|
|
2229
|
+
actor: "ops",
|
|
2230
|
+
status: "DRIVER_ARRIVED_RIDER_CANCELED",
|
|
2231
|
+
bookingStatus: "BOOK_OPERATION_RIDER_CANCELED",
|
|
2232
|
+
trigger:
|
|
2233
|
+
"Ops PUT /trips/:tripId/status → DRIVER_ARRIVED_RIDER_CANCELED + internal-access-key",
|
|
2234
|
+
handler: "fnUpdateBookingStatus",
|
|
2235
|
+
activeComponents: [
|
|
2236
|
+
"ops-dashboard",
|
|
2237
|
+
"backend-api",
|
|
2238
|
+
"bullmq",
|
|
2239
|
+
"rider-app",
|
|
2240
|
+
"driver-app",
|
|
2241
|
+
"dac",
|
|
2242
|
+
"pubsub",
|
|
2243
|
+
"database",
|
|
2244
|
+
],
|
|
2245
|
+
messages: [
|
|
2246
|
+
{
|
|
2247
|
+
id: "p11d-1",
|
|
2248
|
+
from: "ops-dashboard",
|
|
2249
|
+
to: "backend-api",
|
|
2250
|
+
label: "PUT status: DRIVER_ARRIVED_RIDER_CANCELED",
|
|
2251
|
+
type: "request",
|
|
2252
|
+
color: "#7b59e6",
|
|
2253
|
+
delay: 0,
|
|
2254
|
+
duration: 800,
|
|
2255
|
+
},
|
|
2256
|
+
{
|
|
2257
|
+
id: "p11d-2",
|
|
2258
|
+
from: "backend-api",
|
|
2259
|
+
to: "database",
|
|
2260
|
+
label: "Update status + booking_status",
|
|
2261
|
+
type: "request",
|
|
2262
|
+
color: "#7b59e6",
|
|
2263
|
+
delay: 900,
|
|
2264
|
+
duration: 600,
|
|
2265
|
+
},
|
|
2266
|
+
{
|
|
2267
|
+
id: "p11d-3",
|
|
2268
|
+
from: "backend-api",
|
|
2269
|
+
to: "bullmq",
|
|
2270
|
+
label: "Cleanup all jobs",
|
|
2271
|
+
type: "cleanup",
|
|
2272
|
+
color: "#ef4444",
|
|
2273
|
+
delay: 1600,
|
|
2274
|
+
duration: 700,
|
|
2275
|
+
},
|
|
2276
|
+
{
|
|
2277
|
+
id: "p11d-4",
|
|
2278
|
+
from: "backend-api",
|
|
2279
|
+
to: "driver-app",
|
|
2280
|
+
label: "Push: rider canceled after arrival",
|
|
2281
|
+
type: "notification",
|
|
2282
|
+
color: "#fb2576",
|
|
2283
|
+
delay: 2400,
|
|
2284
|
+
duration: 800,
|
|
2285
|
+
},
|
|
2286
|
+
{
|
|
2287
|
+
id: "p11d-5",
|
|
2288
|
+
from: "backend-api",
|
|
2289
|
+
to: "dac",
|
|
2290
|
+
label: "Delete scheduled ride DAC",
|
|
2291
|
+
type: "cleanup",
|
|
2292
|
+
color: "#ef4444",
|
|
2293
|
+
delay: 3300,
|
|
2294
|
+
duration: 700,
|
|
2295
|
+
},
|
|
2296
|
+
{
|
|
2297
|
+
id: "p11d-6",
|
|
2298
|
+
from: "backend-api",
|
|
2299
|
+
to: "pubsub",
|
|
2300
|
+
label: "Trip status events",
|
|
2301
|
+
type: "event",
|
|
2302
|
+
color: "#10b981",
|
|
2303
|
+
delay: 4100,
|
|
2304
|
+
duration: 700,
|
|
2305
|
+
},
|
|
2306
|
+
],
|
|
2307
|
+
sideEffects: {
|
|
2308
|
+
jobs: "cleanupBookingJobs() + cleanupDriverBookingJobs()",
|
|
2309
|
+
notifications:
|
|
2310
|
+
"Push to Driver — rider canceled after arrival",
|
|
2311
|
+
dac: "deleteScheduledRideAction()",
|
|
2312
|
+
pubsub: "Trip status events",
|
|
2313
|
+
},
|
|
2314
|
+
},
|
|
2315
|
+
],
|
|
2316
|
+
},
|
|
2317
|
+
],
|
|
2318
|
+
},
|
|
2319
|
+
];
|