-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexpected-mapspec.json
More file actions
787 lines (787 loc) · 34.2 KB
/
Copy pathexpected-mapspec.json
File metadata and controls
787 lines (787 loc) · 34.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
{
"schemaVersion": 1,
"meta": {
"title": "Coffee counter order flow",
"question": "How does a submitted counter order move from collaborator setup through validation, payment, receipt delivery, and follow-up options?",
"scope": "The four small JavaScript modules under sample-repo.",
"languageProfile": "javascript-esm",
"uiLocale": "en",
"layoutDirection": "TD",
"summary": "The demo deliberately covers ten groups and fourteen nodes. Order intake fans out into catalog, availability, payment-token, estimated-amount, and cross-cut audit work; independent reservation-hold and cost-calculation paths then converge with the payment checks into authorization. This intentionally exercises a wide top-to-bottom graph with branch, merge, cross-group routing, and inferred or unconfirmed paths. Every verified claim points to a source range in the small sample repository."
},
"nodes": [
{
"id": "n1",
"title": "Create order",
"category": "orchestration",
"subgraph": "Order intake",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 5, "lineEnd": 5, "symbol": "createOrder", "note": "The public orchestration entry point receives the input and optional dependency overrides.", "state": "verified" },
{ "path": "order-service.js", "lineStart": 6, "lineEnd": 8, "symbol": "createOrder", "note": "Each collaborator uses the injected implementation when present and otherwise falls back to the imported default.", "state": "verified" },
{ "path": "order-service.js", "lineStart": 9, "lineEnd": 11, "symbol": "createOrder", "note": "Items are normalized before reservation, and the reservation total becomes the payment amount.", "state": "verified" },
{ "path": "order-service.js", "lineStart": 12, "lineEnd": 12, "symbol": "createOrder", "note": "The receipt builder receives the order ID, normalized items, and accepted payment object.", "state": "verified" }
],
"detail": {
"summary": "The orchestration function drives the complete order path and passes the payment result into receipt creation.",
"segments": [
{
"kind": "value",
"title": "Execution sequence",
"subtitle": "createOrder :5-12",
"headers": ["Order", "Operation", "Why it matters"],
"rows": [
["1", "Resolve collaborators", "Keeps the orchestration testable without changing the business sequence"],
["2", "normalizeItems(input.items)", "Makes every later service consume a stable item shape"],
["3", "reserve(items)", "Returns the totalCents amount used for payment"],
["4", "charge(input.paymentToken, reservation.totalCents)", "Stops the happy path when either payment guard fails"],
["5", "receipt({ orderId, items, payment })", "Builds the final receipt model returned to the caller"]
]
},
{
"kind": "schema",
"title": "Input contract consumed by the orchestrator",
"subtitle": "Fields read directly or forwarded to the next stage",
"headers": ["Field", "Consumed by", "Role in the flow"],
"rows": [
["input.orderId", "makeReceipt", "Becomes the receipt identity"],
["input.items", "normalizeItems", "Source collection for reservation and receipt lines"],
["input.paymentToken", "chargeCard", "Required by the payment guard"],
["dependencies", "createOrder", "Optional reserve / charge / receipt overrides for tests"]
]
},
{
"kind": "value",
"title": "Collaborator resolution rule",
"subtitle": "Per-operation fallback",
"headers": ["Operation", "Preferred implementation", "Fallback"],
"rows": [
["Reserve inventory", "dependencies.reserveIngredients", "reserveIngredients import"],
["Authorize payment", "dependencies.chargeCard", "chargeCard import"],
["Build receipt", "dependencies.makeReceipt", "makeReceipt import"]
]
},
{
"kind": "schema",
"title": "Returned receipt model",
"subtitle": "The object assembled by makeReceipt",
"headers": ["Field", "Source", "Meaning"],
"rows": [
["orderId", "input.orderId", "Caller-facing order identity"],
["lines", "normalized items", "Readable quantity × sku text"],
["paymentStatus", "payment.status", "Accepted payment state"],
["paymentReference", "payment.reference", "Gateway reference carried into the receipt"]
]
},
{
"kind": "code",
"title": "Orchestration outline",
"subtitle": "The complete happy-path handoff",
"headers": ["Source"],
"rows": [["const reserve = dependencies.reserveIngredients || reserveIngredients;"], ["const items = normalizeItems(input.items);"], ["const reservation = reserve(items);"], ["const payment = charge(input.paymentToken, reservation.totalCents);"], ["return receipt({ orderId: input.orderId, items, payment });"]]
}
]
}
},
{
"id": "n2",
"title": "Resolve default collaborators",
"category": "dependency setup",
"subgraph": "Order intake",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 6, "lineEnd": 8, "symbol": "createOrder", "note": "Uses injected collaborators when supplied and otherwise selects the imported defaults.", "state": "verified" }
],
"detail": {
"summary": "Reservation, payment, and receipt collaborators can each be supplied by the caller, which keeps the order flow testable.",
"segments": [
{
"kind": "value",
"title": "Resolution precedence",
"subtitle": "One rule applied independently to all three collaborators",
"headers": ["Capability", "Preferred value", "Fallback"],
"rows": [
["Reserve", "dependencies.reserveIngredients", "Imported reserveIngredients"],
["Charge", "dependencies.chargeCard", "Imported chargeCard"],
["Receipt", "dependencies.makeReceipt", "Imported makeReceipt"]
]
},
{
"kind": "schema",
"title": "Optional dependency object",
"subtitle": "Caller-provided overrides",
"headers": ["Property", "Expected behavior", "When omitted"],
"rows": [
["reserveIngredients", "Accept normalized items and return reservation", "Default inventory checker is used"],
["chargeCard", "Accept token and cents and return payment", "Default payment gateway is used"],
["makeReceipt", "Accept receipt inputs and return presentation model", "Default receipt renderer is used"]
]
}
]
}
},
{
"id": "n3",
"title": "Normalize line items",
"category": "transformation",
"subgraph": "Order intake",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 9, "lineEnd": 9, "symbol": "createOrder", "note": "Normalizes input before inventory is consulted.", "state": "verified" },
{ "path": "order-service.js", "lineStart": 15, "lineEnd": 20, "symbol": "normalizeItems", "note": "Coerces sku, quantity, and unitCents into a consistent record shape.", "state": "verified" }
],
"detail": {
"summary": "Normalization provides an inventory-safe item shape before reservation begins.",
"segments": [
{
"kind": "value",
"title": "Field normalization rules",
"subtitle": "normalizeItems :15-20",
"headers": ["Field", "Transformation", "Fallback"],
"rows": [
["sku", "String(item.sku)", "Always becomes a string"],
["quantity", "Number(item.quantity)", "At least 1; invalid or falsy input becomes 1"],
["unitCents", "Number(item.unitCents)", "Invalid or falsy input becomes 0"]
]
},
{
"kind": "schema",
"title": "Normalized line item",
"subtitle": "Shape passed to inventory and receipt stages",
"headers": ["Field", "Type after normalization", "Downstream use"],
"rows": [
["sku", "String", "Catalog lookup and receipt line text"],
["quantity", "Number ≥ 1", "Availability guard and stock decrement"],
["unitCents", "Number", "Input-shape compatibility; inventory uses catalog price instead"]
]
},
{
"kind": "code",
"title": "Normalization core",
"subtitle": "order-service.js :15-20",
"headers": ["Source"],
"rows": [["return (items || []).map((item) => ({"], [" sku: String(item.sku),"], [" quantity: Math.max(1, Number(item.quantity) || 1),"], [" unitCents: Number(item.unitCents) || 0,"], ["}));"]]
}
]
}
},
{
"id": "n4",
"title": "Look up catalog item",
"category": "inventory lookup",
"subgraph": "Catalog resolution",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 9, "lineEnd": 10, "symbol": "reserveIngredients", "note": "Fetches a catalog entry for each normalized sku.", "state": "verified" }
],
"detail": {
"summary": "Each requested sku is resolved against the in-memory catalog before its stock is changed.",
"segments": [
{
"kind": "value",
"title": "Lookup behavior",
"subtitle": "reserveIngredients :9-10",
"headers": ["Input", "Lookup", "Result"],
"rows": [
["Normalized item.sku", "CATALOG.get(item.sku)", "Returns an entry or undefined"],
["Known demo sku", "espresso / oat-milk / croissant", "Supplies available quantity and catalog unit price"],
["Unknown sku", "Map lookup misses", "The next guard rejects the reservation"]
]
},
{
"kind": "schema",
"title": "Catalog entry",
"subtitle": "In-memory value stored per sku",
"headers": ["Field", "Type", "Later use"],
"rows": [
["available", "Number", "Compared against quantity, then decremented"],
["unitCents", "Number", "Used to calculate the reservation total"]
]
}
]
}
},
{
"id": "n5",
"title": "Verify available quantity",
"category": "inventory guard",
"subgraph": "Availability policy",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 11, "lineEnd": 13, "symbol": "reserveIngredients", "note": "Rejects a missing catalog item or insufficient available quantity.", "state": "verified" }
],
"detail": {
"summary": "The reservation loop stops with an error before mutating stock when an item cannot be fulfilled.",
"segments": [
{
"kind": "value",
"title": "Availability guard",
"subtitle": "inventory-checker.js :11-13",
"headers": ["Condition", "Failure", "Mutation status"],
"rows": [
["No catalog entry", "Unavailable item error", "No decrement for the current item"],
["available < quantity", "Unavailable item error", "No decrement for the current item"],
["Entry exists and quantity fits", "Continue", "The next line may update available"]
]
},
{
"kind": "code",
"title": "Guard clause",
"subtitle": "The loop’s decision point",
"headers": ["Source"],
"rows": [["if (!entry || entry.available < item.quantity) {"], [" throw new Error(`Unavailable item: ${item.sku}`);"], ["}"]]
}
]
}
},
{
"id": "n6",
"title": "Reserve item quantity",
"category": "inventory mutation",
"subgraph": "Reservation hold",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 14, "lineEnd": 14, "symbol": "reserveIngredients", "note": "Decreases the available quantity only after the guard passes.", "state": "verified" }
],
"detail": {
"summary": "The catalog entry is updated in place for each reserved item.",
"segments": [
{
"kind": "value",
"title": "Mutation semantics",
"subtitle": "Runs only after the availability guard",
"headers": ["Operation", "Affected value", "Observable effect"],
"rows": [
["entry.available -= item.quantity", "Catalog entry", "Subsequent reservations see the lower stock balance"],
["totalCents += quantity × unitCents", "Loop accumulator", "Builds the amount consumed by payment authorization"],
["Loop continues", "Next item", "A later failure does not roll back earlier in-memory decrements"]
]
},
{
"kind": "schema",
"title": "Mutation boundary",
"subtitle": "What the demo does and does not persist",
"headers": ["Concern", "Current implementation"],
"rows": [
["Storage", "A module-level JavaScript Map only"],
["Transaction", "No rollback or persistence layer is modeled"],
["Cross-request behavior", "State remains for the lifetime of the running module"]
]
}
]
}
},
{
"id": "n7",
"title": "Accumulate reservation total",
"category": "calculation",
"subgraph": "Cost calculation",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 15, "lineEnd": 17, "symbol": "reserveIngredients", "note": "Adds line totals and returns totalCents with the reservation result.", "state": "verified" }
],
"detail": {
"summary": "The computed totalCents value is the amount later supplied to the payment collaborator.",
"segments": [
{
"kind": "value",
"title": "Reservation result",
"headers": ["Field", "Meaning"],
"rows": [["reserved", "Stock was reserved for all requested items"], ["totalCents", "Amount supplied to payment authorization"]]
},
{
"kind": "value",
"title": "Per-item reservation calculation",
"subtitle": "Inside reserveIngredients",
"headers": ["Step", "Expression", "Result"],
"rows": [
["Availability guard", "entry.available < item.quantity", "Stops before any mutation for that item"],
["Stock mutation", "entry.available -= item.quantity", "Decreases the in-memory catalog balance"],
["Line total", "item.quantity * entry.unitCents", "Adds the item’s value to totalCents"],
["Loop completion", "return { reserved: true, totalCents }", "Produces the input used by payment authorization"]
]
},
{
"kind": "schema",
"title": "Catalog entry and reservation output",
"subtitle": "Data shapes used by the inventory boundary",
"headers": ["Shape", "Field", "Meaning"],
"rows": [
["Catalog entry", "available", "Mutable quantity currently in stock"],
["Catalog entry", "unitCents", "Unit price used for the running total"],
["Reservation output", "reserved", "True only after the whole loop completes"],
["Reservation output", "totalCents", "Positive cents amount forwarded to chargeCard"]
]
},
{
"kind": "code",
"title": "Reservation tail",
"subtitle": "inventory-checker.js :14-17",
"headers": ["Source"],
"rows": [["entry.available -= item.quantity;"], ["totalCents += item.quantity * entry.unitCents;"], ["}"], ["return { reserved: true, totalCents };"]]
}
]
}
},
{
"id": "n8",
"title": "Require payment token",
"category": "payment guard",
"subgraph": "Payment validation",
"claimState": "verified",
"evidence": [
{ "path": "payment-gateway.js", "lineStart": 1, "lineEnd": 4, "symbol": "chargeCard", "note": "Rejects a charge when no payment token is supplied.", "state": "verified" }
],
"detail": {
"summary": "Payment authorization requires a token before any accepted result can be returned.",
"segments": [
{
"kind": "value",
"title": "Token guard",
"subtitle": "First condition in chargeCard",
"headers": ["Input state", "Result", "Why it is first"],
"rows": [
["Falsy paymentToken", "Throws 'A payment token is required'", "Avoids evaluating an amount for an unauthenticated request"],
["Truthy paymentToken", "Continues to amount validation", "Does not itself authorize or persist a charge"]
]
},
{
"kind": "schema",
"title": "Error boundary",
"subtitle": "Failure signaling in the sample",
"headers": ["Mechanism", "Message", "Caller responsibility"],
"rows": [
["JavaScript Error", "A payment token is required", "Handle, display, or translate the exception outside this module"]
]
}
]
}
},
{
"id": "n9",
"title": "Require positive charge amount",
"category": "payment guard",
"subgraph": "Payment validation",
"claimState": "verified",
"evidence": [
{ "path": "payment-gateway.js", "lineStart": 5, "lineEnd": 7, "symbol": "chargeCard", "note": "Rejects a non-positive charge amount.", "state": "verified" }
],
"detail": {
"summary": "The payment collaborator only accepts a charge amount greater than zero.",
"segments": [
{
"kind": "value",
"title": "Amount guard",
"subtitle": "Second condition in chargeCard",
"headers": ["Input", "Accepted range", "Rejected range"],
"rows": [
["amountCents", "Greater than 0", "0 or any negative value"],
["Reservation total", "Derived from reserved catalog lines", "Cannot produce an accepted payment when empty or non-positive"]
]
},
{
"kind": "code",
"title": "Positive-amount check",
"subtitle": "payment-gateway.js :5-7",
"headers": ["Source"],
"rows": [["if (amountCents <= 0) {"], [" throw new Error('The charge amount must be positive');"], ["}"]]
}
]
}
},
{
"id": "n10",
"title": "Authorize payment",
"category": "payment",
"subgraph": "Payment authorization",
"claimState": "verified",
"evidence": [
{ "path": "payment-gateway.js", "lineStart": 1, "lineEnd": 7, "symbol": "chargeCard", "note": "The token and positive-amount guards execute before an accepted response can be constructed.", "state": "verified" },
{ "path": "payment-gateway.js", "lineStart": 8, "lineEnd": 11, "symbol": "chargeCard", "note": "The success path returns an accepted status and a deterministic reference derived from amountCents.", "state": "verified" }
],
"detail": {
"summary": "The sample gateway returns an accepted payment shape after the token and amount checks complete.",
"segments": [
{
"kind": "value",
"title": "Authorization gates",
"subtitle": "Both guards must pass before a response exists",
"headers": ["Check", "Rejected when", "Effect"],
"rows": [
["paymentToken", "Falsy", "Throws before the amount is considered"],
["amountCents", "≤ 0", "Throws before an accepted status is returned"],
["Both valid", "Token truthy and amount positive", "Constructs a local accepted response"]
]
},
{
"kind": "schema",
"title": "Accepted payment response",
"subtitle": "Returned by chargeCard",
"headers": ["Field", "Value source", "Meaning"],
"rows": [
["status", "Literal 'accepted'", "The demo’s successful authorization state"],
["reference", "`demo-${amountCents}`", "Deterministic payment reference for the receipt model"]
]
},
{
"kind": "value",
"title": "Demo boundary",
"subtitle": "What this module deliberately does not model",
"headers": ["Concern", "Current behavior", "Interpretation"],
"rows": [
["External gateway call", "None", "This is a local deterministic sample, not a network integration"],
["Idempotency", "No persistence", "The reference is reproducible from the amount only"],
["Failure result", "Throws Error", "The caller must decide how to present or recover from the failure"]
]
},
{
"kind": "code",
"title": "Success-path code",
"subtitle": "payment-gateway.js :8-11",
"headers": ["Source"],
"rows": [["return {"], [" status: 'accepted',"], [" reference: `demo-${amountCents}`,"], ["};"]]
}
]
}
},
{
"id": "n11",
"title": "Build receipt model",
"category": "presentation",
"subgraph": "Receipt delivery",
"claimState": "verified",
"evidence": [
{ "path": "receipt-renderer.js", "lineStart": 1, "lineEnd": 8, "symbol": "makeReceipt", "note": "Builds receipt lines and carries the payment status and reference forward.", "state": "verified" }
],
"detail": {
"summary": "The receipt model includes order identity, readable item lines, and payment information.",
"segments": [
{
"kind": "schema",
"title": "Receipt model fields",
"subtitle": "makeReceipt return value",
"headers": ["Field", "Source", "Purpose"],
"rows": [
["orderId", "Function argument", "Preserves the order identity"],
["lines", "items.map(...) ", "Prepares human-readable item text"],
["paymentStatus", "payment.status", "Carries the authorization state forward"],
["paymentReference", "payment.reference", "Carries the payment trace identifier forward"]
]
},
{
"kind": "value",
"title": "Line rendering rule",
"subtitle": "A compact display model, not a priced invoice",
"headers": ["Input", "Format", "Example"],
"rows": [
["quantity + sku", "`${quantity} × ${sku}`", "2 × espresso"],
["unitCents", "Not included", "Pricing is used in reservation, not receipt-line rendering"],
["payment object", "Status and reference only", "Keeps receipt construction independent of gateway implementation"]
]
},
{
"kind": "code",
"title": "Receipt assembly",
"subtitle": "receipt-renderer.js :1-8",
"headers": ["Source"],
"rows": [["const lines = items.map((item) => `${item.quantity} × ${item.sku}`);"], ["return {"], [" orderId, lines,"], [" paymentStatus: payment.status,"], [" paymentReference: payment.reference,"], ["};"]]
}
]
}
},
{
"id": "n12",
"title": "Render printable receipt",
"category": "presentation",
"subgraph": "Receipt delivery",
"claimState": "verified",
"evidence": [
{ "path": "receipt-renderer.js", "lineStart": 11, "lineEnd": 12, "symbol": "toPlainText", "note": "Converts a receipt model into a plain-text printable representation.", "state": "verified" }
],
"detail": {
"summary": "The helper formats the order ID and receipt lines into a single text value.",
"segments": [
{
"kind": "value",
"title": "Plain-text rendering rule",
"subtitle": "toPlainText :11-12",
"headers": ["Position", "Text source", "Output form"],
"rows": [
["First line", "receipt.orderId", "Order {orderId}"],
["Later lines", "receipt.lines", "Each prebuilt quantity × sku line"],
["Joiner", "'\\n'", "A printable multi-line text value"]
]
},
{
"kind": "schema",
"title": "Formatting input and output",
"subtitle": "No additional data is introduced",
"headers": ["Input", "Output", "Not included"],
"rows": [
["Receipt model", "String", "Payment status and reference are not printed by this helper"],
["Receipt lines", "Newline-separated body", "No HTML, currency formatting, or file output"]
]
},
{
"kind": "code",
"title": "Formatter source",
"subtitle": "receipt-renderer.js :11-12",
"headers": ["Source"],
"rows": [["return [`Order ${receipt.orderId}`, ...receipt.lines].join('\\n');"]]
}
]
}
},
{
"id": "n13",
"title": "Refund accepted payment",
"category": "possible recovery",
"subgraph": "Follow-up options",
"claimState": "inferred",
"evidence": [
{ "path": "payment-gateway.js", "lineStart": 14, "lineEnd": 16, "symbol": "refundCard", "note": "A refund helper exists, but the order flow does not call it.", "state": "inferred" }
],
"detail": {
"summary": "Refunding is a plausible recovery path because the gateway exposes a refund helper, but this sample has no caller for it.",
"segments": [
{
"kind": "value",
"title": "Why this path is inferred",
"subtitle": "A helper exists, but the main order flow never invokes it",
"headers": ["Observed fact", "Inference", "Limit"],
"rows": [
["refundCard(reference) is exported", "A caller could use the payment reference to reverse an accepted payment", "No order failure or cancellation path calls it"],
["It returns a refunded status", "The result could support a recovery workflow", "No persistence or receipt update is modeled"]
]
},
{
"kind": "schema",
"title": "Potential refund result",
"subtitle": "Actual helper return shape",
"headers": ["Field", "Value", "Evidence status"],
"rows": [
["status", "'refunded'", "Verified for the helper"],
["reference", "Input reference", "Verified for the helper"],
["Invocation from createOrder", "None", "Inferred recovery path only"]
]
}
]
}
},
{
"id": "n14",
"title": "Open lifecycle audit",
"category": "future integration",
"subgraph": "Cross-cut audit",
"claimState": "unconfirmed",
"evidence": [
{ "path": "receipt-renderer.js", "symbol": "makeReceipt", "note": "No loyalty persistence code appears in the sample modules.", "state": "unconfirmed" }
],
"detail": {
"summary": "There is no evidence that order creation opens a cross-cut lifecycle audit; this remains a possible future integration.",
"segments": [
{
"kind": "value",
"title": "Evidence boundary",
"subtitle": "Why this node is explicitly unconfirmed",
"headers": ["Observed source", "What it does", "What is absent"],
"rows": [
["createOrder", "Orchestrates collaborators and returns a receipt", "No audit client, event, or persistence call"],
["toPlainText", "Formats receipt text", "No downstream side effect after formatting"],
["Sample repository", "Contains order, inventory, payment, and receipt modules", "No audit module or integration contract"]
]
},
{
"kind": "schema",
"title": "Potential audit event contract",
"subtitle": "Illustrative only — not implemented in the sample",
"headers": ["Candidate field", "Possible source", "Status"],
"rows": [
["orderId", "Receipt model", "Unconfirmed"],
["paymentReference", "Accepted payment", "Unconfirmed"],
["lifecycleAction", "Future business rule", "Unconfirmed"]
]
},
{
"kind": "value",
"title": "Safe interpretation",
"subtitle": "How to read this dashed node",
"headers": ["Do", "Do not"],
"rows": [
["Treat it as a documented cross-cut possibility", "Treat it as a behavior executed by createOrder"],
["Use it to identify a missing integration boundary", "Claim that an audit record is persisted"]
]
}
]
}
}
],
"edges": [
{
"from": "n1",
"to": "n2",
"label": "resolves collaborators",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 6, "lineEnd": 8, "symbol": "createOrder", "state": "verified" }
]
},
{
"from": "n1",
"to": "n3",
"label": "normalizes order items in parallel",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 9, "lineEnd": 9, "symbol": "createOrder", "state": "verified" }
]
},
{
"from": "n2",
"to": "n4",
"label": "selects inventory collaborator",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 10, "lineEnd": 10, "symbol": "reserveIngredients", "state": "verified" }
]
},
{
"from": "n3",
"to": "n5",
"label": "starts availability policy check",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 11, "lineEnd": 13, "symbol": "reserveIngredients", "state": "verified" }
]
},
{
"from": "n4",
"to": "n6",
"label": "prepares reservation hold",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 14, "lineEnd": 14, "symbol": "reserveIngredients", "state": "verified" }
]
},
{
"from": "n5",
"to": "n7",
"label": "derives availability-aware total",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 15, "lineEnd": 17, "symbol": "reserveIngredients", "state": "verified" }
]
},
{
"from": "n5",
"to": "n6",
"label": "confirms hold eligibility",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 15, "lineEnd": 17, "symbol": "reserveIngredients", "state": "verified" }
]
},
{
"from": "n3",
"to": "n4",
"label": "supplies normalized items",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 9, "lineEnd": 10, "symbol": "createOrder", "state": "verified" }
]
},
{
"from": "n2",
"to": "n8",
"label": "selects payment collaborator",
"claimState": "verified",
"evidence": [
{ "path": "payment-gateway.js", "lineStart": 2, "lineEnd": 4, "symbol": "chargeCard", "state": "verified" }
]
},
{
"from": "n3",
"to": "n9",
"label": "derives estimated charge amount",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 11, "lineEnd": 11, "symbol": "createOrder", "state": "verified" }
]
},
{
"from": "n8",
"to": "n10",
"label": "token accepted",
"labelKind": "condition",
"claimState": "verified",
"evidence": [
{ "path": "payment-gateway.js", "lineStart": 8, "lineEnd": 11, "symbol": "chargeCard", "state": "verified" }
]
},
{
"from": "n9",
"to": "n10",
"label": "amount accepted",
"labelKind": "condition",
"claimState": "verified",
"evidence": [
{ "path": "payment-gateway.js", "lineStart": 8, "lineEnd": 11, "symbol": "chargeCard", "state": "verified" }
]
},
{
"from": "n6",
"to": "n10",
"label": "reservation hold ready",
"labelKind": "condition",
"claimState": "verified",
"evidence": [
{ "path": "inventory-checker.js", "lineStart": 14, "lineEnd": 17, "symbol": "reserveIngredients", "state": "verified" }
]
},
{
"from": "n7",
"to": "n10",
"label": "total ready for charge",
"labelKind": "condition",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 10, "lineEnd": 11, "symbol": "createOrder", "state": "verified" }
]
},
{
"from": "n10",
"to": "n11",
"label": "returns payment result",
"claimState": "verified",
"evidence": [
{ "path": "order-service.js", "lineStart": 12, "lineEnd": 12, "symbol": "createOrder", "state": "verified" }
]
},
{
"from": "n11",
"to": "n12",
"label": "renders as text",
"claimState": "verified",
"evidence": [
{ "path": "receipt-renderer.js", "lineStart": 11, "lineEnd": 12, "symbol": "toPlainText", "state": "verified" }
]
},
{
"from": "n10",
"to": "n13",
"label": "may be refunded",
"claimState": "inferred",
"evidence": [
{ "path": "payment-gateway.js", "lineStart": 14, "lineEnd": 16, "symbol": "refundCard", "state": "inferred" }
]
},
{
"from": "n1",
"to": "n14",
"label": "could open lifecycle audit",
"claimState": "unconfirmed",
"evidence": [
{ "path": "order-service.js", "symbol": "createOrder", "state": "unconfirmed" }
]
}
]
}